mirror of
https://github.com/fedora-python/tox-current-env.git
synced 2024-12-24 09:06:15 +01:00
Print tox minversion with --print-deps-to
Partially fixes https://github.com/fedora-python/tox-current-env/issues/39
This commit is contained in:
parent
60bde0041c
commit
a66b6f73d3
@ -197,6 +197,14 @@ def tox_testenv_install_deps(venv, action):
|
||||
return True
|
||||
|
||||
|
||||
def tox_dependencies(config):
|
||||
"""Get dependencies of tox itself, 'minversion' config option"""
|
||||
deps = []
|
||||
if config.minversion is not None:
|
||||
deps.append(f"tox >= {config.minversion}")
|
||||
return deps
|
||||
|
||||
|
||||
@tox.hookimpl
|
||||
def tox_runtest(venv, redirect):
|
||||
"""If --print-deps-to, prints deps instead of running tests.
|
||||
@ -208,6 +216,7 @@ def tox_runtest(venv, redirect):
|
||||
|
||||
if config.option.print_deps_to:
|
||||
print(
|
||||
*tox_dependencies(config),
|
||||
*venv.get_resolved_dependencies(),
|
||||
sep="\n",
|
||||
file=config.option.print_deps_to,
|
||||
|
@ -150,6 +150,24 @@ def test_print_deps(toxenv, print_deps_stdout_arg):
|
||||
assert result.stdout == expected
|
||||
|
||||
|
||||
@pytest.mark.parametrize("toxenv", ["py36", "py37", "py38", "py39"])
|
||||
def test_print_deps_with_tox_minversion(projdir, toxenv, print_deps_stdout_arg):
|
||||
with modify_config(projdir / 'tox.ini') as config:
|
||||
config["tox"]["minversion"] = "3.13"
|
||||
result = tox("-e", toxenv, print_deps_stdout_arg)
|
||||
expected = textwrap.dedent(
|
||||
f"""
|
||||
tox >= 3.13
|
||||
six
|
||||
py
|
||||
___________________________________ summary ____________________________________
|
||||
{toxenv}: commands succeeded
|
||||
congratulations :)
|
||||
"""
|
||||
).lstrip()
|
||||
assert result.stdout == expected
|
||||
|
||||
|
||||
@pytest.mark.parametrize("toxenv", ["py36", "py37", "py38", "py39"])
|
||||
def test_print_extras(toxenv, print_extras_stdout_arg):
|
||||
result = tox("-e", toxenv, print_extras_stdout_arg)
|
||||
|
Loading…
Reference in New Issue
Block a user