diff --git a/.github/workflows/ci_cron_monthly.yml b/.github/workflows/ci_cron_monthly.yml
index 1ee9939ae692..e9aa4ebf9d3d 100644
--- a/.github/workflows/ci_cron_monthly.yml
+++ b/.github/workflows/ci_cron_monthly.yml
@@ -89,7 +89,9 @@ jobs:
python3-extension-helpers \
python3-jinja2 \
python3-numpy \
- python3-pytest-astropy \
+ python3-pytest-astropy-header \
+ python3-pytest-cov \
+ python3-pytest-remotedata \
python3-setuptools-scm \
python3-yaml \
python3-venv \
diff --git a/.github/workflows/ci_cron_weekly.yml b/.github/workflows/ci_cron_weekly.yml
index 8e2bbea50bff..d557369f4f8d 100644
--- a/.github/workflows/ci_cron_weekly.yml
+++ b/.github/workflows/ci_cron_weekly.yml
@@ -174,7 +174,9 @@ jobs:
python3-extension-helpers \
python3-jinja2 \
python3-numpy \
- python3-pytest-astropy \
+ python3-pytest-astropy-header \
+ python3-pytest-cov \
+ python3-pytest-remotedata \
python3-setuptools-scm \
python3-yaml \
python3-venv \
diff --git a/.pyinstaller/run_astropy_tests.py b/.pyinstaller/run_astropy_tests.py
index 74fbf1a32305..f2f1665f739e 100644
--- a/.pyinstaller/run_astropy_tests.py
+++ b/.pyinstaller/run_astropy_tests.py
@@ -119,7 +119,7 @@
pytest.main(
["astropy_tests", "-k " + " and ".join("not " + test for test in SKIP_TESTS)],
plugins=[
- "pytest_astropy.plugin",
+ "pytest_skip_slow",
"pytest_doctestplus.plugin",
"pytest_remotedata.plugin",
"pytest_astropy_header.display",
diff --git a/astropy/tests/runner.py b/astropy/tests/runner.py
index 0e046d7f65f4..fd10d10e2f57 100644
--- a/astropy/tests/runner.py
+++ b/astropy/tests/runner.py
@@ -179,12 +179,7 @@ def _generate_args(self, **kwargs):
"pytest_doctestplus",
"pytest_astropy_header",
]
- _missing_dependancy_error = (
- "Test dependencies are missing: {}. You should install the "
- "'pytest-astropy' package (you may need to update the package if you "
- "have a previous version installed, e.g., "
- "'pip install pytest-astropy --upgrade' or the equivalent with conda)."
- )
+ _missing_dependency_error = "Test dependencies are missing: {}. "
@classmethod
def _has_test_dependencies(cls): # pragma: no cover
@@ -201,8 +196,10 @@ def _has_test_dependencies(cls): # pragma: no cover
pluginmanager = pytest.PytestPluginManager()
try:
pluginmanager.import_plugin(module)
- except ImportError:
- raise RuntimeError(cls._missing_dependancy_error.format(module))
+ except ImportError as exc:
+ raise RuntimeError(
+ cls._missing_dependency_error.format(module)
+ ) from exc
def run_tests(self, **kwargs):
# This method is weirdly hooked into various things with docstring
diff --git a/docs/conf.py b/docs/conf.py
index 71c1d3105eff..946cd39a5620 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -538,7 +538,6 @@ def rstjinja(app, docname, source):
"miniconda": "https://docs.conda.io/en/latest/miniconda.html",
# pytest
"pytest": "https://pytest.org/en/latest/index.html",
- "pytest-astropy": "https://github.com/astropy/pytest-astropy",
"pytest-doctestplus": "https://github.com/astropy/pytest-doctestplus",
"pytest-remotedata": "https://github.com/astropy/pytest-remotedata",
# fsspec
diff --git a/docs/development/maintainers/testhelpers.rst b/docs/development/maintainers/testhelpers.rst
index 686e3e5a025b..69b6e1b8d7c2 100644
--- a/docs/development/maintainers/testhelpers.rst
+++ b/docs/development/maintainers/testhelpers.rst
@@ -11,10 +11,9 @@ overview of running or writing the tests.
Details
=======
-The dependencies used by the Astropy test suite are provided by a separate
-package called |pytest-astropy|. This package provides the ``pytest``
-dependency itself, in addition to several ``pytest`` plugins that are used by
-Astropy, and will also be of general use to other packages.
+The dependencies used by the Astropy test suite are optional and encapsulated
+with the ``test`` extra. This extra provides the ``pytest`` dependency itself,
+in addition to several ``pytest`` plugins that are used by Astropy.
Since the testing dependencies are not actually required to install or use
Astropy, in the ``pyproject.toml`` file they are not included under the
diff --git a/docs/development/testguide.rst b/docs/development/testguide.rst
index 10162438c2f0..128a15871816 100644
--- a/docs/development/testguide.rst
+++ b/docs/development/testguide.rst
@@ -138,7 +138,8 @@ Test coverage reports
Coverage reports can be generated using the `pytest-cov
`_ plugin (which is installed
-automatically when installing pytest-astropy) by using e.g.::
+automatically when installing astropy with ``test`` extra dependencies)
+by using e.g.::
pytest --cov astropy --cov-report html
@@ -494,7 +495,7 @@ Imagine if random testing gave you minimal, non-flaky failing examples,
and a clean way to describe even the most complicated data - that's
property-based testing!
-``pytest-astropy`` includes a dependency on `Hypothesis
+astropy's ``test`` extra includes a dependency on `Hypothesis
`_, so installation is easy -
you can just read the docs or `work through the tutorial
`_
diff --git a/docs/install.rst b/docs/install.rst
index 1b83f7becad6..570def473bd3 100644
--- a/docs/install.rst
+++ b/docs/install.rst
@@ -213,8 +213,6 @@ installed.
The following packages can optionally be used when testing:
-- |pytest-astropy|: See :ref:`sourcebuildtest`
-
- `pytest-xdist `_: Used for
distributed testing.
diff --git a/pyproject.toml b/pyproject.toml
index 9bcf752ba921..c8759142d4c3 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -103,9 +103,11 @@ test = [
"coverage>=7.2.0",
"hypothesis>=6.84.0",
"pytest>=8.0.1",
+ "pytest-astropy-header>=0.2.2",
+ "pytest-cov>=2.3.1",
"pytest-doctestplus>=1.4.0",
- "pytest-astropy-header>=0.2.1",
- "pytest-astropy>=0.11.0",
+ "pytest-remotedata>=0.4.1",
+ "pytest-skip-slow>=1.1.0",
"pytest-xdist>=3.6.0",
"threadpoolctl>=3.0.0",
]
diff --git a/scripts/lowest-resolved-tree.txt b/scripts/lowest-resolved-tree.txt
index 712a0e027c1a..d821bb260de1 100644
--- a/scripts/lowest-resolved-tree.txt
+++ b/scripts/lowest-resolved-tree.txt
@@ -313,28 +313,17 @@ astropy
│ ├── attrs v20.1.0
│ └── sortedcontainers v2.1.0
├── pytest v8.0.1 (extra: test) (*)
-├── pytest-astropy v0.11.0 (extra: test)
-│ ├── attrs v20.1.0
-│ ├── hypothesis v6.84.0 (*)
-│ ├── pytest v8.0.1 (*)
-│ ├── pytest-arraydiff v0.5.0
-│ │ ├── numpy v2.0.0
-│ │ └── pytest v8.0.1 (*)
-│ ├── pytest-astropy-header v0.2.2
-│ │ └── pytest v8.0.1 (*)
-│ ├── pytest-cov v2.3.1
-│ │ ├── coverage v7.2.0
-│ │ └── pytest v8.0.1 (*)
-│ ├── pytest-doctestplus v1.4.0 (*)
-│ ├── pytest-filter-subpackage v0.1.2
-│ │ └── pytest v8.0.1 (*)
-│ ├── pytest-mock v2.0.0
-│ │ └── pytest v8.0.1 (*)
-│ └── pytest-remotedata v0.4.1
-│ ├── packaging v25.0
-│ └── pytest v8.0.1 (*)
-├── pytest-astropy-header v0.2.2 (extra: test) (*)
+├── pytest-astropy-header v0.2.2 (extra: test)
+│ └── pytest v8.0.1 (*)
+├── pytest-cov v2.3.1 (extra: test)
+│ ├── coverage v7.2.0
+│ └── pytest v8.0.1 (*)
├── pytest-doctestplus v1.4.0 (extra: test) (*)
+├── pytest-remotedata v0.4.1 (extra: test)
+│ ├── packaging v25.0
+│ └── pytest v8.0.1 (*)
+├── pytest-skip-slow v1.1.0 (extra: test)
+│ └── pytest v8.0.1 (*)
├── pytest-xdist v3.6.1 (extra: test)
│ ├── execnet v2.1.0
│ └── pytest v8.0.1 (*)
@@ -368,9 +357,11 @@ astropy
├── pandas v2.2.2 (extra: test-all) (*)
├── pyarrow v16.0.0 (extra: test-all) (*)
├── pytest v8.0.1 (extra: test-all) (*)
-├── pytest-astropy v0.11.0 (extra: test-all) (*)
├── pytest-astropy-header v0.2.2 (extra: test-all) (*)
+├── pytest-cov v2.3.1 (extra: test-all) (*)
├── pytest-doctestplus v1.4.0 (extra: test-all) (*)
+├── pytest-remotedata v0.4.1 (extra: test-all) (*)
+├── pytest-skip-slow v1.1.0 (extra: test-all) (*)
├── pytest-xdist v3.6.1 (extra: test-all) (*)
├── pytz v2020.1 (extra: test-all)
├── s3fs v2023.4.0 (extra: test-all) (*)
diff --git a/tox.ini b/tox.ini
index 01d85cf9c37b..f08fab3f5457 100644
--- a/tox.ini
+++ b/tox.ini
@@ -96,7 +96,7 @@ deps =
devpytest: git+https://github.com/astropy/pytest-arraydiff.git
devpytest: git+https://github.com/astropy/pytest-filter-subpackage.git
devpytest: git+https://github.com/matplotlib/pytest-mpl.git
- devpytest: git+https://github.com/astropy/pytest-astropy.git
+ devpytest: git+https://github.com/okken/pytest-skip-slow.git
# Duplicates test_all in pyproject.toml due to upstream bug
# https://github.com/tox-dev/tox/issues/3433
@@ -220,8 +220,8 @@ commands =
--exclude-module tkinter \
--collect-submodules=py \
--hidden-import pytest \
- --hidden-import pytest_astropy.plugin \
- --hidden-import pytest_remotedata.plugin \
--hidden-import pytest_doctestplus.plugin \
+ --hidden-import pytest_remotedata.plugin \
+ --hidden-import pytest_skip_slow \
--hidden-import pytest_mpl.plugin
./run_astropy_tests --astropy-root "{toxinidir}"