From 7552b6c0b555a99580b933f4be11b848b4596c98 Mon Sep 17 00:00:00 2001 From: Benjamin Alan Weaver Date: Wed, 19 Feb 2025 10:39:29 -0700 Subject: [PATCH 1/4] Remove TestRunner import --- LICENSE.rst | 2 +- conftest.py | 2 +- pydl/__init__.py | 12 ------------ setup.cfg | 6 +----- tox.ini | 2 +- 5 files changed, 4 insertions(+), 20 deletions(-) diff --git a/LICENSE.rst b/LICENSE.rst index a984116..c17e7c8 100644 --- a/LICENSE.rst +++ b/LICENSE.rst @@ -1,4 +1,4 @@ -Copyright (c) 2010-2023, Benjamin Alan Weaver +Copyright (c) 2010-2025, Benjamin Alan Weaver All rights reserved. Redistribution and use in source and binary forms, with or without modification, diff --git a/conftest.py b/conftest.py index c6a9d3e..836b030 100644 --- a/conftest.py +++ b/conftest.py @@ -5,7 +5,7 @@ ASTROPY_HEADER = False -# Repeat this from specutils/conftest.py so tox picks it up. +# Repeat this from pydl/conftest.py so tox picks it up. def pytest_configure(config): if ASTROPY_HEADER: diff --git a/pydl/__init__.py b/pydl/__init__.py index 027b666..71fdbf9 100644 --- a/pydl/__init__.py +++ b/pydl/__init__.py @@ -12,9 +12,6 @@ .. _`IDL®`: https://www.nv5geospatialsoftware.com/Products/IDL """ -import os -from astropy.tests.runner import TestRunner - try: from .version import version as __version__ except ImportError: @@ -28,11 +25,6 @@ from .uniq import uniq -# Create the test function for self test -test = TestRunner.make_test_runner_in(os.path.dirname(__file__)) -test.__test__ = False - - class PydlException(Exception): """Base class for exceptions raised in PyDL functions. """ @@ -41,7 +33,3 @@ class PydlException(Exception): __all__ = ['file_lines', 'median', 'pcomp', 'rebin', 'smooth', 'uniq', 'PydlException'] - -# Clean up namespace -del os -del TestRunner diff --git a/setup.cfg b/setup.cfg index dc07ada..f8940b1 100644 --- a/setup.cfg +++ b/setup.cfg @@ -61,21 +61,17 @@ astropy_header = true xfail_strict = true doctest_plus = enabled text_file_format = rst -addopts = --color=yes --doctest-rst +addopts = --color=yes --doctest-rst --astropy-header [coverage:run] relative_files = True 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/* diff --git a/tox.ini b/tox.ini index 657abc8..3183509 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] envlist = - py{38,39,310,311,312}-test{,-devdeps,-oldestdeps,-predeps}{,-cov,-external} + py{38,39,310,311,312,313}-test{,-devdeps,-oldestdeps,-predeps}{,-cov,-external} build_docs linkcheck codestyle From 914d4503a04ecc0f0f345f31e9a2e38307c39cc2 Mon Sep 17 00:00:00 2001 From: Benjamin Alan Weaver Date: Wed, 19 Feb 2025 10:43:47 -0700 Subject: [PATCH 2/4] remove pydl/conftest.py --- pydl/conftest.py | 41 ----------------------------------------- 1 file changed, 41 deletions(-) delete mode 100644 pydl/conftest.py diff --git a/pydl/conftest.py b/pydl/conftest.py deleted file mode 100644 index 7e76ffe..0000000 --- a/pydl/conftest.py +++ /dev/null @@ -1,41 +0,0 @@ -"""Configure Test Suite. - -This file is used to configure the behavior of pytest when using the Astropy -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 -``pydl.test()`` - -""" - -# import os - -# from astropy.version import version as astropy_version - -try: - from pytest_astropy_header.display import PYTEST_HEADER_MODULES, TESTED_VERSIONS - ASTROPY_HEADER = True -except ImportError: - ASTROPY_HEADER = False - - -def pytest_configure(config): - """Configure Pytest with Astropy. - - Parameters - ---------- - config : pytest configuration - - """ - 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__ - TESTED_VERSIONS['pydl'] = __version__ From 4ba6380cc819229ec6a837628d776e58b805b306 Mon Sep 17 00:00:00 2001 From: Benjamin Alan Weaver Date: Wed, 19 Feb 2025 10:53:06 -0700 Subject: [PATCH 3/4] Update change log --- docs/changes.rst | 6 +++++- setup.cfg | 2 -- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/changes.rst b/docs/changes.rst index c31b533..68ffa88 100644 --- a/docs/changes.rst +++ b/docs/changes.rst @@ -5,7 +5,11 @@ PyDL Changelog 1.0.2 (unreleased) ------------------ -* No changes yet. +* Remove deprecated ``astropy.tests.runner.TestRunner`` (PR `#80`_). + See also `astropy/astropy#16177`_. + +.. _`#80`: https://github.com/weaverba137/pydl/pull/80 +.. _`astropy/astropy#16177`: https://github.com/astropy/astropy/issues/16177 1.0.1 (2024-07-23) ------------------ diff --git a/setup.cfg b/setup.cfg index f8940b1..31d6525 100644 --- a/setup.cfg +++ b/setup.cfg @@ -66,12 +66,10 @@ addopts = --color=yes --doctest-rst --astropy-header [coverage:run] relative_files = True omit = - pydl/conftest.py pydl/tests/* pydl/*/tests/* pydl/extern/* pydl/version* - */pydl/conftest.py */pydl/tests/* */pydl/*/tests/* */pydl/extern/* From 5dec650b37424c1145acf778f379a8126d15172d Mon Sep 17 00:00:00 2001 From: Benjamin Alan Weaver Date: Mon, 14 Apr 2025 11:24:05 -0700 Subject: [PATCH 4/4] remove unnecessary global declaration --- pydl/pydlutils/sdss.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pydl/pydlutils/sdss.py b/pydl/pydlutils/sdss.py index 1b1c482..17200df 100644 --- a/pydl/pydlutils/sdss.py +++ b/pydl/pydlutils/sdss.py @@ -576,7 +576,6 @@ def sdss_sweep_circle(ra, dec, radius, stype='star', allobj=False): Assumes that the sweep files exist in :envvar:`PHOTO_SWEEP` and that index files have been created. """ - global sweep_cache # # Check values #