diff --git a/.github/workflows/ci_workflows.yml b/.github/workflows/ci_workflows.yml index 66a6eb85304f..6baa785a74f4 100644 --- a/.github/workflows/ci_workflows.yml +++ b/.github/workflows/ci_workflows.yml @@ -69,7 +69,7 @@ jobs: python: 3.9 toxenv: py39-test-alldeps toxargs: -v --develop - toxposargs: --open-files + toxposargs: --open-files --run-slow - name: Python 3.8 with oldest supported version of all dependencies os: ubuntu-18.04 @@ -87,7 +87,7 @@ jobs: os: macos-latest python: 3.9 toxenv: py39-test-alldeps - toxposargs: --durations=50 + toxposargs: --durations=50 --run-slow steps: - name: Checkout code diff --git a/.pyinstaller/run_astropy_tests.py b/.pyinstaller/run_astropy_tests.py index bb4422a3048f..09b02b6f2e33 100644 --- a/.pyinstaller/run_astropy_tests.py +++ b/.pyinstaller/run_astropy_tests.py @@ -106,7 +106,8 @@ # Run the tests! sys.exit(pytest.main(['astropy_tests', '-k ' + ' and '.join('not ' + test for test in SKIP_TESTS)], - plugins=['pytest_doctestplus.plugin', + plugins=['pytest_astropy.plugin', + 'pytest_doctestplus.plugin', 'pytest_openfiles.plugin', 'pytest_remotedata.plugin', 'pytest_astropy_header.display'])) diff --git a/astropy/convolution/tests/test_discretize.py b/astropy/convolution/tests/test_discretize.py index 06206a0b1e86..cf605b176207 100644 --- a/astropy/convolution/tests/test_discretize.py +++ b/astropy/convolution/tests/test_discretize.py @@ -99,6 +99,7 @@ def test_gaussian_eval_2D(mode): @pytest.mark.skipif('not HAS_SCIPY') +@pytest.mark.slow def test_gaussian_eval_2D_integrate_mode(): """ Discretize Gaussian with integrate mode diff --git a/astropy/coordinates/tests/test_spectral_coordinate.py b/astropy/coordinates/tests/test_spectral_coordinate.py index b8273aa3cdd2..85a5344e98e2 100644 --- a/astropy/coordinates/tests/test_spectral_coordinate.py +++ b/astropy/coordinates/tests/test_spectral_coordinate.py @@ -839,6 +839,7 @@ def test_spectral_coord_from_sky_coord_without_distance(): @pytest.mark.parametrize('specsys', list(EXPECTED_VELOCITY_FRAMES)) +@pytest.mark.slow def test_spectralcoord_accuracy(specsys): # This is a test to check the numerical results of transformations between diff --git a/astropy/io/ascii/tests/test_c_reader.py b/astropy/io/ascii/tests/test_c_reader.py index 9702f332c882..4864016947f3 100644 --- a/astropy/io/ascii/tests/test_c_reader.py +++ b/astropy/io/ascii/tests/test_c_reader.py @@ -1038,16 +1038,14 @@ def test_fast_tab_with_names(parallel, read_tab): read_tab(content, data_start=1, parallel=parallel, names=head) -@pytest.mark.skipif(not os.getenv('TEST_READ_HUGE_FILE'), - reason='Environment variable TEST_READ_HUGE_FILE must be ' - 'defined to run this test') +@pytest.mark.hugemem def test_read_big_table(tmpdir): """Test reading of a huge file. This test generates a huge CSV file (~2.3Gb) before reading it (see https://github.com/astropy/astropy/pull/5319). The test is run only if the - environment variable ``TEST_READ_HUGE_FILE`` is defined. Note that running - the test requires quite a lot of memory (~18Gb when reading the file) !! + ``--run-hugemem`` cli option is given. Note that running the test requires + quite a lot of memory (~18Gb when reading the file) !! """ NB_ROWS = 250000 @@ -1072,9 +1070,7 @@ def test_read_big_table(tmpdir): assert len(t) == NB_ROWS -@pytest.mark.skipif(not os.getenv('TEST_READ_HUGE_FILE'), - reason='Environment variable TEST_READ_HUGE_FILE must be ' - 'defined to run this test') +@pytest.mark.hugemem def test_read_big_table2(tmpdir): """Test reading of a file with a huge column. """ diff --git a/astropy/io/fits/tests/test_fitsdiff.py b/astropy/io/fits/tests/test_fitsdiff.py index 5d683e6e4812..b0b9de129f22 100644 --- a/astropy/io/fits/tests/test_fitsdiff.py +++ b/astropy/io/fits/tests/test_fitsdiff.py @@ -215,6 +215,7 @@ def test_quiet(self, capsys): assert out == "" assert err == "" + @pytest.mark.slow def test_path(self, capsys): os.mkdir(self.temp('sub/')) tmp_b = self.temp('sub/ascii.fits') diff --git a/astropy/io/fits/tests/test_image.py b/astropy/io/fits/tests/test_image.py index da7831ce7b12..c004170f82d7 100644 --- a/astropy/io/fits/tests/test_image.py +++ b/astropy/io/fits/tests/test_image.py @@ -1241,6 +1241,7 @@ def test_open_comp_image_in_update_mode(self): # opening and closing it. assert mtime == os.stat(self.temp('comp.fits')).st_mtime + @pytest.mark.slow def test_open_scaled_in_update_mode_compressed(self): """ Regression test for https://aeon.stsci.edu/ssb/trac/pyfits/ticket/88 2 diff --git a/astropy/io/fits/tests/test_table.py b/astropy/io/fits/tests/test_table.py index fb48c8b96075..a1520d5f3b47 100644 --- a/astropy/io/fits/tests/test_table.py +++ b/astropy/io/fits/tests/test_table.py @@ -2682,6 +2682,7 @@ def readfile(filename): readfile(self.data('memtest.fits')) @pytest.mark.skipif('not HAVE_OBJGRAPH') + @pytest.mark.slow def test_reference_leak2(self, tmpdir): """ Regression test for https://github.com/astropy/astropy/pull/4539 diff --git a/astropy/io/misc/asdf/tags/transform/tests/test_transform.py b/astropy/io/misc/asdf/tags/transform/tests/test_transform.py index 29a7496b85d6..db68427dae4d 100644 --- a/astropy/io/misc/asdf/tags/transform/tests/test_transform.py +++ b/astropy/io/misc/asdf/tags/transform/tests/test_transform.py @@ -194,6 +194,7 @@ def asdf_check(ff): helpers.assert_roundtrip_tree(tree, tmpdir, asdf_check_func=asdf_check) +@pytest.mark.slow def test_generic_projections(tmpdir): from astropy.io.misc.asdf.tags.transform import projections diff --git a/astropy/samp/tests/test_hub.py b/astropy/samp/tests/test_hub.py index e08a92a0ad2c..6aecb1fe0042 100644 --- a/astropy/samp/tests/test_hub.py +++ b/astropy/samp/tests/test_hub.py @@ -2,9 +2,10 @@ import time -from astropy.samp.hub import SAMPHubServer +import pytest from astropy.samp import conf +from astropy.samp.hub import SAMPHubServer def setup_module(module): @@ -24,6 +25,7 @@ def test_SAMPHubServer_run(): hub.stop() +@pytest.mark.slow def test_SAMPHubServer_run_repeated(): """ Test that SAMPHub can be restarted after it has been stopped, including diff --git a/astropy/samp/tests/test_hub_script.py b/astropy/samp/tests/test_hub_script.py index c29842f866b7..1a35385f62f7 100644 --- a/astropy/samp/tests/test_hub_script.py +++ b/astropy/samp/tests/test_hub_script.py @@ -1,8 +1,9 @@ import sys -from astropy.samp.hub_script import hub_script +import pytest from astropy.samp import conf +from astropy.samp.hub_script import hub_script def setup_module(module): @@ -18,6 +19,7 @@ def teardown_function(function): sys.argv = function.sys_argv_orig +@pytest.mark.slow def test_hub_script(): sys.argv.append('-m') # run in multiple mode sys.argv.append('-w') # disable web profile diff --git a/astropy/units/tests/test_quantity_ufuncs.py b/astropy/units/tests/test_quantity_ufuncs.py index 9f58a9097756..1784d5984302 100644 --- a/astropy/units/tests/test_quantity_ufuncs.py +++ b/astropy/units/tests/test_quantity_ufuncs.py @@ -83,6 +83,7 @@ def test_removal_addition(self): assert np.add in qh.UFUNC_HELPERS assert np.add not in qh.UNSUPPORTED_UFUNCS + @pytest.mark.slow def test_thread_safety(self, fast_thread_switching): def dummy_ufunc(*args, **kwargs): return np.sqrt(*args, **kwargs) diff --git a/astropy/utils/tests/test_data.py b/astropy/utils/tests/test_data.py index 5893e38f31cc..126552ee279c 100644 --- a/astropy/utils/tests/test_data.py +++ b/astropy/utils/tests/test_data.py @@ -775,6 +775,7 @@ def test_download_parallel_partial_success(temp_cache, valid_urls, invalid_urls) # assert not any([is_url_in_cache(u) for (u, c) in td]) +@pytest.mark.slow def test_download_parallel_partial_success_lock_safe(temp_cache, valid_urls, invalid_urls): """Check that a partially successful parallel download leaves the cache unlocked. diff --git a/astropy/utils/tests/test_decorators.py b/astropy/utils/tests/test_decorators.py index 65ab011adb78..5da1bb3fdb9c 100644 --- a/astropy/utils/tests/test_decorators.py +++ b/astropy/utils/tests/test_decorators.py @@ -528,6 +528,7 @@ def _get_foo(cls): return 1 assert B.__dict__['foo'].__doc__ == "The foo." +@pytest.mark.slow def test_classproperty_lazy_threadsafe(fast_thread_switching): """ Test that a class property with lazy=True is thread-safe. @@ -555,6 +556,7 @@ def foo(cls): assert values == [values[0]] * workers +@pytest.mark.slow def test_lazyproperty_threadsafe(fast_thread_switching): """ Test thread safety of lazyproperty. diff --git a/docs/development/releasing.rst b/docs/development/releasing.rst index 720000d99dea..c7543ba07e9e 100644 --- a/docs/development/releasing.rst +++ b/docs/development/releasing.rst @@ -233,7 +233,7 @@ of the tests actually run), using tox to do a thorough test in an isolated environment:: $ pip install tox --upgrade - $ TEST_READ_HUGE_FILE=1 tox -e test-alldeps -- --remote-data=any + $ tox -e test-alldeps -- --remote-data=any --run-slow --run-hugemem Additional notes ---------------- diff --git a/setup.cfg b/setup.cfg index 1ae67a1e2f76..b4045203e040 100644 --- a/setup.cfg +++ b/setup.cfg @@ -57,7 +57,7 @@ test = # Required to run the astropy test suite. pytest>=7.0 pytest-doctestplus>=0.12 pytest-astropy-header>=0.2.1 - pytest-astropy>=0.9 + pytest-astropy>=0.10 pytest-xdist test_all = # Required for testing, plus packages used by particular tests. pytest>=7.0 diff --git a/tox.ini b/tox.ini index 4e156a0d6706..f2c2550116e8 100644 --- a/tox.ini +++ b/tox.ini @@ -19,7 +19,7 @@ isolated_build = true pypi_filter = https://raw.githubusercontent.com/astropy/ci-helpers/main/pip_pinnings.txt # Pass through the following environment variables which are needed for the CI -passenv = HOME WINDIR LC_ALL LC_CTYPE CC CI IS_CRON ARCH_ON_CI TEST_READ_HUGE_FILE +passenv = HOME WINDIR LC_ALL LC_CTYPE CC CI IS_CRON ARCH_ON_CI # For coverage, we need to pass extra options to the C compiler setenv = @@ -151,6 +151,7 @@ commands = --exclude-module tkinter \ --collect-submodules=py \ --hidden-import pytest \ + --hidden-import pytest_astropy.plugin \ --hidden-import pytest_openfiles.plugin \ --hidden-import pytest_remotedata.plugin \ --hidden-import pytest_doctestplus.plugin \