diff options
author | holger krekel <holger@merlinux.eu> | 2015-05-12 14:01:28 +0200 |
---|---|---|
committer | holger krekel <holger@merlinux.eu> | 2015-05-12 14:01:28 +0200 |
commit | 904844849ae03baab8d37b87267aed27c55e8db0 (patch) | |
tree | 40fffd7df8d2119ecb2b0c8710c65d2724ce63a3 /tests | |
parent | 7549cce84c52115e0b8f47737753698579a6ac0b (diff) | |
download | tox-904844849ae03baab8d37b87267aed27c55e8db0.tar.gz |
- store and show information about what is installed in each venv
- rename internal methods to accomodate the fact that we are not only
installing sdist's
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_config.py | 62 | ||||
-rw-r--r-- | tests/test_z_cmdline.py | 22 |
2 files changed, 43 insertions, 41 deletions
diff --git a/tests/test_config.py b/tests/test_config.py index 87f7f6d..e9c941a 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -827,13 +827,13 @@ class TestConfigTestEnv: def test_substitution_error(tmpdir, newconfig): py.test.raises(tox.exception.ConfigError, newconfig, """ - [testenv:py24] + [testenv:py27] basepython={xyz} """) def test_substitution_defaults(tmpdir, newconfig): config = newconfig(""" - [testenv:py24] + [testenv:py27] commands = {toxinidir} {toxworkdir} @@ -845,7 +845,7 @@ class TestConfigTestEnv: {distshare} {envlogdir} """) - conf = config.envconfigs['py24'] + conf = config.envconfigs['py27'] argv = conf.commands assert argv[0][0] == config.toxinidir assert argv[1][0] == config.toxworkdir @@ -859,18 +859,18 @@ class TestConfigTestEnv: def test_substitution_positional(self, newconfig): inisource = """ - [testenv:py24] + [testenv:py27] commands = cmd1 [hello] \ world cmd1 {posargs:hello} \ world """ - conf = newconfig([], inisource).envconfigs['py24'] + conf = newconfig([], inisource).envconfigs['py27'] argv = conf.commands assert argv[0] == ["cmd1", "[hello]", "world"] assert argv[1] == ["cmd1", "hello", "world"] - conf = newconfig(['brave', 'new'], inisource).envconfigs['py24'] + conf = newconfig(['brave', 'new'], inisource).envconfigs['py27'] argv = conf.commands assert argv[0] == ["cmd1", "[hello]", "world"] assert argv[1] == ["cmd1", "brave", "new", "world"] @@ -886,58 +886,58 @@ class TestConfigTestEnv: def test_posargs_backslashed_or_quoted(self, tmpdir, newconfig): inisource = """ - [testenv:py24] + [testenv:py27] commands = echo "\{posargs\}" = {posargs} echo "posargs = " "{posargs}" """ - conf = newconfig([], inisource).envconfigs['py24'] + conf = newconfig([], inisource).envconfigs['py27'] argv = conf.commands assert argv[0] == ['echo', '\\{posargs\\}', '='] assert argv[1] == ['echo', 'posargs = ', ""] - conf = newconfig(['dog', 'cat'], inisource).envconfigs['py24'] + conf = newconfig(['dog', 'cat'], inisource).envconfigs['py27'] argv = conf.commands assert argv[0] == ['echo', '\\{posargs\\}', '=', 'dog', 'cat'] assert argv[1] == ['echo', 'posargs = ', 'dog cat'] def test_rewrite_posargs(self, tmpdir, newconfig): inisource = """ - [testenv:py24] + [testenv:py27] args_are_paths = True changedir = tests commands = cmd1 {posargs:hello} """ - conf = newconfig([], inisource).envconfigs['py24'] + conf = newconfig([], inisource).envconfigs['py27'] argv = conf.commands assert argv[0] == ["cmd1", "hello"] - conf = newconfig(["tests/hello"], inisource).envconfigs['py24'] + conf = newconfig(["tests/hello"], inisource).envconfigs['py27'] argv = conf.commands assert argv[0] == ["cmd1", "tests/hello"] tmpdir.ensure("tests", "hello") - conf = newconfig(["tests/hello"], inisource).envconfigs['py24'] + conf = newconfig(["tests/hello"], inisource).envconfigs['py27'] argv = conf.commands assert argv[0] == ["cmd1", "hello"] def test_rewrite_simple_posargs(self, tmpdir, newconfig): inisource = """ - [testenv:py24] + [testenv:py27] args_are_paths = True changedir = tests commands = cmd1 {posargs} """ - conf = newconfig([], inisource).envconfigs['py24'] + conf = newconfig([], inisource).envconfigs['py27'] argv = conf.commands assert argv[0] == ["cmd1"] - conf = newconfig(["tests/hello"], inisource).envconfigs['py24'] + conf = newconfig(["tests/hello"], inisource).envconfigs['py27'] argv = conf.commands assert argv[0] == ["cmd1", "tests/hello"] tmpdir.ensure("tests", "hello") - conf = newconfig(["tests/hello"], inisource).envconfigs['py24'] + conf = newconfig(["tests/hello"], inisource).envconfigs['py27'] argv = conf.commands assert argv[0] == ["cmd1", "hello"] @@ -947,12 +947,12 @@ class TestConfigTestEnv: deps= pytest pytest-cov - [testenv:py24] + [testenv:py27] deps= {[testenv]deps} fun """ - conf = newconfig([], inisource).envconfigs['py24'] + conf = newconfig([], inisource).envconfigs['py27'] packages = [dep.name for dep in conf.deps] assert packages == ['pytest', 'pytest-cov', 'fun'] @@ -1165,11 +1165,11 @@ class TestGlobalOptions: monkeypatch, newconfig): monkeypatch.setenv("HUDSON_URL", "xyz") config = newconfig(""" - [testenv:py24] + [testenv:py27] commands = {distshare} """) - conf = config.envconfigs['py24'] + conf = config.envconfigs['py27'] argv = conf.commands expect_path = config.toxworkdir.join("distshare") assert argv[0][0] == expect_path @@ -1180,11 +1180,11 @@ class TestGlobalOptions: config = newconfig(""" [tox:jenkins] distshare = {env:WORKSPACE}/hello - [testenv:py24] + [testenv:py27] commands = {distshare} """) - conf = config.envconfigs['py24'] + conf = config.envconfigs['py27'] argv = conf.commands assert argv[0][0] == config.distshare assert config.distshare == tmpdir.join("hello") @@ -1230,7 +1230,7 @@ class TestGlobalOptions: assert str(env.basepython) == sys.executable def test_default_environments(self, tmpdir, newconfig, monkeypatch): - envs = "py26,py27,py31,py32,py33,py34,jython,pypy,pypy3" + envs = "py26,py27,py32,py33,py34,py35,py36,jython,pypy,pypy3" inisource = """ [tox] envlist = %s @@ -1291,21 +1291,21 @@ class TestGlobalOptions: assert not config.option.skip_missing_interpreters def test_defaultenv_commandline(self, tmpdir, newconfig, monkeypatch): - config = newconfig(["-epy24"], "") - env = config.envconfigs['py24'] - assert env.basepython == "python2.4" + config = newconfig(["-epy27"], "") + env = config.envconfigs['py27'] + assert env.basepython == "python2.7" assert not env.commands def test_defaultenv_partial_override(self, tmpdir, newconfig, monkeypatch): inisource = """ [tox] - envlist = py24 - [testenv:py24] + envlist = py27 + [testenv:py27] commands= xyz """ config = newconfig([], inisource) - env = config.envconfigs['py24'] - assert env.basepython == "python2.4" + env = config.envconfigs['py27'] + assert env.basepython == "python2.7" assert env.commands == [['xyz']] diff --git a/tests/test_z_cmdline.py b/tests/test_z_cmdline.py index e793804..b5cbc4e 100644 --- a/tests/test_z_cmdline.py +++ b/tests/test_z_cmdline.py @@ -83,15 +83,15 @@ class TestSession: }) config = parseconfig([]) session = Session(config) - sdist = session.sdist() + sdist = session.get_installpkg_path() assert sdist.check() assert sdist.ext == ".zip" assert sdist == config.distdir.join(sdist.basename) - sdist2 = session.sdist() + sdist2 = session.get_installpkg_path() assert sdist2 == sdist sdist.write("hello") assert sdist.stat().size < 10 - sdist_new = Session(config).sdist() + sdist_new = Session(config).get_installpkg_path() assert sdist_new == sdist assert sdist_new.stat().size > 10 @@ -106,7 +106,7 @@ class TestSession: }) config = parseconfig([]) session = Session(config) - sdist = session.sdist() + sdist = session.get_installpkg_path() assert sdist.check() assert sdist.ext == ".zip" assert sdist == config.distdir.join(sdist.basename) @@ -683,7 +683,7 @@ def test_sdist_latest(tmpdir, newconfig): p = distshare.ensure("pkg123-1.4.5.zip") distshare.ensure("pkg123-1.4.5a1.zip") session = Session(config) - sdist_path = session.sdist() + sdist_path = session.get_installpkg_path() assert sdist_path == p @@ -691,7 +691,7 @@ def test_installpkg(tmpdir, newconfig): p = tmpdir.ensure("pkg123-1.0.zip") config = newconfig(["--installpkg=%s" % p], "") session = Session(config) - sdist_path = session.sdist() + sdist_path = session.get_installpkg_path() assert sdist_path == p @@ -722,7 +722,9 @@ def verify_json_report_format(data, testenvs=True): for command in envdata[commandtype]: assert command["output"] assert command["retcode"] - pyinfo = envdata["python"] - assert isinstance(pyinfo["version_info"], list) - assert pyinfo["version"] - assert pyinfo["executable"] + if envname != "GLOB": + assert isinstance(envdata["installed_packages"], list) + pyinfo = envdata["python"] + assert isinstance(pyinfo["version_info"], list) + assert pyinfo["version"] + assert pyinfo["executable"] |