1 new commit in tox: https://bitbucket.org/hpk42/tox/commits/8d323c83d4d8/ Changeset: 8d323c83d4d8 User: hpk42 Date: 2013-05-21 13:47:32 Summary: introduce white list for commands Affected #: 9 files
diff -r bb8cfbe8a1881d62c10e9e6714af171c7de7c642 -r 8d323c83d4d87511dd8fc12652b32d8cf9b5409e CHANGELOG --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,10 @@ 1.5.0.dev ----------------- +- re-fix issue2 - add command_whitelist to be used in ``[testenv*]`` + sections, allowing to avoid warnings for commands such as ``make``, + used from the commands value. + - fix issue97 - allow substitutions to reference from other sections (thanks Krisztian Fekete) diff -r bb8cfbe8a1881d62c10e9e6714af171c7de7c642 -r 8d323c83d4d87511dd8fc12652b32d8cf9b5409e doc/config.txt --- a/doc/config.txt +++ b/doc/config.txt @@ -75,6 +75,16 @@ For eventually performing a call to ``subprocess.Popen(args, ...)`` ``args`` are determined by splitting the whole command by whitespace. +.. confval:: whitelist_externals=MULTI-LINE-LIST + + each line specifies a command name (in glob-style pattern format) + which can be used in the ``commands`` section without triggering + a "not installed in virtualenv" warning. Example: if you use the + unix ``make`` for running tests you can list ``whitelist_externals=make`` + or ``whitelist_externals=/usr/bin/make`` if you want more precision. + If you don't want tox to issue a warning in any case, just use + ``whitelist_externals=*`` which will match all commands (not recommended). + .. confval:: changedir=path change to this working directory when executing the test command. diff -r bb8cfbe8a1881d62c10e9e6714af171c7de7c642 -r 8d323c83d4d87511dd8fc12652b32d8cf9b5409e setup.py --- a/setup.py +++ b/setup.py @@ -49,7 +49,7 @@ description='virtualenv-based automation of test activities', long_description=long_description, url='http://tox.testrun.org/', - version='1.5.dev8', + version='1.5.dev9', license='http://opensource.org/licenses/MIT', platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'], author='holger krekel', diff -r bb8cfbe8a1881d62c10e9e6714af171c7de7c642 -r 8d323c83d4d87511dd8fc12652b32d8cf9b5409e tests/test_config.py --- a/tests/test_config.py +++ b/tests/test_config.py @@ -368,6 +368,24 @@ envconfig = config.envconfigs['py'] assert envconfig.commands == [["abc"]] + def test_whitelist_externals(self, tmpdir, newconfig): + config = newconfig(""" + [testenv] + whitelist_externals = xyz + commands=xyz + [testenv:x] + + [testenv:py] + whitelist_externals = xyz2 + commands=abc + """) + assert len(config.envconfigs) == 2 + envconfig = config.envconfigs['py'] + assert envconfig.commands == [["abc"]] + assert envconfig.whitelist_externals == ["xyz2"] + envconfig = config.envconfigs['x'] + assert envconfig.whitelist_externals == ["xyz"] + def test_changedir(self, tmpdir, newconfig): config = newconfig(""" [testenv] diff -r bb8cfbe8a1881d62c10e9e6714af171c7de7c642 -r 8d323c83d4d87511dd8fc12652b32d8cf9b5409e tests/test_venv.py --- a/tests/test_venv.py +++ b/tests/test_venv.py @@ -295,6 +295,21 @@ mocksession.report.expect("warning", "*test command found but not*") assert venv.status == "commands failed" +def test_install_command_whitelisted(newmocksession, monkeypatch): + mocksession = newmocksession(['--recreate'], """ + [testenv] + whitelist_externals = py.test + xy* + commands= + py.test + xyz + """) + venv = mocksession.getenv('python') + venv.test() + mocksession.report.expect("warning", "*test command found but not*", + invert=True) + assert venv.status == "commands failed" + @pytest.mark.skipif("not sys.platform.startswith('linux')") def test_install_command_not_installed(newmocksession): mocksession = newmocksession(['--recreate'], """ diff -r bb8cfbe8a1881d62c10e9e6714af171c7de7c642 -r 8d323c83d4d87511dd8fc12652b32d8cf9b5409e tox/__init__.py --- a/tox/__init__.py +++ b/tox/__init__.py @@ -1,5 +1,5 @@ # -__version__ = '1.5.dev8' +__version__ = '1.5.dev9' class exception: class Error(Exception): diff -r bb8cfbe8a1881d62c10e9e6714af171c7de7c642 -r 8d323c83d4d87511dd8fc12652b32d8cf9b5409e tox/_config.py --- a/tox/_config.py +++ b/tox/_config.py @@ -291,6 +291,8 @@ vc.setenv = None vc.commands = reader.getargvlist(section, "commands") + vc.whitelist_externals = reader.getlist(section, + "whitelist_externals") vc.deps = [] for depline in reader.getlist(section, "deps"): m = re.match(r":(\w+):\s*(\S+)", depline) diff -r bb8cfbe8a1881d62c10e9e6714af171c7de7c642 -r 8d323c83d4d87511dd8fc12652b32d8cf9b5409e tox/_venv.py --- a/tox/_venv.py +++ b/tox/_venv.py @@ -81,12 +81,16 @@ if p.relto(self.envconfig.envdir): return p if venv: - self.session.report.warning( - "test command found but not installed in testenv\n" - " cmd: %s\n" - " env: %s\n" - "Maybe forgot to specify a dependency?" % (p, - self.envconfig.envdir)) + for x in self.envconfig.whitelist_externals: + if p.fnmatch(x): + break + else: + self.session.report.warning( + "test command found but not installed in testenv\n" + " cmd: %s\n" + " env: %s\n" + "Maybe forgot to specify a dependency?" % (p, + self.envconfig.envdir)) return str(p) # will not be rewritten for reporting def _ispython3(self): diff -r bb8cfbe8a1881d62c10e9e6714af171c7de7c642 -r 8d323c83d4d87511dd8fc12652b32d8cf9b5409e toxbootstrap.py --- a/toxbootstrap.py +++ b/toxbootstrap.py @@ -58,7 +58,7 @@ """ -__version__ = '1.5.dev8' +__version__ = '1.5.dev9' import sys import os 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. _______________________________________________ pytest-commit mailing list pytest-commit@python.org http://mail.python.org/mailman/listinfo/pytest-commit