mirror of
https://github.com/fedora-python/tox-current-env.git
synced 2026-02-19 06:31:49 +01:00
Add --assert-config option
Motivation from Fedora: When we updated tox from version 3 to 4, it no longer fails when here is no suitable tox configuration found. This was a deliberate upstream choice. Unfortunately, it means that packages that use %pyproject_buildrequires with -t or -e now silently succeed if there is no tox configuration found. I identified 95 packages that are affected by this. Details: https://lists.fedoraproject.org/archives/list/python-devel@lists.fedoraproject.org/thread/ZSHSHZKVA4XJQBJD7FMMCALKN4UP5SAJ/
This commit is contained in:
@@ -580,3 +580,43 @@ def test_passenv(projdir, passenv):
|
||||
assert result.returncode == 0
|
||||
assert "\nassertme\n" in result.stdout
|
||||
assert "\nNone\n" not in result.stdout
|
||||
|
||||
|
||||
def test_assert_config_option_with_config(projdir):
|
||||
result = tox("-l", "--assert-config", check=False)
|
||||
assert result.returncode == 0
|
||||
|
||||
|
||||
def test_assert_config_option_without_config(projdir):
|
||||
(projdir / "tox.ini").unlink()
|
||||
result = tox("-l", "--assert-config", check=False)
|
||||
assert result.returncode > 0
|
||||
assert "config" in result.stderr
|
||||
assert "not found" in result.stderr
|
||||
|
||||
|
||||
def test_assert_config_option_with_setup_cfg(projdir):
|
||||
(projdir / "tox.ini").unlink()
|
||||
setup_cfg = projdir / "setup.cfg"
|
||||
setup_cfg.write_text(textwrap.dedent("""
|
||||
[tox:tox]
|
||||
env_list =
|
||||
py310
|
||||
"""))
|
||||
result = tox("-l", "--assert-config", check=False)
|
||||
assert result.returncode == 0
|
||||
|
||||
|
||||
def test_assert_config_option_with_pyproject_toml(projdir):
|
||||
(projdir / "tox.ini").unlink()
|
||||
pyproject_toml = projdir / "pyproject.toml"
|
||||
pyproject_toml.write_text(textwrap.dedent('''
|
||||
[tool.tox]
|
||||
legacy_tox_ini = """
|
||||
[tox]
|
||||
envlist =
|
||||
py310
|
||||
"""
|
||||
'''))
|
||||
result = tox("-l", "--assert-config", check=False)
|
||||
assert result.returncode == 0
|
||||
|
||||
@@ -591,3 +591,54 @@ def test_report_installed(projdir):
|
||||
assert result.returncode == 0
|
||||
assert "tox==" in result.stdout
|
||||
assert "pytest==" in result.stdout
|
||||
|
||||
|
||||
def test_assert_config_option_with_config(projdir):
|
||||
result = tox("-l", "--assert-config", check=False)
|
||||
assert result.returncode == 0
|
||||
|
||||
|
||||
def test_assert_config_option_without_config(projdir):
|
||||
(projdir / "tox.ini").unlink()
|
||||
result = tox("-l", "--assert-config", check=False)
|
||||
assert result.returncode > 0
|
||||
assert "config" in result.stderr
|
||||
assert "not found" in result.stderr
|
||||
|
||||
|
||||
def test_assert_config_option_with_setup_cfg(projdir):
|
||||
(projdir / "tox.ini").unlink()
|
||||
setup_cfg = projdir / "setup.cfg"
|
||||
setup_cfg.write_text(textwrap.dedent("""
|
||||
[tox:tox]
|
||||
env_list =
|
||||
py310
|
||||
"""))
|
||||
result = tox("-l", "--assert-config", check=False)
|
||||
assert result.returncode == 0
|
||||
|
||||
|
||||
def test_assert_config_option_with_pyproject_toml(projdir):
|
||||
(projdir / "tox.ini").unlink()
|
||||
pyproject_toml = projdir / "pyproject.toml"
|
||||
pyproject_toml.write_text(textwrap.dedent('''
|
||||
[tool.tox]
|
||||
legacy_tox_ini = """
|
||||
[tox]
|
||||
envlist =
|
||||
py310
|
||||
"""
|
||||
'''))
|
||||
result = tox("-l", "--assert-config", check=False)
|
||||
assert result.returncode == 0
|
||||
|
||||
|
||||
def test_assert_config_option_with_pyproject_toml_native(projdir):
|
||||
(projdir / "tox.ini").unlink()
|
||||
pyproject_toml = projdir / "pyproject.toml"
|
||||
pyproject_toml.write_text(textwrap.dedent("""
|
||||
[tool.tox]
|
||||
env_list = ["3.13"]
|
||||
"""))
|
||||
result = tox("-l", "--assert-config", check=False)
|
||||
assert result.returncode == 0
|
||||
|
||||
Reference in New Issue
Block a user