Skip to content

Commit

Permalink
MAINT: Simplifying handling of choices
Browse files Browse the repository at this point in the history
  • Loading branch information
bsipocz committed Aug 23, 2023
1 parent 60ff143 commit 9ec9d29
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions pytest_remotedata/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ def pytest_addoption(parser):
# is 'none', but if it is specified without arguments (--remote-data), it
# defaults to '--remote-data=any'.
parser.addoption(
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

0 comments on commit 9ec9d29

Please sign in to comment.