Pytest-remotedata is a pytest plugin that provides control over unit tests requiring access to remote data from the internet. It allows developers to mark tests that either need remote data or should only run when internet access is disabled, helping to manage test suite runtime and dependencies. Originally part of the Astropy core package, it is currently at version 0.4.1 and sees active development with a consistent release cadence.
pip install pytest-remotedataVerified import paths — ran on the pinned version, not inferred.
To use `pytest-remotedata`, you mark your test functions with `@pytest.mark.remote_data` for tests requiring internet access or `@pytest.mark.internet_off` for tests that expect no internet. When `pytest` is run, tests marked with `remote_data` are skipped by default. They will only execute if the `--remote-data` command-line option (or `--remote-data=any`) is provided to `pytest`. Conversely, tests marked with `internet_off` will run when `--remote-data` is not provided (or `--remote-data=none`), and be skipped if `--remote-data` is active.
Do not use the `-R` option. Instead, rely on the standard `pytest --remote-data` for enabling remote data tests.
Always run `pytest` with `pytest --remote-data` to execute tests marked with `@pytest.mark.remote_data`. Use `pytest --remote-data=none` or simply `pytest` (without `--remote-data`) to skip them and run `internet_off` tests.
Ensure all tests that perform network requests are explicitly marked with `@pytest.mark.remote_data` when `remote_data_strict = true` is enabled. Review your `setup.cfg` for this setting.