diff options
author | Oliver Bestwalter <oliver@bestwalter.de> | 2016-06-20 16:44:22 +0200 |
---|---|---|
committer | Oliver Bestwalter <oliver@bestwalter.de> | 2016-06-20 16:44:22 +0200 |
commit | 2c81964af2372e7e82913dd88b2e0d66fb42c343 (patch) | |
tree | 2fb25a68f61b095b304c74a2a222fd01bbdfcd49 /tests | |
parent | b5ded7a6bc0e7407c08813faa95b66a624d60f52 (diff) | |
parent | 6c44042ac2357850365c83e7f31be4d74dd2199f (diff) | |
download | tox-2c81964af2372e7e82913dd88b2e0d66fb42c343.tar.gz |
Merged in pjdelport/tox/fix-flakes (pull request #187)
Make "tox -e flakes" pass
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_config.py | 34 | ||||
-rw-r--r-- | tests/test_venv.py | 12 |
2 files changed, 37 insertions, 9 deletions
diff --git a/tests/test_config.py b/tests/test_config.py index 6176641..ffc8343 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -274,6 +274,34 @@ class TestIniParserAgainstCommandsKey: ["echo", "cmd", "1", "2", "3", "4", "cmd", "2"], ] + def test_command_substitution_from_other_section_posargs(self, newconfig): + """Ensure subsitition from other section with posargs succeeds""" + config = newconfig(""" + [section] + key = thing {posargs} arg2 + [testenv] + commands = + {[section]key} + """) + reader = SectionReader("testenv", config._cfg) + reader.addsubstitutions([r"argpos"]) + x = reader.getargvlist("commands") + assert x == [['thing', 'argpos', 'arg2']] + + def test_command_section_and_posargs_substitution(self, newconfig): + """Ensure subsitition from other section with posargs succeeds""" + config = newconfig(""" + [section] + key = thing arg1 + [testenv] + commands = + {[section]key} {posargs} endarg + """) + reader = SectionReader("testenv", config._cfg) + reader.addsubstitutions([r"argpos"]) + x = reader.getargvlist("commands") + assert x == [['thing', 'arg1', 'argpos', 'endarg']] + def test_command_env_substitution(self, newconfig): """Ensure referenced {env:key:default} values are substituted correctly.""" config = newconfig(""" @@ -1410,10 +1438,10 @@ class TestGlobalOptions: def test_minversion(self, tmpdir, newconfig, monkeypatch): inisource = """ [tox] - minversion = 3.0 + minversion = 10.0 """ - config = newconfig([], inisource) - assert config.minversion == "3.0" + with py.test.raises(tox.exception.MinVersionError): + config = newconfig([], inisource) def test_skip_missing_interpreters_true(self, tmpdir, newconfig, monkeypatch): inisource = """ diff --git a/tests/test_venv.py b/tests/test_venv.py index 4ab3b06..30bdf3c 100644 --- a/tests/test_venv.py +++ b/tests/test_venv.py @@ -137,8 +137,8 @@ def test_install_deps_wildcard(newmocksession): assert len(l) == 2 args = l[-1].args assert l[-1].cwd == venv.envconfig.config.toxinidir - assert "pip" in str(args[0]) - assert args[1] == "install" + assert "pip" in str(args[2]) + assert args[3] == "install" # arg = "--download-cache=" + str(venv.envconfig.downloadcache) # assert arg in args[2:] args = [arg for arg in args if str(arg).endswith("dep1-1.1.zip")] @@ -167,8 +167,8 @@ def test_install_downloadcache(newmocksession, monkeypatch, tmpdir, envdc): assert len(l) == 2 args = l[-1].args assert l[-1].cwd == venv.envconfig.config.toxinidir - assert "pip" in str(args[0]) - assert args[1] == "install" + assert "pip" in str(args) + assert args[3] == "install" assert "dep1" in args assert "dep2" in args deps = list(filter(None, [x[1] for x in venv._getliveconfig().deps])) @@ -365,7 +365,7 @@ def test_install_python3(tmpdir, newmocksession): venv._install(["hello"], action=action) assert len(l) == 1 args = l[0].args - assert 'pip' in str(args[0]) + assert "pip" in [str(x) for x in args] for x in args: assert "--download-cache" not in args, args @@ -597,7 +597,7 @@ def test_run_install_command(newmocksession): venv.run_install_command(packages=["whatever"], action=action) l = mocksession._pcalls assert len(l) == 1 - assert 'pip' in l[0].args[0] + assert 'pip' in l[0].args[2] assert 'install' in l[0].args env = l[0].env assert env is not None |