Skip to content

Commit 91353e9

Browse files
authored
Merge pull request #2574 from bsipocz/DOC_remote_data_only
DOCS: how to do remote-data only tests
2 parents fc3b18a + dd84738 commit 91353e9

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

docs/testing.rst

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,4 +117,19 @@ Narrative documentation should also be tested, the ``doctest-remote-data`` direc
117117
to mark code snippets that relies on remote data access.
118118

119119
If any of the examples include saving data files locally, use the ``testcleanup`` directive and the
120-
`~astroquery.utils.cleanup_saved_downloads` function at the end of the narrative documentation.
120+
`~astroquery.utils.cleanup_saved_downloads` function at the end of the
121+
narrative documentation.
122+
123+
124+
Running only the remote-data tests
125+
----------------------------------
126+
127+
We should aim to have a reasonably complete test coverage for all the code using the
128+
actual servers (as opposed to mocked tests). To check the remote-data test
129+
coverage you can opt to run only those marked with ``remote_data``. Do
130+
remember to change ``<module_you_want_to_test>`` to the module name you
131+
actually work on:
132+
133+
.. code-block:: bash
134+
135+
pytest -P <module_you_want_to_test> -m remote_data --remote-data=any --cov astroquery/<module_you_want_to_test> --cov-config=setup.cfg

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ show-response = 1
2626

2727
[tool:pytest]
2828
minversion = 6.0
29-
norecursedirs = build docs/_build docs/gallery-examples astroquery/irsa astroquery/nasa_exoplanet_archive astroquery/ned astroquery/ibe astroquery/irsa_dust astroquery/sha
29+
norecursedirs = build docs/_build astroquery/irsa astroquery/nasa_exoplanet_archive astroquery/ned astroquery/ibe astroquery/irsa_dust astroquery/sha
3030
testpaths = astroquery docs
3131
doctest_plus = enabled
3232
astropy_header = true

tox.ini

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,8 @@ commands =
4747
devdeps: pip install -U --pre -i https://pypi.anaconda.org/astropy/simple astropy
4848

4949
pip freeze
50-
# FIXME: there are too many failures in the docs example gallery, ignore it for now
51-
!cov: pytest --pyargs astroquery {toxinidir}/docs --ignore={toxinidir}/docs/gallery* {env:PYTEST_ARGS} {posargs}
52-
cov: pytest --pyargs astroquery {toxinidir}/docs --ignore={toxinidir}/docs/gallery* --cov astroquery --cov-config={toxinidir}/setup.cfg {env:PYTEST_ARGS} {posargs}
50+
!cov: pytest --pyargs astroquery {toxinidir}/docs {env:PYTEST_ARGS} {posargs}
51+
cov: pytest --pyargs astroquery {toxinidir}/docs --cov astroquery --cov-config={toxinidir}/setup.cfg {env:PYTEST_ARGS} {posargs}
5352
cov: coverage xml -o {toxinidir}/coverage.xml
5453

5554
pip_pre =

0 commit comments

Comments
 (0)