Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workaround: Remove -R option #70

Merged
merged 3 commits into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
0.4.1 (unreleased)
==================

- No changes yet.
- Reverting the short option of ``-R`` due to a clash with ``pytest-leaks``.
The short option is added to ``pytest-astropy`` instead. [#70]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But won't that make any package that install pytest-astropy to be incompatible with pytest-leaks?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it would. But -R was around in the astropy ecosystem forever, so I don't expect much clash in real life scenarios.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it is a nice compromise. Packages don't really need the meta package to function if there is indeed a clash down the road.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the order of operation? Does astropy/pytest-astropy#55 go in first or this one?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The order doesn't matter as the metapackage config explicitly states incompatibility with 0.4.0, the only release that has this option.


0.4.0 (2022-12-11)
==================
Expand Down
12 changes: 4 additions & 8 deletions pytest_remotedata/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ def pytest_addoption(parser):

# The following means that if --remote-data is not specified, the default
# is 'none', but if it is specified without arguments (--remote-data), it
# defaults to '--remote-data=any'. -R is short for --remote-data
# defaults to '--remote-data=any'.
parser.addoption(
"--remote-data", "-R", nargs="?", const='any', default='none',
help="run tests with online data")
"--remote-data", nargs="?", const='any', default='none',
help="run tests with online data",
choices=['astropy', 'any', 'github', 'none'])

parser.addini(
'remote_data_strict',
Expand All @@ -34,11 +35,6 @@ def pytest_configure(config):
strict_check = bool(config.getini('remote_data_strict'))

remote_data = config.getoption('remote_data')
options = ['astropy', 'any', 'github', 'none']
if remote_data not in options:
raise pytest.UsageError(
"'{}' is not a valid source for remote data, "
"use one of '{}'".format(remote_data, "', '".join(options)))

# Monkeypatch to deny access to remote resources unless explicitly told
# otherwise
Expand Down
1 change: 0 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ commands =
pytest {toxinidir}/tests --remote-data=github {posargs}
pytest {toxinidir}/tests --remote-data=astropy {posargs}
pytest {toxinidir}/tests --remote-data=any {posargs}
pytest {toxinidir}/tests -R {posargs}

[testenv:codestyle]
changedir =
Expand Down