1
0
mirror of https://github.com/fedora-python/tox-current-env.git synced 2025-01-11 08:56:14 +01:00

Fix tests for tox 4.0.15

This commit is contained in:
Miro Hrončok 2022-12-20 11:37:10 +01:00
parent 1130fb77b4
commit 843dee6288
3 changed files with 8 additions and 10 deletions

View File

@ -11,7 +11,6 @@ from utils import (
NATIVE_SITE_PACKAGES, NATIVE_SITE_PACKAGES,
NATIVE_TOXENV, NATIVE_TOXENV,
TOX_VERSION, TOX_VERSION,
TOX_MIN_VERSION,
envs_from_tox_ini, envs_from_tox_ini,
modify_config, modify_config,
needs_all_pythons, needs_all_pythons,
@ -36,7 +35,7 @@ def test_print_deps(toxenv, print_deps_stdout_arg):
result = tox("-e", toxenv, print_deps_stdout_arg) result = tox("-e", toxenv, print_deps_stdout_arg)
expected = textwrap.dedent( expected = textwrap.dedent(
f""" f"""
tox>={TOX_MIN_VERSION} tox
six six
py py
{tox_footer(toxenv)} {tox_footer(toxenv)}
@ -57,7 +56,7 @@ def test_print_deps_with_commands_pre_post(projdir, toxenv, pre_post, print_deps
result = tox("-e", toxenv, print_deps_stdout_arg) result = tox("-e", toxenv, print_deps_stdout_arg)
expected = textwrap.dedent( expected = textwrap.dedent(
f""" f"""
tox>={TOX_MIN_VERSION} tox
six six
py py
{tox_footer(toxenv)} {tox_footer(toxenv)}
@ -94,7 +93,7 @@ def test_print_deps_with_tox_requires(projdir, toxenv, print_deps_stdout_arg):
f""" f"""
setuptools>30 setuptools>30
pluggy pluggy
tox>={TOX_MIN_VERSION} tox
six six
py py
{tox_footer(toxenv)} {tox_footer(toxenv)}
@ -166,7 +165,7 @@ def test_allenvs_print_deps(print_deps_stdout_arg):
result = tox(print_deps_stdout_arg) result = tox(print_deps_stdout_arg)
expected = [] expected = []
for env in envs_from_tox_ini(): for env in envs_from_tox_ini():
expected.extend((f"tox>={TOX_MIN_VERSION}", "six", "py", f"{env}: OK")) expected.extend(("tox", "six", "py", f"{env}: OK"))
expected.pop() # The last "py310: OK" is not there expected.pop() # The last "py310: OK" is not there
expected.append(tox_footer(spaces=0)) expected.append(tox_footer(spaces=0))
expected = ("\n".join(expected)).splitlines() expected = ("\n".join(expected)).splitlines()
@ -189,7 +188,7 @@ def test_print_deps_to_file(toxenv, tmp_path):
depspath = tmp_path / "deps" depspath = tmp_path / "deps"
result = tox("-e", toxenv, "--print-deps-to", str(depspath)) result = tox("-e", toxenv, "--print-deps-to", str(depspath))
assert sorted(depspath.read_text().splitlines()) == sorted( assert sorted(depspath.read_text().splitlines()) == sorted(
[f"tox>={TOX_MIN_VERSION}", "six", "py"] ["tox", "six", "py"]
) )
expected = tox_footer(toxenv, spaces=0) + "\n" expected = tox_footer(toxenv, spaces=0) + "\n"
assert prep_tox_output(result.stdout) == expected assert prep_tox_output(result.stdout) == expected
@ -209,7 +208,7 @@ def test_allenvs_print_deps_to_file(tmp_path, option):
depspath = tmp_path / "deps" depspath = tmp_path / "deps"
result = tox(option, str(depspath)) result = tox(option, str(depspath))
assert sorted(depspath.read_text().splitlines()) == sorted( assert sorted(depspath.read_text().splitlines()) == sorted(
[f"tox>={TOX_MIN_VERSION}", "six", "py"] * len(envs_from_tox_ini()) ["tox", "six", "py"] * len(envs_from_tox_ini())
) )
expected = "" expected = ""
for env in envs_from_tox_ini()[:-1]: for env in envs_from_tox_ini()[:-1]:
@ -352,7 +351,7 @@ def test_print_deps_without_python_command(tmp_path, print_deps_stdout_arg):
result = tox("-e", NATIVE_TOXENV, print_deps_stdout_arg, env=env) result = tox("-e", NATIVE_TOXENV, print_deps_stdout_arg, env=env)
expected = textwrap.dedent( expected = textwrap.dedent(
f""" f"""
tox>={TOX_MIN_VERSION} tox
six six
py py
{tox_footer(NATIVE_TOXENV)} {tox_footer(NATIVE_TOXENV)}

View File

@ -53,7 +53,6 @@ def tox(*args, quiet=True, **kwargs):
TOX_VERSION = ver(tox("--version").stdout.split(" ")[0].split("+")[0]) TOX_VERSION = ver(tox("--version").stdout.split(" ")[0].split("+")[0])
TOX_MIN_VERSION = ver(f"{TOX_VERSION.major}.{TOX_VERSION.minor}")
TOX4 = TOX_VERSION.major == 4 TOX4 = TOX_VERSION.major == 4

View File

@ -10,7 +10,7 @@ extras =
deps= deps=
tox324: tox >=3.24,<3.25 tox324: tox >=3.24,<3.25
tox3: tox < 4 tox3: tox < 4
tox4: tox >=4,< 5 tox4: tox >=4.0.15,< 5
commands = commands =
pytest -v {posargs} tests pytest -v {posargs} tests