diff options
author | Lukasz Balcerzak <lukaszbalcerzak@gmail.com> | 2013-02-18 22:00:41 +0100 |
---|---|---|
committer | Lukasz Balcerzak <lukaszbalcerzak@gmail.com> | 2013-02-18 22:00:41 +0100 |
commit | 1ab5b3f197e42e86d29a7bad6324c675b448684a (patch) | |
tree | f028cc8d28ad8675fe689f20d74a0a14d051fea2 | |
parent | d9146bdc36aebd41eb06a2fadd6db65c2831df62 (diff) | |
download | tox-1ab5b3f197e42e86d29a7bad6324c675b448684a.tar.gz |
Added --list switch to show all envs
-rw-r--r-- | tests/test_config.py | 20 | ||||
-rw-r--r-- | tox/_cmdline.py | 6 | ||||
-rw-r--r-- | tox/_config.py | 2 |
3 files changed, 28 insertions, 0 deletions
diff --git a/tests/test_config.py b/tests/test_config.py index 9afa45b..92906b5 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -780,6 +780,26 @@ class TestCmdInvocation: assert tox.__version__ in stdout assert "imported from" in stdout + def test_listenvs(self, cmd, initproj): + initproj('listenvs', filedefs={ + 'tox.ini': ''' + [tox] + envlist=py26,py27,py33,pypy,docs + + [testenv:docs] + changedir = docs + ''', + }) + result = cmd.run("tox", "-l") + stdout = result.stdout.str() + assert stdout.splitlines() == [ + ' * py26', + ' * py27', + ' * py33', + ' * pypy', + ' * docs', + ] + @py.test.mark.xfail("sys.version_info < (2,6)", reason="virtualenv3 cannot be imported") def test_config_specific_ini(self, tmpdir, cmd): diff --git a/tox/_cmdline.py b/tox/_cmdline.py index a82aad8..e9bc454 100644 --- a/tox/_cmdline.py +++ b/tox/_cmdline.py @@ -271,6 +271,8 @@ class Session: raise SystemExit(1) if self.config.option.showconfig: self.showconfig() + elif self.config.option.list_envs: + self.showenvs() else: return self.subcommand_test() @@ -415,6 +417,10 @@ class Session: self.report.line(" envdir= %s" % envconfig.envdir) self.report.line(" downloadcache=%s" % envconfig.downloadcache) + def showenvs(self): + for env in self.config.envlist: + self.report.line(" * %s" % env) + def info_versions(self): versions = ['tox-%s' % tox.__version__] version = py.process.cmdexec("virtualenv --version") diff --git a/tox/_config.py b/tox/_config.py index cf09e85..4a75171 100644 --- a/tox/_config.py +++ b/tox/_config.py @@ -98,6 +98,8 @@ def prepare_parse(pkgname): help="force recreation of virtual environments") parser.add_argument("args", nargs="*", help="additional arguments available to command positional substition") + parser.add_argument("-l", "--list", action="store_true", dest="list_envs", + help="show default envlist") return parser class Config: |