mirror of
https://github.com/fedora-python/tox-current-env.git
synced 2024-12-23 16:46:14 +01:00
Make --print-deps-only and --print-deps-to-file mutually exclusive
This commit is contained in:
parent
7b6ccc79cb
commit
0863536aff
@ -18,7 +18,7 @@ def tox_addoption(parser):
|
||||
action="store_true",
|
||||
dest="print_deps_only",
|
||||
default=False,
|
||||
help="Don't run tests, only print the dependencies",
|
||||
help="Don't run tests, only print the dependencies to stdout",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--print-deps-to-file",
|
||||
@ -33,6 +33,10 @@ def tox_addoption(parser):
|
||||
@tox.hookimpl
|
||||
def tox_configure(config):
|
||||
"""Stores options in the config. Makes all commands external and skips sdist"""
|
||||
if config.option.print_deps_only and config.option.print_deps_path:
|
||||
raise tox.exception.ConfigError(
|
||||
"--print-deps-only cannot be used together with --print-deps-to-file"
|
||||
)
|
||||
if config.option.print_deps_path is not None:
|
||||
config.option.print_deps_only = True
|
||||
with open(config.option.print_deps_path, "w", encoding="utf-8") as f:
|
||||
|
@ -154,6 +154,19 @@ def test_allenvs_print_deps_to_existing_file(tmp_path):
|
||||
assert "py" in lines
|
||||
|
||||
|
||||
def test_print_deps_only_print_deps_to_file_are_mutually_exclusive():
|
||||
result = tox(
|
||||
"-e",
|
||||
NATIVE_TOXENV,
|
||||
"--print-deps-only",
|
||||
"--print-deps-to-file",
|
||||
"foobar",
|
||||
check=False,
|
||||
)
|
||||
assert result.returncode > 0
|
||||
assert "cannot be used together" in result.stderr
|
||||
|
||||
|
||||
@needs_py3678
|
||||
def test_regular_run():
|
||||
result = tox()
|
||||
|
Loading…
Reference in New Issue
Block a user