Skip to content

Commit

Permalink
Show downloading output without pytest -s argument
Browse files Browse the repository at this point in the history
  • Loading branch information
ericpre committed Mar 31, 2024
1 parent ac1d5d7 commit 757dc62
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/package_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ jobs:
# "github.event.pull_request.head.ref" is for "pull request" event while "github.ref_name" is for "push" event
POOCH_BASE_URL: https://github.com/${{ github.event.pull_request.head.repo.full_name || github.repository }}/raw/${{ github.event.pull_request.head.ref || github.ref_name }}/rsciio/tests/data/
# "-s" is used to show of output when downloading the test files
PYTEST_ARGS: "-n 2 -s"
PYTEST_ARGS: "-n 2"
18 changes: 10 additions & 8 deletions rsciio/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,19 @@
pass


def _download_test_data():
from rsciio.tests.registry_utils import download_all
# From https://pytest-xdist.readthedocs.io/en/latest/how-to.html#making-session-scoped-fixtures-execute-only-once
@pytest.fixture(scope="session", autouse=True)
def session_data(request, tmp_path_factory, worker_id):
capmanager = request.config.pluginmanager.getplugin("capturemanager")

print("Checking if test data need downloading...")
download_all()
print("All test data available.")
def _download_test_data():
from rsciio.tests.registry_utils import download_all

with capmanager.global_and_fixture_disabled():
print("Checking if test data need downloading...")
download_all()
print("All test data available.")

# From https://pytest-xdist.readthedocs.io/en/latest/how-to.html#making-session-scoped-fixtures-execute-only-once
@pytest.fixture(scope="session", autouse=True)
def session_data(tmp_path_factory, worker_id):
if worker_id == "master":
# not executing in with multiple workers, just produce the data and let
# pytest's fixture caching do its job
Expand Down

0 comments on commit 757dc62

Please sign in to comment.