From 1057bcb89ff3ae68e2983878d7905666799b98bb Mon Sep 17 00:00:00 2001 From: Benjamin Alan Weaver Date: Tue, 21 Apr 2020 15:33:16 -0700 Subject: [PATCH 01/26] fix sphinx warning causing error --- docs/pydlspec2d.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/pydlspec2d.rst b/docs/pydlspec2d.rst index 753d6bf2..decc139d 100644 --- a/docs/pydlspec2d.rst +++ b/docs/pydlspec2d.rst @@ -77,7 +77,7 @@ API .. automodapi:: pydl.pydlspec2d .. automodapi:: pydl.pydlspec2d.spec1d - :skip: warn, solve, FontProperties, Pydlspec2dException, Pydlspec2dUserWarning + :skip: warn, solve, Pydlspec2dException, Pydlspec2dUserWarning .. automodapi:: pydl.pydlspec2d.spec2d :skip: warn, erf, get_pkg_data_filename, smooth, iterfit, djs_maskinterp, djs_median, sdss_flagval, traceset2xy, xy2traceset, vactoair From d91f21557767783f58cbefa6b3e688d2f53bb8b7 Mon Sep 17 00:00:00 2001 From: Benjamin Alan Weaver Date: Tue, 21 Apr 2020 15:44:05 -0700 Subject: [PATCH 02/26] try older pytest-mock version --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 0fc863fe..4c9448b0 100644 --- a/tox.ini +++ b/tox.ini @@ -44,7 +44,7 @@ deps = astropy==2.0.16 numpy==1.14.* pytest<3.7 - pytest-mock + pytest-mock<2 commands = pytest --pyargs pydl {toxinidir}/docs {posargs} [testenv:coverage] From b285dffad5b024db41421b98c385e8a299edb1d7 Mon Sep 17 00:00:00 2001 From: Benjamin Alan Weaver Date: Tue, 21 Apr 2020 16:22:52 -0700 Subject: [PATCH 03/26] update .travis.yml to match latest template --- .travis.yml | 233 ++++++++++++++++++---------------------------------- tox.ini | 106 +++++++++++++++--------- 2 files changed, 149 insertions(+), 190 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6f8080fb..5c96bd39 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,16 +1,12 @@ -# We set the language to c because python isn't supported on the MacOS X nodes -# on Travis. However, the language ends up being irrelevant anyway, since we -# install Python ourselves using conda. -language: c +language: python -os: - - linux - -# Disable cloning with --depth=50 (the default). This should grab the tags -# needed for setuptools_scm to work. +# We need a full clone to make sure setuptools_scm works properly git: depth: false +os: + - linux + # The apt packages below are needed for sphinx builds. A full list of packages # that can be included can be found here: # @@ -20,11 +16,8 @@ addons: apt: packages: - graphviz - - tzdata -stage: Comprehensive tests - stages: # Do the style check and a single test job, don't proceed if it fails - name: Initial tests @@ -37,200 +30,138 @@ stages: env: global: + # The following versions are the 'default' for tests, unless # overridden underneath. They are defined here in order to save having # to repeat them for all configurations. - # - PYTHON_VERSION=3.7 - # - NUMPY_VERSION=stable - # - ASTROPY_VERSION=stable - # - MAIN_CMD='python setup.py' - # - SETUP_CMD='test' - # - EVENT_TYPE='pull_request push' - - TOXENV='' - - TOXARGS='' + + # The following three variables are for tox. TOXENV is a standard + # variable that tox uses to determine the environment to run, + # TOXARGS are arguments passed to tox, and TOXPOSARGS are arguments + # that tox passes through to the {posargs} indicator in tox.ini. + # The latter can be used for example to pass arguments to pytest. + - TOXENV='test' + - TOXARGS='-v' - TOXPOSARGS='' - # For this package-template, we include examples of Cython modules, - # so Cython is required for testing. If your package does not include - # Cython code, you can set CONDA_DEPENDENCIES='' - # - CONDA_DEPENDENCIES='tox setuptools_scm scipy matplotlib pytest-mock' - # - CONDA_DEPENDENCIES_DOC='tox setuptools_scm scipy matplotlib sphinx-astropy' - - # List other runtime dependencies for the package that are available as - # pip packages here. - # - PIP_DEPENDENCIES='' - - # Conda packages for affiliated packages are hosted in channel - # "astropy" while builds for astropy LTS with recent numpy versions - # are in astropy-ci-extras. If your package uses either of these, - # add the channels to CONDA_CHANNELS along with any other channels - # you want to use. - - CONDA_CHANNELS='astropy' - - # If there are matplotlib or other GUI tests, uncomment the following - # line to use the X virtual framebuffer. + # The following is needed to avoid issues if e.g. Matplotlib tries + # to open a GUI window. # - SETUP_XVFB=True - # If you want to ignore certain flake8 errors, you can list them - # in FLAKE8_OPT, for example: - # - FLAKE8_OPT='--ignore=E501' - # - FLAKE8_OPT='' - matrix: # Don't wait for allowed failures fast_finish: true include: - - os: linux - language: python - stage: Initial tests - python: 3.8 - env: TOXENV='test' - - # Make sure that egg_info works without dependencies - # - stage: Initial tests - # env: PYTHON_VERSION=3.7 SETUP_CMD='egg_info' # Try MacOS X, usually enough only to run from cron as hardly there are - # issues that are not picked up by a linux worker + # issues that are not picked up by a linux worker. We set language to + # 'c' since 'python' doesn't work on non-Linux platforms. - os: osx + language: c + name: Python 3.7 with required dependencies stage: Cron tests - python: 3.7 - env: TOXENV='test' + env: PYTHON_VERSION=3.7 TOXENV=py37-test - - os: windows - stage: Cron tests - python: 3.7 - env: TOXENV='test' - - # Do a coverage test. + # Do a regular build on Linux with Python 3.8, with cov + # For Linux we use language: python to avoid using conda. - os: linux - language: python + python: 3.8 + name: Python 3.8 with required dependencies and measure coverage stage: Initial tests - python: 3.7 - env: TOXENV='coverage' + env: TOXENV=py38-test-cov - # Check for sphinx doc build warnings - we do this first because it - # may run for a long time + # Check for sphinx doc build warnings - os: linux - language: python - python: 3.7 - env: TOXENV='build_docs' + python: 3.8 + name: Documentation build + stage: Comprehensive tests + env: TOXENV=build_docs - # Now try Astropy dev with the latest Python and LTS with and 3.x. - # - os: linux - # env: ASTROPY_VERSION=development - # EVENT_TYPE='pull_request push cron' + # Now try Astropy dev with the latest Python - os: linux - language: python - python: 3.7 - env: TOXENV='test-dev' - EVENT_TYPE='pull_request push cron' + python: 3.8 + name: Python 3.8 with developer version of astropy + stage: Comprehensive tests + env: TOXENV=py38-test-devdeps + # And with an older Python, Astropy LTS, and the oldest supported Numpy - os: linux - language: python python: 3.6 - env: TOXENV='astropy2' - # - os: linux - # env: PYTHON_VERSION=3.6 ASTROPY_VERSION=2.0.16 NUMPY_VERSION=1.14 PYTEST_VERSION='<3.7' + name: Python 3.6 astropy LTS and Numpy 1.16 + stage: Comprehensive tests + env: TOXENV=py36-test-astropylts-numpy116 # Add a job that runs from cron only and tests against astropy dev and # numpy dev to give a change for early discovery of issues and feedback # for both developer teams. - # - os: linux - # stage: Cron tests - # env: ASTROPY_VERSION=development NUMPY_VERSION=development - # EVENT_TYPE='cron' - - os: linux - language: python + python: 3.8 + name: Python 3.8 latest developer version of key dependencies stage: Cron tests - python: 3.7 - env: TOXENV='test-all-dev' - EVENT_TYPE='cron' + env: TOXENV=py38-test-devdeps - # Try all python versions and Numpy versions. Since we can assume that + # Try on Windows. + - os: windows + language: c + name: Python 3.8 with required dependencies + stage: Comprehensive tests + env: PYTHON_VERSION=3.8 TOXENV=py38-test + + # Try other python versions and Numpy versions. Since we can assume that # the Numpy developers have taken care of testing Numpy with different # versions of Python, we can vary Python and Numpy versions at the same # time. - # - os: linux - # env: PYTHON_VERSION=3.6 NUMPY_VERSION=1.16 - # - os: linux - # env: NUMPY_VERSION=1.16 - - - os: linux - language: python - python: 3.5 - env: TOXENV='test-numpy116' - - os: linux - language: python - python: 3.6 - env: TOXENV='test-numpy116' - - - os: linux - language: python python: 3.7 - env: TOXENV='test-numpy117' + name: Python 3.7 with astropy 3.0 and Numpy 1.17 + stage: Comprehensive tests + env: TOXENV=py37-test-astropy30-numpy117 + # Do a code style check - os: linux - language: python - python: 3.7 - env: TOXENV='test-numpy118' + python: 3.8 + name: Code style checks + stage: Initial tests + env: TOXENV=codestyle - # Do a PEP8 test with flake8 - os: linux - language: python - stage: Initial tests - python: 3.7 - env: TOXENV='codestyle' + python: 3.6 + name: Legacy Astropy 2 test + stage: Comprehensive tests + env: TOXENV='astropy2' allow_failures: # Do a PEP8 test with flake8 # (do allow to fail unless your code completely compliant) - - os: linux - language: python - stage: Initial tests - python: 3.7 - env: TOXENV='codestyle' + # - os: linux + # python: 3.8 + # name: Code style checks + # stage: Initial tests + # env: TOXENV=codestyle install: - # We now use the ci-helpers package to set up our testing environment. - # This is done by using Miniconda and then using conda and pip to install - # dependencies. Which dependencies are installed using conda and pip is - # determined by the CONDA_DEPENDENCIES and PIP_DEPENDENCIES variables, - # which should be space-delimited lists of package names. See the README - # in https://github.com/astropy/ci-helpers for information about the full - # list of environment variables that can be used to customize your - # environment. In some cases, ci-helpers may not offer enough flexibility - # in how to install a package, in which case you can have additional - # commands in the install: section below. - - - if [[ ${TRAVIS_OS_NAME} == 'osx' || ${TRAVIS_OS_NAME} == 'windows' ]]; then + # We now use the ci-helpers package to set up our Python environment + # on Windows and MacOS X but we don't set up any other dependencies, + # instead using tox to do this. See https://github.com/astropy/ci-helpers + # for more information about ci-helpers. + + - if [[ $TRAVIS_OS_NAME != linux ]]; then git clone --depth 1 git://github.com/astropy/ci-helpers.git; source ci-helpers/travis/setup_conda.sh; fi - - pip install --upgrade pip - - pip install --upgrade tox - - if [[ ${TOXENV} == 'coverage' ]]; then pip install coveralls; fi - - # As described above, using ci-helpers, you should be able to set up an - # environment with dependencies installed using conda and pip, but in some - # cases this may not provide enough flexibility in how to install a - # specific dependency (and it will not be able to install non-Python - # dependencies). Therefore, you can also include commands below (as - # well as at the start of the install section or in the before_install - # section if they are needed before setting up conda) to install any - # other dependencies. - script: - - tox -e ${TOXENV} ${TOXARGS} -- ${TOXPOSARGS} + - pip install tox + - tox $TOXARGS -- $TOXPOSARGS after_success: - # If coveralls.io is set up for this package, uncomment the line below. - # The coveragerc file may be customized as needed for your package. - - if [[ ${TOXENV} == 'coverage' ]]; then coveralls --rcfile='pydl/tests/coveragerc'; fi + # If coveralls.io is set up for this package, uncomment the two lines below. + - pip install coveralls + - coveralls + # If codecov is set up for this package, uncomment the two lines below + # pip install codecov + # codecov diff --git a/tox.ini b/tox.ini index 4c9448b0..a21998e1 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,9 @@ [tox] envlist = - py{35,36,37,38}-test{,-all,-dev,-astropylts,-numpy116,-numpy117,-numpy118} + py{36,37,38}-test{,-alldeps,-devdeps}{,-cov} + py{36,37,38}-test-numpy{116,117,118} + py{36,37,38}-test-astropy{30,40,lts} + py36-test-astropy20 build_docs codestyle requires = @@ -10,55 +13,80 @@ requires = isolated_build = true [testenv] -passenv = - HOME - WINDIR - LC_ALL - LC_CTYPE -extras = - test: test - build_docs: docs - all: all -changedir = - test: .tmp/{envname} - build_docs: docs + +# Pass through the following environment variables which may be needed for the CI +passenv = HOME WINDIR LC_ALL LC_CTYPE CC CI TRAVIS + +# Run the tests in a temporary directory to make sure that we don't import +# this package from the source tree +changedir = .tmp/{envname} + +# tox environments are constructed with so-called 'factors' (or terms) +# separated by hyphens, e.g. test-devdeps-cov. Lines below starting with factor: +# will only take effect if that factor is included in the environment name. To +# see a list of example environments that can be run, along with a description, +# run: +# +# tox -l -v +# description = - test: Run tests with pytest. - build_docs: Invoke sphinx-build to build the HTML docs. - all: Run tests with all optional dependencies. - dev: Run tests with numpy and astropy dev versions. -commands = - test: pytest --pyargs pydl {toxinidir}/docs {posargs} - build_docs: sphinx-build . ./_build/html -W --keep-going -b html {posargs} + run tests + alldeps: with all optional dependencies + devdeps: with the latest developer version of key dependencies + oldestdeps: with the oldest supported version of key dependencies + cov: and test coverage + numpy116: with numpy 1.16.* + numpy117: with numpy 1.17.* + numpy118: with numpy 1.18.* + astropy20: with astropy 2.0.* + astropy30: with astropy 3.0.* + astropy40: with astropy 4.0.* + astropylts: with the latest astropy LTS + +# The following provides some specific pinnings for key packages deps = - astropylts: astropy==4.0 + numpy116: numpy==1.16.* numpy117: numpy==1.17.* numpy118: numpy==1.18.* - dev: git+https://github.com/numpy/numpy.git#egg=numpy - dev: git+https://github.com/astropy/astropy.git#egg=astropy -[testenv:astropy2] -description = Run tests on Astropy 2.0.x. -deps = - astropy==2.0.16 - numpy==1.14.* - pytest<3.7 - pytest-mock<2 -commands = pytest --pyargs pydl {toxinidir}/docs {posargs} + astropy20: astropy==2.0.* numpy==1.14.* pytest<3.7 pytest-mock<2 + astropy30: astropy==3.0.* + astropy40: astropy==4.0.* + astropylts: astropy==4.0.* + + devdeps: git+https://github.com/numpy/numpy.git#egg=numpy + devdeps: git+https://github.com/astropy/astropy.git#egg=astropy -[testenv:coverage] -description = Run coverage test with all optional dependencies. +# The following indicates which extras_require from setup.cfg will be installed extras = test - all -; requires = -; coveralls + alldeps: all + +commands = + pip freeze + !cov: pytest --pyargs pydl {toxinidir}/docs {posargs} + cov: pytest --pyargs pydl {toxinidir}/docs --cov pydl --cov-config={toxinidir}/setup.cfg {posargs} + +[testenv:build_docs] +changedir = docs +description = invoke sphinx-build to build the HTML docs +extras = docs +commands = + pip freeze + sphinx-build -W --keep-going -b html . _build/html + +[testenv:linkcheck] +changedir = docs +description = check the links in the HTML docs +extras = docs commands = - pytest --pyargs pydl {toxinidir}/docs --cov pydl --cov-config={toxinidir}/pydl/tests/coveragerc {posargs} + pip freeze + sphinx-build -W --keep-going -b linkcheck . _build/html [testenv:codestyle] skip_install = true -description = Check package code style. +changedir = . +description = check code style, e.g. with flake8 deps = flake8 -commands = flake8 pydl --count --show-source --statistics {posargs} +commands = flake8 pydl --count --max-line-length=100 From 79fcb02126027b62f072c9f725aa18e18e60b3e1 Mon Sep 17 00:00:00 2001 From: Benjamin Alan Weaver Date: Tue, 21 Apr 2020 16:54:31 -0700 Subject: [PATCH 04/26] careful path manipulation --- .travis.yml | 2 +- pydl/photoop/tests/test_window.py | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5c96bd39..cc1dc448 100644 --- a/.travis.yml +++ b/.travis.yml @@ -131,7 +131,7 @@ matrix: python: 3.6 name: Legacy Astropy 2 test stage: Comprehensive tests - env: TOXENV='astropy2' + env: TOXENV=py36-test-astropy20 allow_failures: # Do a PEP8 test with flake8 diff --git a/pydl/photoop/tests/test_window.py b/pydl/photoop/tests/test_window.py index d3b94bcb..6e2abcce 100644 --- a/pydl/photoop/tests/test_window.py +++ b/pydl/photoop/tests/test_window.py @@ -65,15 +65,16 @@ def test_window_read_no_photo_resolve(monkeypatch): def test_window_read_all(monkeypatch, mocker, table_read): - monkeypatch.setenv('PHOTO_RESOLVE', '/another/fake/directory') + fake_dir = os.path.join('another', 'fake', 'directory') + monkeypatch.setenv('PHOTO_RESOLVE', fake_dir) r = window_read(flist=True, rescore=False, blist=True, bcaps=True, balkans=True, findx=True, bindx=True) assert table_read.call_count == 5 - table_read.assert_any_call('/another/fake/directory/window_flist.fits', hdu=1) - table_read.assert_any_call('/another/fake/directory/window_blist.fits', hdu=1) - table_read.assert_any_call('/another/fake/directory/window_bcaps.fits', hdu=1) - table_read.assert_any_call('/another/fake/directory/window_findx.fits', hdu=1) - table_read.assert_any_call('/another/fake/directory/window_bindx.fits', hdu=1) + table_read.assert_any_call(os.path.join(fake_dir, 'window_flist.fits'), hdu=1) + table_read.assert_any_call(os.path.join(fake_dir, 'window_blist.fits'), hdu=1) + table_read.assert_any_call(os.path.join(fake_dir, 'window_bcaps.fits'), hdu=1) + table_read.assert_any_call(os.path.join(fake_dir, 'window_findx.fits'), hdu=1) + table_read.assert_any_call(os.path.join(fake_dir, 'window_bindx.fits'), hdu=1) for k in ('flist', 'blist', 'bcaps', 'findx', 'bindx', 'balkans'): assert k in r for k in ('x', 'cm', 'use_caps'): From f8fdda77042b3260fdfad72aa84069ab5d58e50e Mon Sep 17 00:00:00 2001 From: Benjamin Alan Weaver Date: Tue, 21 Apr 2020 17:01:33 -0700 Subject: [PATCH 05/26] separate words in dependencies --- tox.ini | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index a21998e1..684d3a27 100644 --- a/tox.ini +++ b/tox.ini @@ -50,7 +50,12 @@ deps = numpy117: numpy==1.17.* numpy118: numpy==1.18.* - astropy20: astropy==2.0.* numpy==1.14.* pytest<3.7 pytest-mock<2 + astropy20: + astropy==2.0.* + numpy==1.14.* + pytest<3.7 + pytest-mock<2 + astropy30: astropy==3.0.* astropy40: astropy==4.0.* astropylts: astropy==4.0.* From a1058a3b0c50201152214f0cae3f1bddb3ffcbfb Mon Sep 17 00:00:00 2001 From: Benjamin Alan Weaver Date: Tue, 21 Apr 2020 17:06:08 -0700 Subject: [PATCH 06/26] more joins --- pydl/photoop/tests/test_window.py | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/pydl/photoop/tests/test_window.py b/pydl/photoop/tests/test_window.py index 6e2abcce..878a9bb5 100644 --- a/pydl/photoop/tests/test_window.py +++ b/pydl/photoop/tests/test_window.py @@ -82,26 +82,28 @@ def test_window_read_all(monkeypatch, mocker, table_read): def test_window_read_balkans_only(monkeypatch, mocker, table_read): - monkeypatch.setenv('PHOTO_RESOLVE', '/another/fake/directory') + fake_dir = os.path.join('another', 'fake', 'directory') + monkeypatch.setenv('PHOTO_RESOLVE', fake_dir) r = window_read(flist=True, rescore=False, balkans=True) assert table_read.call_count == 3 - table_read.assert_any_call('/another/fake/directory/window_flist.fits', hdu=1) - table_read.assert_any_call('/another/fake/directory/window_blist.fits', hdu=1) - table_read.assert_any_call('/another/fake/directory/window_bcaps.fits', hdu=1) + table_read.assert_any_call(os.path.join(fake_dir, 'window_flist.fits'), hdu=1) + table_read.assert_any_call(os.path.join(fake_dir, 'window_blist.fits'), hdu=1) + table_read.assert_any_call(os.path.join(fake_dir, 'window_bcaps.fits'), hdu=1) for k in ('flist', 'balkans'): assert k in r assert isinstance(r['balkans'], FITS_polygon) def test_window_read_rescore(monkeypatch, mocker, table_read): - monkeypatch.setenv('PHOTO_RESOLVE', '/another/fake/directory') + fake_dir = os.path.join('another', 'fake', 'directory') + monkeypatch.setenv('PHOTO_RESOLVE', fake_dir) e = mocker.patch('os.path.exists') e.return_value = False w = mocker.patch('pydl.photoop.window.window_score') r = window_read(flist=True, rescore=True) assert table_read.call_count == 1 - table_read.assert_any_call('/another/fake/directory/window_flist_rescore.fits', hdu=1) - # e.assert_called_once_with('/another/fake/directory/window_flist_rescore.fits') + table_read.assert_any_call(os.path.join(fake_dir, 'window_flist_rescore.fits'), hdu=1) + # e.assert_called_once_with(os.path.join(fake_dir, 'window_flist_rescore.fits')) w.assert_called_once_with(rescore=True) for k in ('flist',): assert k in r @@ -133,24 +135,26 @@ def test_window_score_no_window_flist(monkeypatch): def test_window_score_fits_open(monkeypatch, mocker, fits_open): + fake_dir = os.path.join('another', 'fake', 'directory') monkeypatch.setenv('PHOTO_CALIB', '/fake/directory') - monkeypatch.setenv('PHOTO_RESOLVE', '/another/fake/directory') + monkeypatch.setenv('PHOTO_RESOLVE', fake_dir) s = mocker.patch('pydl.photoop.window.sdss_score') s.return_value = np.zeros((fits_open.data_size,), dtype=np.int16) window_score() - fits_open.assert_called_once_with('/another/fake/directory/window_flist.fits', + fits_open.assert_called_once_with(os.path.join(fake_dir, 'window_flist.fits'), mode='update') s.assert_called_once_with(fits_open.return_value) def test_window_score_fits_open_rescore(monkeypatch, mocker, fits_open): + fake_dir = os.path.join('another', 'fake', 'directory') monkeypatch.setenv('PHOTO_CALIB', '/fake/directory') - monkeypatch.setenv('PHOTO_RESOLVE', '/another/fake/directory') + monkeypatch.setenv('PHOTO_RESOLVE', fake_dir) s = mocker.patch('pydl.photoop.window.sdss_score') s.return_value = np.zeros((fits_open.data_size,), dtype=np.int16) window_score(rescore=True) assert s.call_count == 1 - fits_open.assert_called_once_with('/another/fake/directory/window_flist.fits', + fits_open.assert_called_once_with(os.path.join(fake_dir, 'window_flist.fits'), mode='readonly') - fits_open.return_value.writeto.assert_called_once_with('/another/fake/directory/window_flist_rescore.fits') + fits_open.return_value.writeto.assert_called_once_with(os.path.join(fake_dir, 'window_flist_rescore.fits')) s.assert_called_once_with(fits_open.return_value) From 403ddfb66448c9b3cf5e831de3d0dea079775c29 Mon Sep 17 00:00:00 2001 From: Benjamin Alan Weaver Date: Tue, 21 Apr 2020 17:21:41 -0700 Subject: [PATCH 07/26] fix astropy20 --- tox.ini | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/tox.ini b/tox.ini index 684d3a27..5c5f0873 100644 --- a/tox.ini +++ b/tox.ini @@ -2,8 +2,7 @@ envlist = py{36,37,38}-test{,-alldeps,-devdeps}{,-cov} py{36,37,38}-test-numpy{116,117,118} - py{36,37,38}-test-astropy{30,40,lts} - py36-test-astropy20 + py{36,37,38}-test-astropy{20,30,40,lts} build_docs codestyle requires = @@ -50,11 +49,7 @@ deps = numpy117: numpy==1.17.* numpy118: numpy==1.18.* - astropy20: - astropy==2.0.* - numpy==1.14.* - pytest<3.7 - pytest-mock<2 + astropy20: astropy==2.0.*;numpy==1.14.*;pytest<3.7;pytest-mock<2 astropy30: astropy==3.0.* astropy40: astropy==4.0.* From dfde9352a597e2428e0be40a0a69db7620bbba29 Mon Sep 17 00:00:00 2001 From: Benjamin Alan Weaver Date: Tue, 21 Apr 2020 17:52:49 -0700 Subject: [PATCH 08/26] try readlines --- pydl/pydlutils/mangle.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pydl/pydlutils/mangle.py b/pydl/pydlutils/mangle.py index 81c5836e..d60531d2 100644 --- a/pydl/pydlutils/mangle.py +++ b/pydl/pydlutils/mangle.py @@ -676,9 +676,10 @@ def read_mangle_polygons(filename): any metadata. """ with open(filename, 'r') as ply: - lines = ply.read().split(ply.newlines) + # lines = ply.read().split(ply.newlines) + lines = ply.readlines() try: - npoly = int(lines[0].split()[0]) + npoly = int(lines[0].strip().split()[0]) except ValueError: raise PydlutilsException(("Invalid first line of {0}! " + "Are you sure this is a Mangle " + From f169b3e68e7a57f9ad8625c55619385eced96eb8 Mon Sep 17 00:00:00 2001 From: Benjamin Alan Weaver Date: Tue, 21 Apr 2020 17:59:39 -0700 Subject: [PATCH 09/26] strip all lines --- pydl/pydlutils/mangle.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pydl/pydlutils/mangle.py b/pydl/pydlutils/mangle.py index d60531d2..48a67a28 100644 --- a/pydl/pydlutils/mangle.py +++ b/pydl/pydlutils/mangle.py @@ -678,6 +678,7 @@ def read_mangle_polygons(filename): with open(filename, 'r') as ply: # lines = ply.read().split(ply.newlines) lines = ply.readlines() + lines = [l.strip() for l in lines] try: npoly = int(lines[0].strip().split()[0]) except ValueError: From 7e1ed09effefb740abf90358e7a8fbf177c65adf Mon Sep 17 00:00:00 2001 From: Benjamin Alan Weaver Date: Tue, 21 Apr 2020 18:15:55 -0700 Subject: [PATCH 10/26] remove test extras --- tox.ini | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 5c5f0873..e5a8b156 100644 --- a/tox.ini +++ b/tox.ini @@ -3,6 +3,7 @@ envlist = py{36,37,38}-test{,-alldeps,-devdeps}{,-cov} py{36,37,38}-test-numpy{116,117,118} py{36,37,38}-test-astropy{20,30,40,lts} + py36-astropy20 build_docs codestyle requires = @@ -49,7 +50,10 @@ deps = numpy117: numpy==1.17.* numpy118: numpy==1.18.* - astropy20: astropy==2.0.*;numpy==1.14.*;pytest<3.7;pytest-mock<2 + astropy20: astropy==2.0.* + astropy20: numpy==1.14.* + astropy20: pytest<3.7 + astropy20: pytest-mock<2 astropy30: astropy==3.0.* astropy40: astropy==4.0.* From 85ab21bbfece05e42b22fe9ee6caba2d3d474c36 Mon Sep 17 00:00:00 2001 From: Benjamin Alan Weaver Date: Tue, 21 Apr 2020 19:39:56 -0700 Subject: [PATCH 11/26] let's see where we are --- setup.cfg | 77 ++++++++++++++++++++++++++++++------------------------- setup.py | 34 +++++++++++++++++++++--- tox.ini | 22 ++++++++++------ 3 files changed, 87 insertions(+), 46 deletions(-) diff --git a/setup.cfg b/setup.cfg index 81a5080b..f9835a86 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,18 +1,15 @@ [metadata] name = pydl -# version should be PEP440 compatible (http://www.python.org/dev/peps/pep-0440) -# version = 1.0.0.dev author = Benjamin Alan Weaver author_email = baweaver@lbl.gov -description = Astropy affiliated package -long_description = file: README.rst license = BSD 3-Clause License license_file = LICENSE.rst url = http://github.com/weaverba137/pydl +description = Astropy affiliated package +long_description = file: README.rst +long_description_content_type = text/x-rst edit_on_github = False github_project = weaverba137/pydl -# Note: you will also need to change this in your package's __init__.py -python_requires = ">=3.5" classifiers = Development Status :: 5 - Production/Stable Environment :: Console @@ -24,15 +21,14 @@ classifiers = Topic :: Scientific/Engineering :: Astronomy [options] -# install_requires should be formatted as a semicolon-separated list, e.g.: -# install_requires = astropy; scipy; matplotlib -install_requires = - astropy - scipy zip_safe = False -use_2to3 = False packages = find: include_package_data = True +python_requires = >=3.6 +setup_requires = setuptools_scm +install_requires = + astropy + scipy [options.entry_points] console_scripts = @@ -45,8 +41,8 @@ all = matplotlib test = pytest-astropy - pytest-mock - pytest-cov +astropy2 = + pytest-mock<2 docs = sphinx-astropy @@ -64,26 +60,37 @@ testpaths = "pydl" "docs" astropy_header = true doctest_plus = enabled text_file_format = rst -addopts = --doctest-rst -# addopts = -p no:warnings --doctest-rst +addopts = --doctest-glob=*.rst -[flake8] -select = E101,W191,W291,W292,W293,W391,E111,E112,E113,E901,E902 -exclude = extern,sphinx,*parsetab.py +[coverage:run] +omit = + pydl/_astropy_init* + pydl/conftest.py + pydl/*setup_package* + pydl/tests/* + pydl/*/tests/* + pydl/extern/* + pydl/version* + */pydl/_astropy_init* + */pydl/conftest.py + */pydl/*setup_package* + */pydl/tests/* + */pydl/*/tests/* + */pydl/extern/* + */pydl/version* -[pycodestyle] -# E101 - mix of tabs and spaces -# W191 - use of tabs -# W291 - trailing whitespace -# W292 - no newline at end of file -# W293 - trailing whitespace -# W391 - blank line at end of file -# E111 - 4 spaces per indentation level -# E112 - 4 spaces per indentation level -# E113 - 4 spaces per indentation level -# E901 - SyntaxError or IndentationError -# E902 - IOError -select = E101,W191,W291,W292,W293,W391,E111,E112,E113,E901,E902 -# The default ignore set is E123,E133,E226,E241,E242 -# ignore = E12,E133,E226,E501 -exclude = extern,sphinx,*parsetab.py +[coverage:report] +exclude_lines = + # Have to re-enable the standard pragma + pragma: no cover + # Don't complain about packages we have installed + except ImportError + # Don't complain if tests don't hit assertions + raise AssertionError + raise NotImplementedError + # Don't complain about script hooks + def main\(.*\): + # Ignore branches that don't pertain to this version of Python + pragma: py{ignore_python_version} + # Don't complain about IPython completion helper + def _ipython_key_completions_ diff --git a/setup.py b/setup.py index 82b1d7ad..366b5dfa 100755 --- a/setup.py +++ b/setup.py @@ -1,12 +1,22 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst +# NOTE: The configuration for the package, including the name, version, and +# other information are set in the setup.cfg file. + import os import sys + from setuptools import setup + +# from extension_helpers import get_extensions + from distutils.command.sdist import sdist as DistutilsSdist + +# First provide helpful messages if contributors try and run legacy commands +# for tests or docs. + TEST_HELP = """ Note: running tests is no longer done using 'python setup.py test'. Instead you will need to run: @@ -20,7 +30,7 @@ If you only want to run part of the test suite, you can also use pytest directly with:: - pip install -e . + pip install -e .[test] pytest For more information, see: @@ -42,6 +52,12 @@ pip install tox +You can also build the documentation with Sphinx directly using:: + + pip install -e .[docs] + cd docs + make html + For more information, see: http://docs.astropy.org/en/latest/install.html#builddocs @@ -51,7 +67,19 @@ print(DOCS_HELP) sys.exit(1) +VERSION_TEMPLATE = """ +# Note that we need to fall back to the hard-coded version if either +# setuptools_scm can't be imported or setuptools_scm can't determine the +# version, so we catch the generic 'Exception'. +try: + from setuptools_scm import get_version + version = get_version(root='..', relative_to=__file__) +except Exception: + version = '{version}' +""".lstrip() + cmdclass = {'sdist': DistutilsSdist} -setup(use_scm_version={"write_to": os.path.join("pydl", "version.py")}, +setup(use_scm_version={"write_to": os.path.join("pydl", "version.py"), + "write_to_template": VERSION_TEMPLATE}, cmdclass=cmdclass) diff --git a/tox.ini b/tox.ini index e5a8b156..cbfb66a6 100644 --- a/tox.ini +++ b/tox.ini @@ -2,8 +2,8 @@ envlist = py{36,37,38}-test{,-alldeps,-devdeps}{,-cov} py{36,37,38}-test-numpy{116,117,118} - py{36,37,38}-test-astropy{20,30,40,lts} - py36-astropy20 + py{36,37,38}-test-astropy{30,40,lts} + astropy20 build_docs codestyle requires = @@ -38,7 +38,6 @@ description = numpy116: with numpy 1.16.* numpy117: with numpy 1.17.* numpy118: with numpy 1.18.* - astropy20: with astropy 2.0.* astropy30: with astropy 3.0.* astropy40: with astropy 4.0.* astropylts: with the latest astropy LTS @@ -50,11 +49,6 @@ deps = numpy117: numpy==1.17.* numpy118: numpy==1.18.* - astropy20: astropy==2.0.* - astropy20: numpy==1.14.* - astropy20: pytest<3.7 - astropy20: pytest-mock<2 - astropy30: astropy==3.0.* astropy40: astropy==4.0.* astropylts: astropy==4.0.* @@ -72,6 +66,18 @@ commands = !cov: pytest --pyargs pydl {toxinidir}/docs {posargs} cov: pytest --pyargs pydl {toxinidir}/docs --cov pydl --cov-config={toxinidir}/setup.cfg {posargs} +[testenv:astropy20] +description = run tests with astropy2.0.* +extras = astropy2 +deps = + astropy==2.0.* + numpy==1.14.* + pytest<3.7 + pytest-mock<2 +commands = + pip freeze + pytest --pyargs pydl {toxinidir}/docs {posargs} + [testenv:build_docs] changedir = docs description = invoke sphinx-build to build the HTML docs From 5feeda37046b3d0e691ec7b17d5c48c420da302b Mon Sep 17 00:00:00 2001 From: Benjamin Alan Weaver Date: Wed, 22 Apr 2020 16:15:44 -0700 Subject: [PATCH 12/26] basic tests working again --- setup.cfg | 6 ++++-- tox.ini | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/setup.cfg b/setup.cfg index f9835a86..691c66c1 100644 --- a/setup.cfg +++ b/setup.cfg @@ -41,8 +41,7 @@ all = matplotlib test = pytest-astropy -astropy2 = - pytest-mock<2 + pytest-mock docs = sphinx-astropy @@ -94,3 +93,6 @@ exclude_lines = pragma: py{ignore_python_version} # Don't complain about IPython completion helper def _ipython_key_completions_ + +[flake8] +select = E101,W191,W291,W292,W293,W391,E111,E112,E113,E901,E902 diff --git a/tox.ini b/tox.ini index cbfb66a6..6e9aaf77 100644 --- a/tox.ini +++ b/tox.ini @@ -68,7 +68,7 @@ commands = [testenv:astropy20] description = run tests with astropy2.0.* -extras = astropy2 +extras = !test deps = astropy==2.0.* numpy==1.14.* From e0ca1b20c1b605497d1105cfd35d906e2aca0949 Mon Sep 17 00:00:00 2001 From: Benjamin Alan Weaver Date: Wed, 22 Apr 2020 16:31:27 -0700 Subject: [PATCH 13/26] restore astropy2 extras --- setup.cfg | 5 ++++- tox.ini | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/setup.cfg b/setup.cfg index 691c66c1..12e93377 100644 --- a/setup.cfg +++ b/setup.cfg @@ -42,6 +42,8 @@ all = test = pytest-astropy pytest-mock +astropy20 = + pytest-mock<2 docs = sphinx-astropy @@ -59,7 +61,8 @@ testpaths = "pydl" "docs" astropy_header = true doctest_plus = enabled text_file_format = rst -addopts = --doctest-glob=*.rst +# addopts = --doctest-glob=*.rst +addopts = --doctest-rst [coverage:run] omit = diff --git a/tox.ini b/tox.ini index 6e9aaf77..1007ab08 100644 --- a/tox.ini +++ b/tox.ini @@ -68,7 +68,7 @@ commands = [testenv:astropy20] description = run tests with astropy2.0.* -extras = !test +extras = astropy20 deps = astropy==2.0.* numpy==1.14.* From 810298f726b4b0fd48799e99b4354aa81c8c4d46 Mon Sep 17 00:00:00 2001 From: Benjamin Alan Weaver Date: Wed, 22 Apr 2020 16:41:28 -0700 Subject: [PATCH 14/26] tox env in travis --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index cc1dc448..636f77ef 100644 --- a/.travis.yml +++ b/.travis.yml @@ -131,7 +131,7 @@ matrix: python: 3.6 name: Legacy Astropy 2 test stage: Comprehensive tests - env: TOXENV=py36-test-astropy20 + env: TOXENV=astropy20 allow_failures: # Do a PEP8 test with flake8 From ea0e8e953edd8a3a784c2098938bf437e6894e34 Mon Sep 17 00:00:00 2001 From: Benjamin Alan Weaver Date: Fri, 24 Apr 2020 10:26:51 -0700 Subject: [PATCH 15/26] update other top-level files, docs --- .gitignore | 6 ++---- MANIFEST.in | 6 ++---- docs/conf.py | 21 +++++++++++---------- 3 files changed, 15 insertions(+), 18 deletions(-) diff --git a/.gitignore b/.gitignore index 2f628df9..c5a94961 100644 --- a/.gitignore +++ b/.gitignore @@ -12,18 +12,16 @@ __pycache__ # Other generated files */version.py */cython_version.py -pydl/pydl.cfg htmlcov .coverage -.coverage.subprocess MANIFEST .ipynb_checkpoints .pytest_cache +pydl/pydl.cfg # Sphinx docs/api docs/_build -docs/docs # Eclipse editor project files .project @@ -51,7 +49,6 @@ sdist develop-eggs .installed.cfg distribute-*.tar.gz -pip-wheel-metadata # Other .cache @@ -62,6 +59,7 @@ pip-wheel-metadata .project .pydevproject .settings +pip-wheel-metadata/ # Mac OSX .DS_Store diff --git a/MANIFEST.in b/MANIFEST.in index 39699d04..01b2afd4 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,10 +1,8 @@ include README.rst -include LICENSE.rst # include CHANGES.rst - -include pyproject.toml include setup.cfg -include pydl/tests/coveragerc +include LICENSE.rst +include pyproject.toml # recursive-include pydl *.pyx *.c *.pxd recursive-include docs * diff --git a/docs/conf.py b/docs/conf.py index 6d0a6188..2c2d69ef 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -28,7 +28,7 @@ import os import sys import datetime -from pkg_resources import get_distribution +from importlib import import_module try: from sphinx_astropy.conf.v1 import * # noqa @@ -76,9 +76,13 @@ # |version| and |release|, also used in various other places throughout the # built documents. -release = get_distribution(setup_cfg['name']).version -# for example take major/minor -version = '.'.join(release.split('.')[:2]) +import_module(setup_cfg['name']) +package = sys.modules[setup_cfg['name']] + +# The short X.Y version. +version = package.__version__.split('-', 1)[0] +# The full version, including alpha/beta/rc tags. +release = package.__version__ # -- Options for HTML output -------------------------------------------------- @@ -150,15 +154,12 @@ # -- Options for the edit_on_github extension --------------------------------- -if eval(setup_cfg.get('edit_on_github')): +if setup_cfg.get('edit_on_github').lower() == 'true': + extensions += ['sphinx_astropy.ext.edit_on_github'] - versionmod = __import__(setup_cfg['package_name'] + '.version') edit_on_github_project = setup_cfg['github_project'] - if versionmod.version.release: - edit_on_github_branch = "v" + versionmod.version.version - else: - edit_on_github_branch = "master" + edit_on_github_branch = "master" edit_on_github_source_root = "" edit_on_github_doc_root = "docs" From ecb3c56b4e57beef1d9a4c44a2591f4567b86d72 Mon Sep 17 00:00:00 2001 From: Benjamin Alan Weaver Date: Fri, 24 Apr 2020 10:29:04 -0700 Subject: [PATCH 16/26] update make.bat --- docs/make.bat | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/make.bat b/docs/make.bat index 93dfe92b..aa930134 100644 --- a/docs/make.bat +++ b/docs/make.bat @@ -37,6 +37,8 @@ if "%1" == "help" ( if "%1" == "clean" ( for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i del /q /s %BUILDDIR%\* + del /q /s api + del /q /s generated goto end ) From c91c8245149a511d91930cda4cbf37f35801d5c4 Mon Sep 17 00:00:00 2001 From: Benjamin Alan Weaver Date: Fri, 24 Apr 2020 10:32:16 -0700 Subject: [PATCH 17/26] remove docs/_templates --- docs/_templates/autosummary/base.rst | 2 -- docs/_templates/autosummary/class.rst | 2 -- docs/_templates/autosummary/module.rst | 2 -- 3 files changed, 6 deletions(-) delete mode 100644 docs/_templates/autosummary/base.rst delete mode 100644 docs/_templates/autosummary/class.rst delete mode 100644 docs/_templates/autosummary/module.rst diff --git a/docs/_templates/autosummary/base.rst b/docs/_templates/autosummary/base.rst deleted file mode 100644 index 9cabaf52..00000000 --- a/docs/_templates/autosummary/base.rst +++ /dev/null @@ -1,2 +0,0 @@ -{% extends "autosummary_core/base.rst" %} -{# The template this is inherited from is in astropy/sphinx/ext/templates/autosummary_core. If you want to modify this template, it is strongly recommended that you still inherit from the astropy template. #} \ No newline at end of file diff --git a/docs/_templates/autosummary/class.rst b/docs/_templates/autosummary/class.rst deleted file mode 100644 index 6b214a5c..00000000 --- a/docs/_templates/autosummary/class.rst +++ /dev/null @@ -1,2 +0,0 @@ -{% extends "autosummary_core/class.rst" %} -{# The template this is inherited from is in astropy/sphinx/ext/templates/autosummary_core. If you want to modify this template, it is strongly recommended that you still inherit from the astropy template. #} \ No newline at end of file diff --git a/docs/_templates/autosummary/module.rst b/docs/_templates/autosummary/module.rst deleted file mode 100644 index f38315b2..00000000 --- a/docs/_templates/autosummary/module.rst +++ /dev/null @@ -1,2 +0,0 @@ -{% extends "autosummary_core/module.rst" %} -{# The template this is inherited from is in astropy/sphinx/ext/templates/autosummary_core. If you want to modify this template, it is strongly recommended that you still inherit from the astropy template. #} \ No newline at end of file From dd5fbce75ef2f163bedf49e5281dcc2f4210ffc3 Mon Sep 17 00:00:00 2001 From: Benjamin Alan Weaver Date: Fri, 24 Apr 2020 10:45:15 -0700 Subject: [PATCH 18/26] update package-internal files --- pydl/_astropy_init.py | 102 ++++-------------------------------------- pydl/conftest.py | 96 +++++++++++++++++++-------------------- 2 files changed, 53 insertions(+), 145 deletions(-) diff --git a/pydl/_astropy_init.py b/pydl/_astropy_init.py index cdeaafe3..2dffe8fd 100644 --- a/pydl/_astropy_init.py +++ b/pydl/_astropy_init.py @@ -1,16 +1,12 @@ # Licensed under a 3-clause BSD style license - see LICENSE.rst -__all__ = ['__version__', 'test'] +__all__ = ['__version__'] # this indicates whether or not we are in the package's setup.py try: _ASTROPY_SETUP_ except NameError: - from sys import version_info - if version_info[0] >= 3: - import builtins - else: - import __builtin__ as builtins + import builtins builtins._ASTROPY_SETUP_ = False try: @@ -18,94 +14,6 @@ except ImportError: __version__ = '' -# set up the test command -def _get_test_runner(): - import os - from astropy.tests.helper import TestRunner - return TestRunner(os.path.dirname(__file__)) - - -def test(package=None, test_path=None, args=None, plugins=None, - verbose=False, pastebin=None, remote_data=False, pep8=False, - pdb=False, coverage=False, open_files=False, **kwargs): - """ - Run the tests using `py.test `__. A proper set - of arguments is constructed and passed to `pytest.main`_. - - .. _py.test: http://pytest.org/latest/ - .. _pytest.main: http://pytest.org/latest/builtin.html#pytest.main - - Parameters - ---------- - package : str, optional - The name of a specific package to test, e.g. 'io.fits' or 'utils'. - If nothing is specified all default tests are run. - - test_path : str, optional - Specify location to test by path. May be a single file or - directory. Must be specified absolutely or relative to the - calling directory. - - args : str, optional - Additional arguments to be passed to pytest.main_ in the ``args`` - keyword argument. - - plugins : list, optional - Plugins to be passed to pytest.main_ in the ``plugins`` keyword - argument. - - verbose : bool, optional - Convenience option to turn on verbose output from py.test_. Passing - True is the same as specifying ``'-v'`` in ``args``. - - pastebin : {'failed','all',None}, optional - Convenience option for turning on py.test_ pastebin output. Set to - ``'failed'`` to upload info for failed tests, or ``'all'`` to upload - info for all tests. - - remote_data : bool, optional - Controls whether to run tests marked with @remote_data. These - tests use online data and are not run by default. Set to True to - run these tests. - - pep8 : bool, optional - Turn on PEP8 checking via the `pytest-pep8 plugin - `_ and disable normal - tests. Same as specifying ``'--pep8 -k pep8'`` in ``args``. - - pdb : bool, optional - Turn on PDB post-mortem analysis for failing tests. Same as - specifying ``'--pdb'`` in ``args``. - - coverage : bool, optional - Generate a test coverage report. The result will be placed in - the directory htmlcov. - - open_files : bool, optional - Fail when any tests leave files open. Off by default, because - this adds extra run time to the test suite. Requires the - `psutil `_ package. - - parallel : int, optional - When provided, run the tests in parallel on the specified - number of CPUs. If parallel is negative, it will use the all - the cores on the machine. Requires the - `pytest-xdist `_ plugin - installed. Only available when using Astropy 0.3 or later. - - kwargs - Any additional keywords passed into this function will be passed - on to the astropy test runner. This allows use of test-related - functionality implemented in later versions of astropy without - explicitly updating the package template. - - """ - test_runner = _get_test_runner() - return test_runner.run_tests( - package=package, test_path=test_path, args=args, - plugins=plugins, verbose=verbose, pastebin=pastebin, - remote_data=remote_data, pep8=pep8, pdb=pdb, - coverage=coverage, open_files=open_files, **kwargs) if not _ASTROPY_SETUP_: # noqa import os @@ -115,6 +23,12 @@ def test(package=None, test_path=None, args=None, plugins=None, ConfigurationDefaultMissingError, ConfigurationDefaultMissingWarning) + # Create the test function for self test + from astropy.tests.runner import TestRunner + test = TestRunner.make_test_runner_in(os.path.dirname(__file__)) + test.__test__ = False + __all__ += ['test'] + # add these here so we only need to cleanup the namespace at the end config_dir = None diff --git a/pydl/conftest.py b/pydl/conftest.py index c755ff55..73e254bf 100644 --- a/pydl/conftest.py +++ b/pydl/conftest.py @@ -1,58 +1,52 @@ -# Licensed under a 3-clause BSD style license - see LICENSE.rst -# -*- coding: utf-8 -*- -# # This file is used to configure the behavior of pytest when using the Astropy -# test infrastructure. -# +# test infrastructure. It needs to live inside the package in order for it to +# get picked up when running the tests inside an interpreter using +# packagename.test + import os from astropy.version import version as astropy_version + +# For Astropy 3.0 and later, we can use the standalone pytest plugin if astropy_version < '3.0': - # - # With older versions of Astropy, we actually need to import the pytest - # plugins themselves in order to make them discoverable by pytest. - # - from astropy.tests.pytest_plugins import * - # del pytest_report_header + from astropy.tests.pytest_plugins import * # noqa + del pytest_report_header + ASTROPY_HEADER = True else: - # As of Astropy 4.0, the pytest plugins provided by Astropy are - # now in the pytest-astropy-header package. This is backward-compatible - # with Astropy 3. - from pytest_astropy_header.display import PYTEST_HEADER_MODULES, TESTED_VERSIONS - -from astropy.tests.helper import enable_deprecations_as_exceptions - -## Uncomment the following line to treat all DeprecationWarnings as -## exceptions. For Astropy v2.0 or later, there are 2 additional keywords, -## as follow (although default should work for most cases). -## To ignore some packages that produce deprecation warnings on import -## (in addition to 'compiler', 'scipy', 'pygments', 'ipykernel', and -## 'setuptools'), add: -## modules_to_ignore_on_import=['module_1', 'module_2'] -## To ignore some specific deprecation warning messages for Python version -## MAJOR.MINOR or later, add: -## warnings_to_ignore_by_pyver={(MAJOR, MINOR): ['Message to ignore']} -# enable_deprecations_as_exceptions() + try: + from pytest_astropy_header.display import PYTEST_HEADER_MODULES, TESTED_VERSIONS + ASTROPY_HEADER = True + except ImportError: + ASTROPY_HEADER = False + + +def pytest_configure(config): -# def pytest_configure(config): - -# config.option.astropy_header = True -# -# Customize the following lines to add/remove entries from -# the list of packages for which version numbers are displayed when running -# the tests. -# -PYTEST_HEADER_MODULES['Astropy'] = 'astropy' -PYTEST_HEADER_MODULES['PyDL'] = 'pydl' -PYTEST_HEADER_MODULES.pop('Pandas', None) -PYTEST_HEADER_MODULES.pop('h5py', None) - -from .version import version #, astropy_helpers_version -packagename = os.path.basename(os.path.dirname(__file__)) -# -# Display the version number of the package rather than the version number -# of Astropy in the top line when running the tests. -# -TESTED_VERSIONS[packagename] = version -# TESTED_VERSIONS['astropy_helpers'] = astropy_helpers_version -TESTED_VERSIONS.pop('astropy_helpers', None) + if ASTROPY_HEADER: + + config.option.astropy_header = True + + # Customize the following lines to add/remove entries from the list of + # packages for which version numbers are displayed when running the tests. + PYTEST_HEADER_MODULES['Astropy'] = 'astropy' + PYTEST_HEADER_MODULES.pop('Pandas', None) + PYTEST_HEADER_MODULES.pop('h5py', None) + PYTEST_HEADER_MODULES['PyDL'] = 'pydl' + + from . import __version__ + packagename = os.path.basename(os.path.dirname(__file__)) + TESTED_VERSIONS[packagename] = __version__ + TESTED_VERSIONS.pop('astropy_helpers', None) + +# Uncomment the last two lines in this block to treat all DeprecationWarnings as +# exceptions. For Astropy v2.0 or later, there are 2 additional keywords, +# as follow (although default should work for most cases). +# To ignore some packages that produce deprecation warnings on import +# (in addition to 'compiler', 'scipy', 'pygments', 'ipykernel', and +# 'setuptools'), add: +# modules_to_ignore_on_import=['module_1', 'module_2'] +# To ignore some specific deprecation warning messages for Python version +# MAJOR.MINOR or later, add: +# warnings_to_ignore_by_pyver={(MAJOR, MINOR): ['Message to ignore']} +# from astropy.tests.helper import enable_deprecations_as_exceptions # noqa +# enable_deprecations_as_exceptions() From 7bb74f85da96f73407062b30c84de1ce8281e9f3 Mon Sep 17 00:00:00 2001 From: Benjamin Alan Weaver Date: Fri, 24 Apr 2020 12:48:12 -0700 Subject: [PATCH 19/26] add check for coverage run --- .travis.yml | 6 ++++-- pydl/tests/coveragerc | 37 ------------------------------------- 2 files changed, 4 insertions(+), 39 deletions(-) delete mode 100644 pydl/tests/coveragerc diff --git a/.travis.yml b/.travis.yml index 636f77ef..edeaffd2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -160,8 +160,10 @@ script: after_success: # If coveralls.io is set up for this package, uncomment the two lines below. - - pip install coveralls - - coveralls + - if [[ $TOXENV == *-cov ]]; then + pip install coveralls; + coveralls; + fi # If codecov is set up for this package, uncomment the two lines below # pip install codecov # codecov diff --git a/pydl/tests/coveragerc b/pydl/tests/coveragerc deleted file mode 100644 index 4d615c55..00000000 --- a/pydl/tests/coveragerc +++ /dev/null @@ -1,37 +0,0 @@ -[run] -source = pydl -omit = - pydl/_astropy_init* - pydl/conftest* - pydl/tests/* - pydl/*/tests/* - pydl/*/*/tests/* - pydl/version* - -[report] -omit = - pydl/_astropy_init* - pydl/conftest* - pydl/tests/test_* - pydl/*/tests/* - pydl/*/*/tests/* - pydl/version* -exclude_lines= - # Have to re-enable the standard pragma - pragma: no cover - - # Don't complain about packages we have installed - except ImportError - - # Don't complain if tests don't hit assertions - raise AssertionError - raise NotImplementedError - - # Don't complain about script hooks - def main\(.*\): - - # Ignore branches that don't pertain to this version of Python - pragma: py{ignore_python_version} - - # Don't complain about IPython completion helper - def _ipython_key_completions_ From 5dcadd55ff62dfbb48e2842bce1905e7729f1294 Mon Sep 17 00:00:00 2001 From: Benjamin Alan Weaver Date: Fri, 24 Apr 2020 15:35:01 -0700 Subject: [PATCH 20/26] see where we are --- pydl/conftest.py | 3 +-- tox.ini | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/pydl/conftest.py b/pydl/conftest.py index 73e254bf..65c9ae03 100644 --- a/pydl/conftest.py +++ b/pydl/conftest.py @@ -10,7 +10,7 @@ # For Astropy 3.0 and later, we can use the standalone pytest plugin if astropy_version < '3.0': from astropy.tests.pytest_plugins import * # noqa - del pytest_report_header + # del pytest_report_header ASTROPY_HEADER = True else: try: @@ -36,7 +36,6 @@ def pytest_configure(config): from . import __version__ packagename = os.path.basename(os.path.dirname(__file__)) TESTED_VERSIONS[packagename] = __version__ - TESTED_VERSIONS.pop('astropy_helpers', None) # Uncomment the last two lines in this block to treat all DeprecationWarnings as # exceptions. For Astropy v2.0 or later, there are 2 additional keywords, diff --git a/tox.ini b/tox.ini index 1007ab08..c20c5018 100644 --- a/tox.ini +++ b/tox.ini @@ -76,7 +76,7 @@ deps = pytest-mock<2 commands = pip freeze - pytest --pyargs pydl {toxinidir}/docs {posargs} + pytest -p astropy.tests.pytest_repeat -p astropy.extern.plugins.pytest_doctestplus.plugin -p astropy.extern.plugins.pytest_openfiles.plugin -p astropy.extern.plugins.pytest_remotedata.plugin --traceconfig --pyargs pydl {toxinidir}/docs {posargs} [testenv:build_docs] changedir = docs From 9df6aa2a37c9d4412a24f703d883c6f18acc3e64 Mon Sep 17 00:00:00 2001 From: Benjamin Alan Weaver Date: Sat, 25 Apr 2020 12:16:47 -0700 Subject: [PATCH 21/26] fix some broken links --- README.rst | 12 ++++++------ docs/changes.rst | 4 ++-- docs/goddard.rst | 4 ++-- docs/index.rst | 14 +++++++------- docs/photoop.rst | 8 ++++---- docs/pydlutils.rst | 8 ++++---- docs/templates.rst | 8 ++++---- docs/window.rst | 2 +- pydl/__init__.py | 2 +- pydl/goddard/astro.py | 6 +++--- pydl/pydlspec2d/spec1d.py | 4 ++-- pydl/pydlutils/cooling.py | 2 +- pydl/pydlutils/coord.py | 4 ++-- pydl/pydlutils/data/cooling/README.rst | 2 +- pydl/pydlutils/mangle.py | 8 ++++---- pydl/pydlutils/rgbcolor.py | 2 +- pydl/pydlutils/yanny.py | 2 +- 17 files changed, 46 insertions(+), 46 deletions(-) diff --git a/README.rst b/README.rst index 443ff5e7..b9fd17c9 100644 --- a/README.rst +++ b/README.rst @@ -70,11 +70,11 @@ Legal * IDL is a registered trademark of `Harris Geospatial Solutions`_. -.. _Python: http://python.org -.. _`IDL®`: http://www.harrisgeospatial.com/SoftwareTechnology/IDL.aspx -.. _idlutils: https://www.sdss.org/dr14/software/idlutils/ +.. _Python: https://www.python.org +.. _`IDL®`: https://www.harrisgeospatial.com/Software-Technology/IDL +.. _idlutils: https://www.sdss.org/dr16/software/idlutils/ .. _SDSS: https://www.sdss.org -.. _`Goddard utilities`: http://idlastro.gsfc.nasa.gov/ +.. _`Goddard utilities`: https://idlastro.gsfc.nasa.gov/ .. _idlspec2d: https://svn.sdss.org/public/repo/eboss/idlspec2d/trunk/ .. _BOSS: https://www.sdss.org/surveys/boss/ .. _eBOSS: https://www.sdss.org/surveys/eboss/ @@ -83,6 +83,6 @@ Legal .. _PyPI: https://pypi.python.org/pypi/pydl/ .. _`PyDL on Read the Docs`: https://pydl.readthedocs.io/en/latest/ .. _SDSS-III: http://www.sdss3.org -.. _`svn repository`: https://www.sdss.org/dr14/software/products/ +.. _`svn repository`: https://www.sdss.org/dr16/software/products/ .. _GitHub: https://github.com -.. _`Harris Geospatial Solutions`: http://www.harrisgeospatial.com/ +.. _`Harris Geospatial Solutions`: https://www.harrisgeospatial.com/ diff --git a/docs/changes.rst b/docs/changes.rst index 62d5b30f..c0ea3db6 100644 --- a/docs/changes.rst +++ b/docs/changes.rst @@ -28,7 +28,7 @@ planned for early 2019. * Update ``_astropy_init.py`` (PR `#47`_ via PR `#48`_). * Update `astropy_helpers`_/v2.0.8 (PR `#45`_ via PR `#48`_). -.. _`#37`: https://github.com/weaverba137/pydl/issues/37. +.. _`#37`: https://github.com/weaverba137/pydl/issues/37 .. _`#40`: https://github.com/weaverba137/pydl/pull/40 .. _`#41`: https://github.com/weaverba137/pydl/pull/41 .. _`#42`: https://github.com/weaverba137/pydl/pull/42 @@ -47,7 +47,7 @@ planned for early 2019. * Use the new :class:`astropy.coordinates.Attribute` class. * Fix typo (PR `#26`_). -.. _`#31`: https://github.com/weaverba137/pydl/issues/31. +.. _`#31`: https://github.com/weaverba137/pydl/issues/31 .. _`#26`: https://github.com/weaverba137/pydl/pull/26 0.5.4 (2017-05-04) diff --git a/docs/goddard.rst b/docs/goddard.rst index 0dc67444..f44c156b 100644 --- a/docs/goddard.rst +++ b/docs/goddard.rst @@ -56,8 +56,8 @@ structure NA Tools for manipulating IDL data structures. Use :c tv NA Functions for manipulating IDL image displays. ============= =============== =================================================== -.. _`The IDL® Astronomy User's Libary`: http://idlastro.gsfc.nasa.gov/ -.. _idlutils: https://www.sdss.org/dr14/software/idlutils/ +.. _`The IDL® Astronomy User's Libary`: https://idlastro.gsfc.nasa.gov/ +.. _idlutils: https://www.sdss.org/dr16/software/idlutils/ .. _`Coyote library`: http://www.idlcoyote.com/ .. _`Functions from the JHU Applied Physics Lab`: http://fermi.jhuapl.edu/s1r/idl/idl.html .. _`STDAS/GEIS`: http://www.stsci.edu/instruments/wfpc2/Wfpc2_dhb/intro_ch24.html#1905747 diff --git a/docs/index.rst b/docs/index.rst index b7e69a3c..2cbddb48 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -55,19 +55,19 @@ Base API :no-inheritance-diagram: -.. _Python: http://python.org -.. _`IDL®`: http://www.harrisgeospatial.com/SoftwareTechnology/IDL.aspx -.. _idlutils: https://www.sdss.org/dr14/software/idlutils/ +.. _Python: https://www.python.org +.. _`IDL®`: https://www.harrisgeospatial.com/Software-Technology/IDL +.. _idlutils: https://www.sdss.org/dr16/software/idlutils/ .. _SDSS: https://www.sdss.org -.. _`Goddard utilities`: http://idlastro.gsfc.nasa.gov/ +.. _`Goddard utilities`: https://idlastro.gsfc.nasa.gov/ .. _idlspec2d: https://svn.sdss.org/public/repo/eboss/idlspec2d/trunk/ .. _BOSS: https://www.sdss.org/surveys/boss/ .. _eBOSS: https://www.sdss.org/surveys/eboss/ .. _photoop: https://svn.sdss.org/public/repo/sdss/photoop/trunk/ .. .. _astropy: http://www.astropy.org -.. _PyPI: https://pypi.python.org/pypi/pydl/ +.. _PyPI: https://pypi.org/project/pydl/ .. _`PyDL on Read the Docs`: https://pydl.readthedocs.io/en/latest/ .. _SDSS-III: http://www.sdss3.org -.. _`svn repository`: https://www.sdss.org/dr14/software/products/ +.. _`svn repository`: https://www.sdss.org/dr16/software/products/ .. _GitHub: https://github.com -.. _`Harris Geospatial Solutions`: http://www.harrisgeospatial.com/ +.. _`Harris Geospatial Solutions`: https://www.harrisgeospatial.com/ diff --git a/docs/photoop.rst b/docs/photoop.rst index 96b27caa..382d6c99 100644 --- a/docs/photoop.rst +++ b/docs/photoop.rst @@ -73,11 +73,11 @@ window Rudimentary Tools for determining the sky coverage of the survey =========== =============== =================================================== .. _photoop: https://svn.sdss.org/public/repo/sdss/photoop/trunk/ -.. _reduce: https://www.sdss.org/dr14/imaging/pipeline/ -.. _resolve: https://www.sdss.org/dr14/algorithms/resolve/ -.. _flux-calibrate: https://www.sdss.org/dr14/algorithms/fluxcal/ +.. _reduce: https://www.sdss.org/dr16/imaging/pipeline/ +.. _resolve: https://www.sdss.org/dr16/algorithms/resolve/ +.. _flux-calibrate: https://www.sdss.org/dr16/algorithms/fluxcal/ .. _`corrected frame`: https://data.sdss.org/datamodel/files/BOSS_PHOTOOBJ/frames/RERUN/RUN/CAMCOL/frame.html -.. _ubercalibration: https://www.sdss.org/dr14/algorithms/fluxcal/ +.. _ubercalibration: https://www.sdss.org/dr16/algorithms/fluxcal/ API +++ diff --git a/docs/pydlutils.rst b/docs/pydlutils.rst index 17982b02..fe4bb7cd 100644 --- a/docs/pydlutils.rst +++ b/docs/pydlutils.rst @@ -66,13 +66,13 @@ wise None Used for matching WISE catalogs to SDSS data. yanny Good Tools for manipulating `SDSS parameter files`_. =========== =============== =================================================== -.. _idlutils: https://www.sdss.org/dr14/software/idlutils/ +.. _idlutils: https://www.sdss.org/dr16/software/idlutils/ .. _SDSS: https://www.sdss.org -.. _`The IDL® Astronomy User's Libary`: http://idlastro.gsfc.nasa.gov/ +.. _`The IDL® Astronomy User's Libary`: https://idlastro.gsfc.nasa.gov/ .. _healpy: https://healpy.readthedocs.io/en/latest/ -.. _bitmasks: https://www.sdss.org/dr14/algorithms/bitmasks/ +.. _bitmasks: https://www.sdss.org/dr16/algorithms/bitmasks/ .. _`sweep files`: https://data.sdss.org/datamodel/files/PHOTO_SWEEP/RERUN/calibObj.html -.. _`SDSS parameter files`: https://www.sdss.org/dr14/algorithms/software/par/ +.. _`SDSS parameter files`: https://www.sdss.org/dr16/software/par/ API +++ diff --git a/docs/templates.rst b/docs/templates.rst index 3e2089ed..cada19a1 100644 --- a/docs/templates.rst +++ b/docs/templates.rst @@ -48,9 +48,9 @@ results were the same, to some numerical precision. .. _SDSS: https://www.sdss.org .. _BOSS: https://www.sdss.org/surveys/boss/ -.. _`IDL®`: http://www.harrisgeospatial.com/SoftwareTechnology/IDL.aspx -.. [1] `Bolton, Adam, et al. 2012 AJ 144, 144 `_. +.. _`IDL®`: https://www.harrisgeospatial.com/Software-Technology/IDL +.. [1] `Bolton, Adam, et al. 2012 AJ 144, 144 `_. .. [2] `Tsalmantza, P., Decarli, R., Dotti, M., Hogg, D. W., 2011 ApJ 738, 20 - `_ + `_ .. [3] `Tsalmantza, P., Hogg, D. W., 2012 ApJ 753, 122 - `_ + `_ diff --git a/docs/window.rst b/docs/window.rst index 3060fb92..1e6aba04 100644 --- a/docs/window.rst +++ b/docs/window.rst @@ -10,7 +10,7 @@ the "resolve" algorithm, which determines the highest quality ("primary") SDSS image that covers a region of the sky. For further low-level details, see the `SDSS documentation`_ of the resolve algorithm. -.. _`SDSS documentation`: https://www.sdss.org/dr14/algorithms/resolve/ +.. _`SDSS documentation`: https://www.sdss.org/dr16/algorithms/resolve/ In the PyDL package, the :mod:`~pydl.photoop.window` and :mod:`~pydl.pydlutils.mangle` modules are used to access the window function. In this document we will diff --git a/pydl/__init__.py b/pydl/__init__.py index 7da94da8..5ade00b3 100644 --- a/pydl/__init__.py +++ b/pydl/__init__.py @@ -10,7 +10,7 @@ the astronomical library functions. Only the bare minimum of IDL_ built-in functions are implemented to support this. -.. _IDL: http://www.harrisgeospatial.com/SoftwareTechnology/IDL.aspx +.. _IDL: https://www.harrisgeospatial.com/Software-Technology/IDL """ # Packages may add whatever they like to this file, but diff --git a/pydl/goddard/astro.py b/pydl/goddard/astro.py index 2c3567f4..59fb43ab 100644 --- a/pydl/goddard/astro.py +++ b/pydl/goddard/astro.py @@ -27,7 +27,7 @@ def airtovac(air): Notes ----- * Formula from `P. E. Ciddor, Applied Optics, 35, 1566 (1996) - `_. + `_. * Values of wavelength below 2000 Å are not converted. """ try: @@ -88,7 +88,7 @@ def gcirc(ra1, dec1, ra2, dec2, units=2): ----- The formula below is the one best suited to handling small angular separations. See: - http://en.wikipedia.org/wiki/Great-circle_distance + https://en.wikipedia.org/wiki/Great-circle_distance """ if units == 0: rarad1 = ra1 @@ -174,7 +174,7 @@ def vactoair(vacuum): Notes ----- * Formula from `P. E. Ciddor, Applied Optics, 35, 1566 (1996) - `_. + `_. * Values of wavelength below 2000 Å are not converted. """ try: diff --git a/pydl/pydlspec2d/spec1d.py b/pydl/pydlspec2d/spec1d.py index 5d664473..04598e23 100644 --- a/pydl/pydlspec2d/spec1d.py +++ b/pydl/pydlspec2d/spec1d.py @@ -76,9 +76,9 @@ class HMF(object): References ---------- .. [1] `Tsalmantza, P., Decarli, R., Dotti, M., Hogg, D. W., 2011 ApJ 738, 20 - `_ + `_ .. [2] `Tsalmantza, P., Hogg, D. W., 2012 ApJ 753, 122 - `_ + `_ """ def __init__(self, spectra, invvar, K=4, n_iter=None, seed=None, diff --git a/pydl/pydlutils/cooling.py b/pydl/pydlutils/cooling.py index be78e8a7..4631ce8c 100644 --- a/pydl/pydlutils/cooling.py +++ b/pydl/pydlutils/cooling.py @@ -9,7 +9,7 @@ def read_ds_cooling(fname, logT=None): """Read in the `Sutherland & Dopita (1993) - `_ cooling function. + `_ cooling function. Parameters ---------- diff --git a/pydl/pydlutils/coord.py b/pydl/pydlutils/coord.py index 7296b5a9..9807b561 100644 --- a/pydl/pydlutils/coord.py +++ b/pydl/pydlutils/coord.py @@ -34,9 +34,9 @@ class SDSSMuNu(ac.BaseCoordinateFrame): Notes ----- - https://www.sdss.org/dr14/algorithms/surveycoords/ + https://www.sdss.org/dr16/algorithms/surveycoords/ - .. _`Stripe Number`: https://www.sdss.org/dr14/help/glossary/#stripe + .. _`Stripe Number`: https://www.sdss.org/dr16/help/glossary/#stripe """ default_representation = ac.SphericalRepresentation frame_specific_representation_info = { diff --git a/pydl/pydlutils/data/cooling/README.rst b/pydl/pydlutils/data/cooling/README.rst index bd2e9675..3a7380ac 100644 --- a/pydl/pydlutils/data/cooling/README.rst +++ b/pydl/pydlutils/data/cooling/README.rst @@ -8,7 +8,7 @@ Introduction This file has been adapted from http://www.mso.anu.edu.au/~ralph/data/cool/ABOUT.txt. The associated files contain the cooling functions calculated for the paper -by `Sutherland & Dopita (1993) `_. +by `Sutherland & Dopita (1993) `_. See paper or preprint for details. FILE LIST diff --git a/pydl/pydlutils/mangle.py b/pydl/pydlutils/mangle.py index 48a67a28..84d73337 100644 --- a/pydl/pydlutils/mangle.py +++ b/pydl/pydlutils/mangle.py @@ -20,15 +20,15 @@ *any* circle, great or not. Use care when comparing formulas in this module to formulas in the mathematical literature. -.. _Mangle: http://space.mit.edu/~molly/mangle/ -.. _`window function`: https://www.sdss.org/dr14/algorithms/resolve/ +.. _Mangle: https://space.mit.edu/~molly/mangle/ +.. _`window function`: https://www.sdss.org/dr16/algorithms/resolve/ References ---------- .. [1] `Swanson, M. E. C.; Tegmark, Max; Hamilton, Andrew J. S.; Hill, J. Colin, 2008 MNRAS 387, 1391 - `_. + `_. """ import re import warnings @@ -231,7 +231,7 @@ def garea(self): ---------- .. [1] `Hamilton, A. J. S.; Tegmark, Max, 2004 MNRAS 349, 115 - `_. + `_. """ smallest_cap = self.cmminf() if smallest_cap is None: diff --git a/pydl/pydlutils/rgbcolor.py b/pydl/pydlutils/rgbcolor.py index 47fc951e..93ed93d0 100644 --- a/pydl/pydlutils/rgbcolor.py +++ b/pydl/pydlutils/rgbcolor.py @@ -10,7 +10,7 @@ ---------- .. [2] `Lupton, Robert, et al., 2004 PASP 116, 113 - `_. + `_. """ import numpy as np from warnings import warn diff --git a/pydl/pydlutils/yanny.py b/pydl/pydlutils/yanny.py index 4ceaeb22..147b3076 100644 --- a/pydl/pydlutils/yanny.py +++ b/pydl/pydlutils/yanny.py @@ -44,7 +44,7 @@ were only ever intended to be supported for type ``char``. So no multidimensional arrays, sorry. -.. _specifications: https://www.sdss.org/dr14/software/par/ +.. _specifications: https://www.sdss.org/dr16/software/par/ """ import re import os From dd38665a641ad162c2cc5e2ad8300ebc9e11bd41 Mon Sep 17 00:00:00 2001 From: Benjamin Alan Weaver Date: Tue, 28 Apr 2020 10:31:17 -0700 Subject: [PATCH 22/26] allow astropy 2 failures until tox config problem is debugged --- .travis.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.travis.yml b/.travis.yml index edeaffd2..24dc9926 100644 --- a/.travis.yml +++ b/.travis.yml @@ -53,6 +53,15 @@ matrix: # Don't wait for allowed failures fast_finish: true + allow_failures: + # The astropy 2 test is failing due to obscure tox configuration problems, + # not due to actual problems with the code. + - os: linux + python: 3.6 + name: Legacy Astropy 2 test + stage: Comprehensive tests + env: TOXENV=astropy20 + include: # Try MacOS X, usually enough only to run from cron as hardly there are From 2d53c3e4cc64698ff08f7f876b1323e397c0b07e Mon Sep 17 00:00:00 2001 From: Benjamin Alan Weaver Date: Tue, 28 Apr 2020 10:56:30 -0700 Subject: [PATCH 23/26] fix duplicate failure section --- .travis.yml | 23 +++++++---------------- docs/todo.rst | 4 +++- 2 files changed, 10 insertions(+), 17 deletions(-) diff --git a/.travis.yml b/.travis.yml index 24dc9926..3088e66b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -53,15 +53,6 @@ matrix: # Don't wait for allowed failures fast_finish: true - allow_failures: - # The astropy 2 test is failing due to obscure tox configuration problems, - # not due to actual problems with the code. - - os: linux - python: 3.6 - name: Legacy Astropy 2 test - stage: Comprehensive tests - env: TOXENV=astropy20 - include: # Try MacOS X, usually enough only to run from cron as hardly there are @@ -143,13 +134,13 @@ matrix: env: TOXENV=astropy20 allow_failures: - # Do a PEP8 test with flake8 - # (do allow to fail unless your code completely compliant) - # - os: linux - # python: 3.8 - # name: Code style checks - # stage: Initial tests - # env: TOXENV=codestyle + # The astropy 2 test is failing due to obscure tox configuration problems, + # not due to actual problems with the code. + - os: linux + python: 3.6 + name: Legacy Astropy 2 test + stage: Comprehensive tests + env: TOXENV=astropy20 install: diff --git a/docs/todo.rst b/docs/todo.rst index c0dee745..8226f88b 100644 --- a/docs/todo.rst +++ b/docs/todo.rst @@ -3,6 +3,7 @@ TODO ==== * Increase test coverage. +* Finish documentation of :mod:`~pydl.photoop.window`. * :mod:`pydl.pydlutils.mangle` needs more work. - Area (solid angle) calculation. @@ -12,4 +13,5 @@ TODO * Check ``groupdim``, ``groupsize`` in :func:`~pydl.pydlutils.math.djs_reject`. Make sure integer division works. -* Document :class:`~pydl.pydlutils.bspline.bspline`. +* Document :class:`~pydl.pydlutils.bspline.bspline`, and incorporate changes + suggested by the pypit team. From cbdae85f7438e99d3a7693af6125de423c68f3a4 Mon Sep 17 00:00:00 2001 From: Benjamin Alan Weaver Date: Tue, 28 Apr 2020 11:27:18 -0700 Subject: [PATCH 24/26] now we have to debug coveralls --- .travis.yml | 2 +- setup.cfg | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3088e66b..fc03db1d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -162,7 +162,7 @@ after_success: # If coveralls.io is set up for this package, uncomment the two lines below. - if [[ $TOXENV == *-cov ]]; then pip install coveralls; - coveralls; + coveralls debug --rcfile=setup.cfg; fi # If codecov is set up for this package, uncomment the two lines below # pip install codecov diff --git a/setup.cfg b/setup.cfg index 12e93377..d9cb4256 100644 --- a/setup.cfg +++ b/setup.cfg @@ -49,7 +49,7 @@ docs = [options.package_data] # * = *.c -pydl.tests = coveragerc, t/* +pydl.tests = t/* pydl.goddard.tests = t/* pydl.photoop.tests = t/* pydl.pydlspec2d.tests = t/* From d200fb7584533b5f2ae2ec6003f132e517afeb78 Mon Sep 17 00:00:00 2001 From: Benjamin Alan Weaver Date: Tue, 28 Apr 2020 11:43:27 -0700 Subject: [PATCH 25/26] copy .coverage file to Travis checkout --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index fc03db1d..0bd48ba5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -160,7 +160,8 @@ script: after_success: # If coveralls.io is set up for this package, uncomment the two lines below. - - if [[ $TOXENV == *-cov ]]; then + - if [[ ${TOXENV} == *-cov ]]; then + if [[ -f .tmp/${TOXENV}/.coverage ]]; then cp -p .tmp/${TOXENV}/.coverage .; fi; pip install coveralls; coveralls debug --rcfile=setup.cfg; fi From b5141056b3747736f77082931602f0e8e4eedb55 Mon Sep 17 00:00:00 2001 From: Benjamin Alan Weaver Date: Tue, 28 Apr 2020 13:08:42 -0700 Subject: [PATCH 26/26] replace debug with verbose --- .travis.yml | 2 +- pydl/pydlspec2d/spec1d.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0bd48ba5..b34381dc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -163,7 +163,7 @@ after_success: - if [[ ${TOXENV} == *-cov ]]; then if [[ -f .tmp/${TOXENV}/.coverage ]]; then cp -p .tmp/${TOXENV}/.coverage .; fi; pip install coveralls; - coveralls debug --rcfile=setup.cfg; + coveralls --verbose --rcfile=setup.cfg; fi # If codecov is set up for this package, uncomment the two lines below # pip install codecov diff --git a/pydl/pydlspec2d/spec1d.py b/pydl/pydlspec2d/spec1d.py index 04598e23..ec0eb41c 100644 --- a/pydl/pydlspec2d/spec1d.py +++ b/pydl/pydlspec2d/spec1d.py @@ -878,7 +878,7 @@ def readspec(platein, mjd=None, fiber=None, **kwargs): fibervec = np.array(fiber, dtype='i4') else: fibervec = np.zeros(nplate, dtype='i4') + fiber - if 'mjd' is None: + if mjd is None: mjdvec = latest_mjd(platevec, **kwargs) else: try: