1
0
mirror of https://github.com/fedora-python/tox-current-env.git synced 2025-02-04 10:36:18 +01:00

Test that the tested package is never/always installed to the test environment

Where "never" means:

 - with and without usedevelop
 - with all options of this plugin

Where "always" means:

 - with and without usedevelop
 - without options of this plugin
This commit is contained in:
Miro Hrončok 2020-11-03 15:01:03 +01:00
parent ed9ff81816
commit 10da929f4b
2 changed files with 23 additions and 0 deletions

View File

@ -10,3 +10,4 @@ extras =
full
commands =
python -c 'import os, sys; print(os.path.realpath(sys.exec_prefix), "is the exec_prefix")'
# note: some tests assume [testenv] is the last section

View File

@ -36,6 +36,7 @@ def projdir(tmp_path, monkeypatch):
for fname in "tox.ini", "setup.py":
shutil.copy(FIXTURES_DIR / fname, pwd)
monkeypatch.chdir(pwd)
return pwd
@pytest.fixture(params=('--print-deps-only', '--print-deps-to-file=-', '--print-deps-to=-'))
@ -546,3 +547,24 @@ def test_noquiet_installed_packages(flag):
else:
assert len([p for p in packages if p.startswith("tox==")]) == 1
assert all(re.match(r"\S+==\S+", p) for p in packages)
@pytest.mark.parametrize("flag", ["--print-deps-to=-", "--print-extras-to=-", "--current-env"])
@pytest.mark.parametrize("usedevelop", [True, False])
def test_self_is_not_installed(projdir, flag, usedevelop):
tox_ini = projdir / "tox.ini"
with open(tox_ini, 'a') as tox_ini_file:
print(f"usedevelop={usedevelop}", file=tox_ini_file)
result = tox("-e", NATIVE_TOXENV, flag, quiet=False)
assert 'test==0.0.0' not in result.stdout
assert 'test @ file://' not in result.stdout
@pytest.mark.parametrize("usedevelop", [True, False])
def test_self_is_installed_with_regular_tox(projdir, usedevelop):
tox_ini = projdir / "tox.ini"
with open(tox_ini, 'a') as tox_ini_file:
print(f"usedevelop={usedevelop}", file=tox_ini_file)
result = tox("-e", NATIVE_TOXENV, quiet=False)
assert ('test==0.0.0' in result.stdout or
'test @ file://' in result.stdout)