Commit d5b07d71 authored by Ole Streicher's avatar Ole Streicher

New upstream version 1.3.3

parent 7af0cb5a
1.3.3 (2018-03-01)
------------------
- Update test infrastructure to rely on new Astropy v3.0 plugins. [#461]
- Disable use of 2to3. This was causing test failures on Debian builds. [#463]
1.3.2 (2018-02-22)
------------------
......
Metadata-Version: 1.2
Name: asdf
Version: 1.3.2
Version: 1.3.3
Summary: Python tools to handle ASDF files
Home-page: http://github.com/spacetelescope/asdf
Author: Erik Bray, Michael Droettboom
......
# Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, unicode_literals, print_function
......@@ -14,10 +13,16 @@ try:
except ImportError:
ICRS = None
try:
# Attempt to maintain backwards compatibility withearlier versions of astropy
from astropy import __version__ as astropy_version
if astropy_version < '3.0':
import astropy
from astropy.tests.disable_internet import INTERNET_OFF
except ImportError:
INTERNET_OFF = False
remote_data = astropy.tests.helper.remote_data
else:
import pytest
from pytest_remotedata.disable_internet import INTERNET_OFF
remote_data = pytest.mark.remote_data
try:
from astropy.coordinates.representation import CartesianRepresentation
......
......@@ -20,14 +20,6 @@ from .. import util
from . import helpers
try:
from astropy.io import fits
from astropy.tests.disable_internet import INTERNET_OFF
HAS_ASTROPY = True
except ImportError:
HAS_ASTROPY = False
INTERNET_OFF = False
def _get_small_tree():
x = np.arange(0, 10, dtype=np.float)
......@@ -253,7 +245,7 @@ def test_streams2():
assert len(x) == 60
@pytest.mark.skipif(INTERNET_OFF, reason="Astropy has disabled internet access")
@helpers.remote_data
@pytest.mark.skipif(sys.platform.startswith('win'),
reason="Windows firewall prevents test")
def test_urlopen(tree, httpserver):
......@@ -273,7 +265,7 @@ def test_urlopen(tree, httpserver):
assert isinstance(next(ff.blocks.internal_blocks)._data, np.ndarray)
@pytest.mark.skipif(INTERNET_OFF, reason="Astropy has disabled internet access")
@helpers.remote_data
@pytest.mark.skipif(sys.platform.startswith('win'),
reason="Windows firewall prevents test")
def test_http_connection(tree, httpserver):
......@@ -298,7 +290,7 @@ def test_http_connection(tree, httpserver):
ff.tree['science_data'][0] == 42
@pytest.mark.skipif(INTERNET_OFF, reason="Astropy has disabled internet access")
@helpers.remote_data
@pytest.mark.skipif(sys.platform.startswith('win'),
reason="Windows firewall prevents test")
def test_http_connection_range(tree, rhttpserver):
......@@ -315,11 +307,6 @@ def test_http_connection_range(tree, rhttpserver):
return fd
with _roundtrip(tree, get_write_fd, get_read_fd) as ff:
if len(tree) == 4:
assert connection[0]._nreads == 0
else:
assert connection[0]._nreads == 6
assert len(list(ff.blocks.internal_blocks)) == 2
assert isinstance(next(ff.blocks.internal_blocks)._data, np.core.memmap)
assert isinstance(next(ff.blocks.internal_blocks)._data, np.ndarray)
......@@ -363,6 +350,7 @@ def test_exploded_filesystem_fail(tree, tmpdir):
helpers.assert_tree_match(tree, ff.tree)
@helpers.remote_data
@pytest.mark.skipif(sys.platform.startswith('win'),
reason="Windows firewall prevents test")
def test_exploded_http(tree, httpserver):
......@@ -795,12 +783,14 @@ def test_truncated_reader():
assert tr.read() == b''
@pytest.mark.skipif('not HAS_ASTROPY')
def test_is_asdf(tmpdir):
# test fits
astropy = pytest.importorskip('astropy')
from astropy.io import fits
hdul = fits.HDUList()
phdu=fits.PrimaryHDU()
imhdu=fits.ImageHDU(data=np.arange(24).reshape((4,6)))
phdu= fits.PrimaryHDU()
imhdu= fits.ImageHDU(data=np.arange(24).reshape((4,6)))
hdul.append(phdu)
hdul.append(imhdu)
path = os.path.join(str(tmpdir), 'test.fits')
......
# Autogenerated by Astropy-affiliated package asdf's setup.py on 2018-02-22 15:58:18
# Autogenerated by Astropy-affiliated package asdf's setup.py on 2018-03-01 17:09:08
from __future__ import unicode_literals
import datetime
......@@ -187,8 +187,8 @@ def _get_repo_path(pathname, levels=None): # pragma: no cover
_packagename = "asdf"
_last_generated_version = "1.3.2"
_last_githash = "d7e1288916c7569445125a613511c3ece64aa0f4"
_last_generated_version = "1.3.3"
_last_githash = "a112e78aaa901c5f9dbbced2b60425c992edf896"
# Determine where the source code for this module
# lives. If __file__ is not a filesystem path then
......@@ -206,10 +206,10 @@ else:
major = 1
minor = 3
bugfix = 2
bugfix = 3
release = True
timestamp = datetime.datetime(2018, 2, 22, 15, 58, 18)
timestamp = datetime.datetime(2018, 3, 1, 17, 9, 8)
debug = False
try:
......
......@@ -16,7 +16,7 @@ env:
- PYTHON_VERSION=3.4 SETUPTOOLS_VERSION=20
- PYTHON_VERSION=3.5
- PYTHON_VERSION=3.6 SETUPTOOLS_VERSION=dev DEBUG=True
CONDA_DEPENDENCIES='sphinx cython numpy packaging six appdirs'
CONDA_DEPENDENCIES='sphinx cython numpy six pytest-cov'
EVENT_TYPE='push pull_request cron'
global:
......@@ -40,10 +40,14 @@ matrix:
- os: linux
env: PYTHON_VERSION=3.6 SPHINX_VERSION='<1.6' SETUPTOOLS_VERSION=27
allow_failures:
- env: PYTHON_VERSION=3.6 SETUPTOOLS_VERSION=dev DEBUG=True
CONDA_DEPENDENCIES='sphinx cython numpy packaging six appdirs'
EVENT_TYPE='push pull_request cron'
# Uncomment the following if there are issues in setuptools that we
# can't work around quickly - otherwise leave uncommented so that
# we notice when things go wrong.
#
# allow_failures:
# - env: PYTHON_VERSION=3.6 SETUPTOOLS_VERSION=dev DEBUG=True
# CONDA_DEPENDENCIES='sphinx cython numpy six pytest-cov'
# EVENT_TYPE='push pull_request cron'
install:
......@@ -65,5 +69,11 @@ script:
# Use full path for coveragerc; see issue #193
- py.test --cov astropy_helpers --cov-config $(pwd)/astropy_helpers/tests/coveragerc astropy_helpers
# In conftest.py we produce a .coverage.subprocess that contains coverage
# statistics for sub-processes, so we combine it with the main one here.
- mv .coverage .coverage.main
- coverage combine .coverage.main .coverage.subprocess
- coverage report
after_success:
- coveralls --rcfile=astropy_helpers/tests/coveragerc
astropy-helpers Changelog
*************************
2.0.6 (2018-02-24)
------------------
- Avoid deprecation warning due to ``exclude=`` keyword in ``setup.py``. [#379]
2.0.5 (2018-02-22)
------------------
- Fix segmentation faults that occurred when the astropy-helpers submodule
was first initialized in packages that also contained Cython code. [#375]
2.0.4 (2018-02-09)
------------------
......
......@@ -142,7 +142,6 @@ import pkg_resources
from setuptools import Distribution
from setuptools.package_index import PackageIndex
from setuptools.sandbox import run_setup
from distutils import log
from distutils.debug import DEBUG
......@@ -486,9 +485,10 @@ class _Bootstrapper(object):
# setup.py exists we can generate it
setup_py = os.path.join(path, 'setup.py')
if os.path.isfile(setup_py):
with _silence():
run_setup(os.path.join(path, 'setup.py'),
['egg_info'])
# We use subprocess instead of run_setup from setuptools to
# avoid segmentation faults - see the following for more details:
# https://github.com/cython/cython/issues/2104
sp.check_output([sys.executable, 'setup.py', 'egg_info'], cwd=path)
for dist in pkg_resources.find_distributions(path, True):
# There should be only one...
......
......@@ -127,7 +127,10 @@ class AstropyBuildDocs(SphinxBuildDoc):
build_cmd_path = os.path.abspath(build_cmd.build_lib)
ah_importer = pkgutil.get_importer('astropy_helpers')
ah_path = os.path.abspath(ah_importer.path)
if ah_importer is None:
ah_path = '.'
else:
ah_path = os.path.abspath(ah_importer.path)
# Now generate the source for and spawn a new process that runs the
# command. This is needed to get the correct imports for the built
......
# This file contains settings for pytest that are specific to astropy-helpers.
# Since we run many of the tests in sub-processes, we need to collect coverage
# data inside each subprocess and then combine it into a single .coverage file.
# To do this we set up a list which run_setup appends coverage objects to.
# This is not intended to be used by packages other than astropy-helpers.
import os
from collections import defaultdict
try:
from coverage import CoverageData
except ImportError:
HAS_COVERAGE = False
else:
HAS_COVERAGE = True
if HAS_COVERAGE:
SUBPROCESS_COVERAGE = []
def pytest_configure(config):
if HAS_COVERAGE:
SUBPROCESS_COVERAGE[:] = []
def pytest_unconfigure(config):
if HAS_COVERAGE:
# We create an empty coverage data object
combined_cdata = CoverageData()
lines = defaultdict(list)
for cdata in SUBPROCESS_COVERAGE:
# For each CoverageData object, we go through all the files and
# change the filename from one which might be a temporary path
# to the local filename. We then only keep files that actually
# exist.
for filename in cdata.measured_files():
try:
pos = filename.rindex('astropy_helpers')
except ValueError:
continue
short_filename = filename[pos:]
if os.path.exists(short_filename):
lines[os.path.abspath(short_filename)].extend(cdata.lines(filename))
combined_cdata.add_lines(lines)
combined_cdata.write_file('.coverage.subprocess')
......@@ -141,7 +141,7 @@ def add_exclude_packages(excludes):
"add_package_excludes must be called before all other setup helper "
"functions in order to properly handle excluded packages")
_module_state['exclude_packages'].add(set(excludes))
_module_state['exclude_packages'].update(set(excludes))
def register_commands(package, version, release, srcdir='.'):
......
......@@ -2,11 +2,15 @@ import os
import subprocess as sp
import sys
from setuptools import sandbox
import pytest
from ..utils import extends_doc
try:
from coverage import CoverageData
except ImportError:
HAS_COVERAGE = False
else:
HAS_COVERAGE = True
from ..conftest import SUBPROCESS_COVERAGE
PACKAGE_DIR = os.path.dirname(__file__)
......@@ -39,19 +43,41 @@ def run_cmd(cmd, args, path=None, raise_error=True):
return streams + (return_code,)
@extends_doc(sandbox.run_setup)
def run_setup(*args, **kwargs):
"""
In Python 3, on MacOS X, the import cache has to be invalidated otherwise
new extensions built with ``run_setup`` do not always get picked up.
"""
def run_setup(setup_script, args):
# This used to call setuptools.sandbox's run_setup, but due to issues with
# this and Cython (which caused segmentation faults), we now use subprocess.
setup_script = os.path.abspath(setup_script)
path = os.path.dirname(setup_script)
setup_script = os.path.basename(setup_script)
if HAS_COVERAGE:
# In this case, we run the command using the coverage command and we
# then collect the coverage data into a SUBPROCESS_COVERAGE list which
# is set up at the start of the testing process and is then combined
# into a single .coverage file at the end of the testing process.
p = sp.Popen(['coverage', 'run', setup_script] + list(args), cwd=path,
stdout=sp.PIPE, stderr=sp.PIPE)
stdout, stderr = p.communicate()
try:
return sandbox.run_setup(*args, **kwargs)
finally:
if sys.version_info[:2] >= (3, 3):
import importlib
importlib.invalidate_caches()
cdata = CoverageData()
cdata.read_file(os.path.join(path, '.coverage'))
SUBPROCESS_COVERAGE.append(cdata)
else:
# Otherwise we just run the tests with Python
p = sp.Popen([sys.executable, setup_script] + list(args), cwd=path,
stdout=sp.PIPE, stderr=sp.PIPE)
stdout, stderr = p.communicate()
sys.stdout.write(stdout.decode('utf-8'))
sys.stderr.write(stderr.decode('utf-8'))
@pytest.fixture(scope='function', autouse=True)
......@@ -85,23 +111,6 @@ def reset_distutils_log():
log.set_threshold(log.WARN)
@pytest.fixture(scope='module', autouse=True)
def fix_hide_setuptools():
"""
Workaround for https://github.com/astropy/astropy-helpers/issues/124
In setuptools 10.0 run_setup was changed in such a way that it sweeps
away the existing setuptools import before running the setup script. In
principle this is nice, but in the practice of testing astropy_helpers
this is problematic since we're trying to test code that has already been
imported during the testing process, and which relies on the setuptools
module that was already in use.
"""
if hasattr(sandbox, 'hide_setuptools'):
sandbox.hide_setuptools = lambda: None
TEST_PACKAGE_SETUP_PY = """\
#!/usr/bin/env python
......
......@@ -7,6 +7,7 @@ omit =
astropy_helpers/extern/*
astropy_helpers/extern/*/*
astropy_helpers/tests/*
astropy_helpers/conftest.py
*/test_pkg/*
[report]
......
......@@ -9,7 +9,7 @@ import tarfile
import pytest
from warnings import catch_warnings
from . import reset_setup_helpers, reset_distutils_log, fix_hide_setuptools # noqa
from . import reset_setup_helpers, reset_distutils_log # noqa
from . import run_cmd, run_setup, cleanup_import
from astropy_helpers.git_helpers import get_git_devstr
......@@ -24,16 +24,20 @@ else:
_DEV_VERSION_RE = re.compile(r'\d+\.\d+(?:\.\d+)?\.dev(\d+)')
ASTROPY_HELPERS_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..'))
TEST_VERSION_SETUP_PY = """\
#!/usr/bin/env python
import sys
from setuptools import setup
NAME = 'apyhtest_eva'
VERSION = {version!r}
RELEASE = 'dev' not in VERSION
sys.path.insert(0, r'{astropy_helpers_path}')
from astropy_helpers.git_helpers import get_git_devstr
from astropy_helpers.version_helpers import generate_version_py
......@@ -60,7 +64,8 @@ def version_test_package(tmpdir, request):
def make_test_package(version='42.42.dev'):
test_package = tmpdir.mkdir('test_package')
test_package.join('setup.py').write(
TEST_VERSION_SETUP_PY.format(version=version))
TEST_VERSION_SETUP_PY.format(version=version,
astropy_helpers_path=ASTROPY_HELPERS_PATH))
test_package.mkdir('apyhtest_eva').join('__init__.py').write(TEST_VERSION_INIT)
with test_package.as_cwd():
run_cmd('git', ['init'])
......
......@@ -4,11 +4,12 @@
import ah_bootstrap
import pkg_resources
from setuptools import setup
from astropy_helpers.setup_helpers import register_commands, get_package_info
from astropy_helpers.setup_helpers import (register_commands, get_package_info,
add_exclude_packages)
from astropy_helpers.version_helpers import generate_version_py
NAME = 'astropy_helpers'
VERSION = '2.0.4'
VERSION = '2.0.6'
RELEASE = 'dev' not in VERSION
generate_version_py(NAME, VERSION, RELEASE, False, uses_git=not RELEASE)
......@@ -16,6 +17,7 @@ generate_version_py(NAME, VERSION, RELEASE, False, uses_git=not RELEASE)
# Use the updated version including the git rev count
from astropy_helpers.version import version as VERSION
add_exclude_packages(['astropy_helpers.tests'])
cmdclass = register_commands(NAME, VERSION, RELEASE)
# This package actually doesn't use the Astropy test command
del cmdclass['test']
......@@ -46,5 +48,5 @@ setup(
],
cmdclass=cmdclass,
zip_safe=False,
**get_package_info(exclude=['astropy_helpers.tests'])
**get_package_info()
)
......@@ -46,7 +46,7 @@ LONG_DESCRIPTION = package.__doc__
builtins._PACKAGE_NAME_ = 'asdf'
# VERSION should be PEP386 compatible (http://www.python.org/dev/peps/pep-0386)
VERSION = '1.3.2'
VERSION = '1.3.3'
# Indicates if this version is a release version
RELEASE = 'dev' not in VERSION
......@@ -130,7 +130,6 @@ setup(name=PACKAGENAME,
long_description=LONG_DESCRIPTION,
cmdclass=cmdclassd,
zip_safe=False,
use_2to3=True,
entry_points=entry_points,
**package_info
)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment