[Pytest-commit] commit/tox: lukaszb: Added --list switch to show all envs
Bitbucket
commits-noreply at bitbucket.org
Tue Feb 19 14:00:06 CET 2013
1 new commit in tox:
https://bitbucket.org/hpk42/tox/commits/fa9fb217e45e/
changeset: fa9fb217e45e
user: lukaszb
date: 2013-02-18 22:00:41
summary: Added --list switch to show all envs
affected #: 3 files
diff -r a77eb52145e259314a341222866c3e6806024a15 -r fa9fb217e45e25cd688ce39ad05d6ce36f0a6d27 tests/test_config.py
--- a/tests/test_config.py
+++ b/tests/test_config.py
@@ -780,6 +780,26 @@
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 -r a77eb52145e259314a341222866c3e6806024a15 -r fa9fb217e45e25cd688ce39ad05d6ce36f0a6d27 tox/_cmdline.py
--- a/tox/_cmdline.py
+++ b/tox/_cmdline.py
@@ -271,6 +271,8 @@
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 @@
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 -r a77eb52145e259314a341222866c3e6806024a15 -r fa9fb217e45e25cd688ce39ad05d6ce36f0a6d27 tox/_config.py
--- a/tox/_config.py
+++ b/tox/_config.py
@@ -98,6 +98,8 @@
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:
Repository URL: https://bitbucket.org/hpk42/tox/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the pytest-commit
mailing list