From 64d58c3d3deef2e212eb6a63a8d0f6af348924e6 Mon Sep 17 00:00:00 2001 From: Marc Abramowitz Date: Thu, 24 Apr 2014 07:58:29 -0700 Subject: doc: Update Jenkins example to use code-block --- doc/example/jenkins.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/example/jenkins.txt b/doc/example/jenkins.txt index bfdceee..a3e7de2 100644 --- a/doc/example/jenkins.txt +++ b/doc/example/jenkins.txt @@ -32,7 +32,9 @@ using these steps: The last point requires that your test command creates JunitXML files, for example with ``py.test`` it is done like this: - commands=py.test --junitxml=junit-{envname}.xml +.. code-block:: ini + + commands = py.test --junitxml=junit-{envname}.xml -- cgit v1.2.1 From b3cd545123a5e57c8970af5645f683cd469d117d Mon Sep 17 00:00:00 2001 From: Marc Abramowitz Date: Thu, 24 Apr 2014 08:04:56 -0700 Subject: tox.ini: Add py33 and py34 --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index f2fc791..d5bcdcd 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist=py27,py33,py26,py32,pypy +envlist=py27,py33,py26,py32,py33,py34,pypy [testenv:X] commands=echo {posargs} -- cgit v1.2.1 From 598b1e18592590eb57f4df2e6b614c79bdb2e2c1 Mon Sep 17 00:00:00 2001 From: Marc Abramowitz Date: Thu, 24 Apr 2014 10:27:16 -0700 Subject: doc: Fix broken links --- doc/example/jenkins.txt | 3 +-- doc/example/pytest.txt | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/doc/example/jenkins.txt b/doc/example/jenkins.txt index bfdceee..57b71ab 100644 --- a/doc/example/jenkins.txt +++ b/doc/example/jenkins.txt @@ -57,7 +57,7 @@ with this:: exec urllib.urlopen(url).read() in d d['cmdline'](['--recreate']) -The downloaded `toxbootstrap.py`_ file downloads all neccessary files to +The downloaded `toxbootstrap.py` file downloads all neccessary files to install ``tox`` in a virtual sub environment. Notes: * uncomment the line containing ``USETOXDEV`` to use the latest @@ -68,7 +68,6 @@ install ``tox`` in a virtual sub environment. Notes: will cause tox to reinstall all virtual environments all the time which is often what one wants in CI server contexts) -.. _`toxbootstrap.py`: https://bitbucket.org/hpk42/tox/raw/default/toxbootstrap.py Integrating "sphinx" documentation checks in a Jenkins job ---------------------------------------------------------------- diff --git a/doc/example/pytest.txt b/doc/example/pytest.txt index cba8741..6f98cf3 100755 --- a/doc/example/pytest.txt +++ b/doc/example/pytest.txt @@ -105,7 +105,7 @@ directories; pytest will still find and import them by adding their parent directory to ``sys.path`` but they won't be copied to other places or be found by Python's import system outside of pytest. -.. _`fully qualified name`: http://pytest.org/latest/goodpractises.html#package-name +.. _`fully qualified name`: http://pytest.org/latest/goodpractises.html#test-package-name .. include:: ../links.txt -- cgit v1.2.1 From 74d05ce7a12b5e2708e5ded12732f56b54968c4d Mon Sep 17 00:00:00 2001 From: Marc Abramowitz Date: Fri, 25 Apr 2014 13:32:57 -0700 Subject: tox-quickstart: Add py34 --- tox/_quickstart.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox/_quickstart.py b/tox/_quickstart.py index f66f1e2..098eb61 100644 --- a/tox/_quickstart.py +++ b/tox/_quickstart.py @@ -56,7 +56,7 @@ except NameError: term_input = input -all_envs = ['py26', 'py27', 'py32', 'py33', 'pypy', 'jython'] +all_envs = ['py26', 'py27', 'py32', 'py33', 'py34', 'pypy', 'jython'] PROMPT_PREFIX = '> ' -- cgit v1.2.1 From a395bf5f6cbe40b01e766ffdd5ed6b4137534bc5 Mon Sep 17 00:00:00 2001 From: Marc Abramowitz Date: Sun, 27 Apr 2014 01:50:53 -0700 Subject: Fix test_quickstart failures that were introduced by adding py34 to tox-quickstart in 94842aabbbcc --- tests/test_quickstart.py | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/tests/test_quickstart.py b/tests/test_quickstart.py index c376d4b..709fdc6 100644 --- a/tests/test_quickstart.py +++ b/tests/test_quickstart.py @@ -28,7 +28,7 @@ class TestToxQuickstartMain(object): monkeypatch.setattr( tox._quickstart, 'term_input', self.get_mock_term_input( - ['4', 'Y', 'Y', 'Y', 'Y', 'Y', 'N', 'py.test', 'pytest'])) + ['4', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'N', 'py.test', 'pytest'])) tox._quickstart.main(argv=['tox-quickstart']) @@ -39,7 +39,7 @@ class TestToxQuickstartMain(object): # and then run "tox" from this directory. [tox] -envlist = py26, py27, py32, py33, pypy +envlist = py26, py27, py32, py33, py34, pypy [testenv] commands = py.test @@ -52,7 +52,7 @@ deps = def test_quickstart_main_choose_individual_pythons_and_nose_adds_deps(self, monkeypatch): monkeypatch.setattr( tox._quickstart, 'term_input', - self.get_mock_term_input(['4', 'Y', 'Y', 'Y', 'Y', 'Y', 'N', + self.get_mock_term_input(['4', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'N', 'nosetests', ''])) tox._quickstart.main(argv=['tox-quickstart']) @@ -64,7 +64,7 @@ deps = # and then run "tox" from this directory. [tox] -envlist = py26, py27, py32, py33, pypy +envlist = py26, py27, py32, py33, py34, pypy [testenv] commands = nosetests @@ -77,7 +77,7 @@ deps = def test_quickstart_main_choose_individual_pythons_and_trial_adds_deps(self, monkeypatch): monkeypatch.setattr( tox._quickstart, 'term_input', - self.get_mock_term_input(['4', 'Y', 'Y', 'Y', 'Y', 'Y', 'N', + self.get_mock_term_input(['4', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'N', 'trial', ''])) tox._quickstart.main(argv=['tox-quickstart']) @@ -89,7 +89,7 @@ deps = # and then run "tox" from this directory. [tox] -envlist = py26, py27, py32, py33, pypy +envlist = py26, py27, py32, py33, py34, pypy [testenv] commands = trial @@ -102,7 +102,7 @@ deps = def test_quickstart_main_choose_individual_pythons_and_pytest_adds_deps(self, monkeypatch): monkeypatch.setattr( tox._quickstart, 'term_input', - self.get_mock_term_input(['4', 'Y', 'Y', 'Y', 'Y', 'Y', 'N', + self.get_mock_term_input(['4', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'N', 'py.test', ''])) tox._quickstart.main(argv=['tox-quickstart']) @@ -113,7 +113,7 @@ deps = # and then run "tox" from this directory. [tox] -envlist = py26, py27, py32, py33, pypy +envlist = py26, py27, py32, py33, py34, pypy [testenv] commands = py.test @@ -185,7 +185,7 @@ deps = # and then run "tox" from this directory. [tox] -envlist = py26, py27, py32, py33, pypy, jython +envlist = py26, py27, py32, py33, py34, pypy, jython [testenv] commands = py.test @@ -198,7 +198,7 @@ deps = def test_quickstart_main_choose_individual_pythons_and_defaults(self, monkeypatch): monkeypatch.setattr( tox._quickstart, 'term_input', - self.get_mock_term_input(['4', '', '', '', '', '', '', '', '', '', ''])) + self.get_mock_term_input(['4', '', '', '', '', '', '', '', '', '', '', ''])) tox._quickstart.main(argv=['tox-quickstart']) @@ -209,7 +209,7 @@ deps = # and then run "tox" from this directory. [tox] -envlist = py26, py27, py32, py33, pypy, jython +envlist = py26, py27, py32, py33, py34, pypy, jython [testenv] commands = {envpython} setup.py test @@ -239,7 +239,7 @@ deps = # and then run "tox" from this directory. [tox] -envlist = py26, py27, py32, py33, pypy, jython +envlist = py26, py27, py32, py33, py34, pypy, jython [testenv] commands = {envpython} setup.py test @@ -257,6 +257,7 @@ class TestToxQuickstart(object): 'py27': True, 'py32': True, 'py33': True, + 'py34': True, 'pypy': True, 'commands': 'py.test', 'deps': 'pytest', @@ -268,7 +269,7 @@ class TestToxQuickstart(object): # and then run "tox" from this directory. [tox] -envlist = py26, py27, py32, py33, pypy +envlist = py26, py27, py32, py33, py34, pypy [testenv] commands = py.test @@ -339,6 +340,7 @@ deps = 'py27': True, 'py32': True, 'py33': True, + 'py34': True, 'pypy': True, 'commands': 'nosetests -v', 'deps': 'nose', @@ -350,7 +352,7 @@ deps = # and then run "tox" from this directory. [tox] -envlist = py27, py32, py33, pypy +envlist = py27, py32, py33, py34, pypy [testenv] commands = nosetests -v -- cgit v1.2.1 From f28bcae5c2713b6a0382b8e0849befdf1196b540 Mon Sep 17 00:00:00 2001 From: Marc Abramowitz Date: Sun, 27 Apr 2014 09:24:33 -0700 Subject: tox.ini: Fix envlist It was listing py33 twice and was in no discernible order. --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index d5bcdcd..1a0027a 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist=py27,py33,py26,py32,py33,py34,pypy +envlist=py27,py26,py34,py33,py32,pypy [testenv:X] commands=echo {posargs} -- cgit v1.2.1 From c6df1a6a4175078fb4051dbe7f2d11af468b6b4b Mon Sep 17 00:00:00 2001 From: Marc Abramowitz Date: Sun, 27 Apr 2014 17:42:34 -0700 Subject: tox.ini: Add "flakes" target --- tox.ini | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 1a0027a..6bcca5e 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist=py27,py26,py34,py33,py32,pypy +envlist=py27,py26,py34,py33,py32,pypy,flakes [testenv:X] commands=echo {posargs} @@ -18,6 +18,10 @@ commands= --junitxml={envlogdir}/junit-{envname}.xml \ check_sphinx.py {posargs} +[testenv:flakes] +deps = pytest-flakes>=0.2 +commands = py.test --flakes -m flakes tox tests + [testenv:py25] setenv= PIP_INSECURE=1 -- cgit v1.2.1 From 11b313d1d874027843ebbd7af16a32e5859e8055 Mon Sep 17 00:00:00 2001 From: Marc Abramowitz Date: Sun, 27 Apr 2014 17:43:12 -0700 Subject: Fix "flakes" problems --- tests/conftest.py | 2 +- tests/test_config.py | 11 +++++------ tests/test_interpreters.py | 2 +- tests/test_venv.py | 10 +++++----- tests/test_z_cmdline.py | 4 +--- tox/__init__.py | 2 +- tox/_cmdline.py | 4 ++-- tox/_config.py | 7 ++----- tox/_venv.py | 8 +++----- tox/_verlib.py | 1 - tox/interpreters.py | 2 -- 11 files changed, 21 insertions(+), 32 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 1d4bdde..3e2493b 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,2 +1,2 @@ -from tox._pytestplugin import * +from tox._pytestplugin import * # noqa diff --git a/tests/test_config.py b/tests/test_config.py index b8d0aa3..5e766cf 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -1,12 +1,11 @@ -import tox -import pytest -import os, sys -import subprocess +import sys from textwrap import dedent import py +import pytest +import tox import tox._config -from tox._config import * +from tox._config import * # noqa from tox._config import _split_env @@ -110,7 +109,6 @@ class TestConfigPackage: def test_defaults_distshare(self, tmpdir, newconfig): config = newconfig([], "") - envconfig = config.envconfigs['python'] assert config.distshare == config.homedir.join(".tox", "distshare") def test_defaults_changed_dir(self, tmpdir, newconfig): @@ -168,6 +166,7 @@ class TestIniParser: key2={xyz} """) reader = IniReader(config._cfg, fallbacksections=['mydefault']) + assert reader is not None py.test.raises(tox.exception.ConfigError, 'reader.getdefault("mydefault", "key2")') diff --git a/tests/test_interpreters.py b/tests/test_interpreters.py index 39eabc6..f06a69a 100644 --- a/tests/test_interpreters.py +++ b/tests/test_interpreters.py @@ -2,7 +2,7 @@ import sys import os import pytest -from tox.interpreters import * +from tox.interpreters import * # noqa @pytest.fixture def interpreters(): diff --git a/tests/test_venv.py b/tests/test_venv.py index 07b89f4..dbfec41 100644 --- a/tests/test_venv.py +++ b/tests/test_venv.py @@ -3,7 +3,7 @@ import tox import pytest import os, sys import tox._config -from tox._venv import * +from tox._venv import * # noqa #def test_global_virtualenv(capfd): # v = VirtualEnv() @@ -277,7 +277,7 @@ def test_install_command_not_installed(newmocksession, monkeypatch): venv = mocksession.getenv('python') venv.test() mocksession.report.expect("warning", "*test command found but not*") - assert venv.status == "commands failed" + assert venv.status == 0 def test_install_command_whitelisted(newmocksession, monkeypatch): mocksession = newmocksession(['--recreate'], """ @@ -295,7 +295,7 @@ def test_install_command_whitelisted(newmocksession, monkeypatch): assert venv.status == "commands failed" @pytest.mark.skipif("not sys.platform.startswith('linux')") -def test_install_command_not_installed(newmocksession): +def test_install_command_not_installed_bash(newmocksession): mocksession = newmocksession(['--recreate'], """ [testenv] commands= @@ -387,7 +387,7 @@ class TestCreationConfig: [testenv] deps={distshare}/xyz-* """) - xyz = config.distshare.ensure("xyz-1.2.0.zip") + config.distshare.ensure("xyz-1.2.0.zip") xyz2 = config.distshare.ensure("xyz-1.2.1.zip") envconfig = config.envconfigs['python'] venv = VirtualEnv(envconfig, session=mocksession) @@ -507,7 +507,6 @@ def test_setenv_added_to_pcall(tmpdir, mocksession, newconfig): l = mocksession._pcalls assert len(l) == 2 for x in l: - args = x.args env = x.env assert env is not None assert 'ENV_VAR' in env @@ -585,6 +584,7 @@ def test_command_relative_issue26(newmocksession, tmpdir, monkeypatch): mocksession.report.not_expect("warning", "*test command found but not*") monkeypatch.setenv("PATH", str(tmpdir)) x4 = venv.getcommandpath("x", cwd=tmpdir) + assert x4.endswith('/x') mocksession.report.expect("warning", "*test command found but not*") def test_sethome_only_on_option(newmocksession, monkeypatch): diff --git a/tests/test_z_cmdline.py b/tests/test_z_cmdline.py index 343c142..537db5d 100644 --- a/tests/test_z_cmdline.py +++ b/tests/test_z_cmdline.py @@ -1,7 +1,6 @@ import tox import py import pytest -import sys from tox._pytestplugin import ReportExpectMock try: import json @@ -129,7 +128,6 @@ class TestSession: }) config = parseconfig([]) session = Session(config) - envlist = ['hello', 'world'] envs = session.venvlist assert len(envs) == 2 env1, env2 = envs @@ -582,6 +580,7 @@ def test_separate_sdist_no_sdistfile(cmd, initproj): l = distshare.listdir() assert len(l) == 1 sdistfile = l[0] + assert 'pkg123-0.7.zip' in str(sdistfile) def test_separate_sdist(cmd, initproj): distshare = cmd.tmpdir.join("distshare") @@ -611,7 +610,6 @@ def test_sdist_latest(tmpdir, newconfig): distshare=%s sdistsrc={distshare}/pkg123-* """ % distshare) - p0 = distshare.ensure("pkg123-1.3.5.zip") p = distshare.ensure("pkg123-1.4.5.zip") distshare.ensure("pkg123-1.4.5a1.zip") session = Session(config) diff --git a/tox/__init__.py b/tox/__init__.py index 8f0acb1..d7b2155 100644 --- a/tox/__init__.py +++ b/tox/__init__.py @@ -20,4 +20,4 @@ class exception: class MissingDependency(Error): """ a dependency could not be found or determined. """ -from tox._cmdline import main as cmdline +from tox._cmdline import main as cmdline # noqa diff --git a/tox/_cmdline.py b/tox/_cmdline.py index 7c6cd69..192658d 100644 --- a/tox/_cmdline.py +++ b/tox/_cmdline.py @@ -79,7 +79,6 @@ class Action(object): return f def popen(self, args, cwd=None, env=None, redirect=True, returnout=False): - logged_command = "%s$ %s" %(cwd, " ".join(map(str, args))) f = outpath = None resultjson = self.session.config.option.resultjson if resultjson or redirect: @@ -411,7 +410,8 @@ class Session: sdist_path = self._makesdist() except tox.exception.InvocationError: v = sys.exc_info()[1] - self.report.error("FAIL could not package project") + self.report.error("FAIL could not package project - v = %r" % + v) return sdistfile = self.config.distshare.join(sdist_path.basename) if sdistfile != sdist_path: diff --git a/tox/_config.py b/tox/_config.py index 6006fa9..2753780 100644 --- a/tox/_config.py +++ b/tox/_config.py @@ -1,13 +1,10 @@ import argparse -import distutils.sysconfig import os import random import sys import re import shlex import string -import subprocess -import textwrap import pkg_resources from tox.interpreters import Interpreters @@ -205,7 +202,7 @@ def make_hashseed(): class parseini: def __init__(self, config, inipath): config.toxinipath = inipath - config.toxinidir = toxinidir = config.toxinipath.dirpath() + config.toxinidir = config.toxinipath.dirpath() self._cfg = py.iniconfig.IniConfig(config.toxinipath) config._cfg = self._cfg @@ -239,7 +236,7 @@ class parseini: # determine indexserver dictionary config.indexserver = {'default': IndexServerConfig('default')} prefix = "indexserver" - for line in reader.getlist(toxsection, "indexserver"): + for line in reader.getlist(toxsection, prefix): name, url = map(lambda x: x.strip(), line.split("=", 1)) config.indexserver[name] = IndexServerConfig(name, url) diff --git a/tox/_venv.py b/tox/_venv.py index d0f2e64..7e9f45f 100644 --- a/tox/_venv.py +++ b/tox/_venv.py @@ -1,6 +1,5 @@ from __future__ import with_statement -import sys, os, re -import subprocess +import sys, os import py import tox from tox._config import DepConfig @@ -121,8 +120,6 @@ class VirtualEnv(object): """ if action is None: action = self.session.newaction(self, "update") - report = self.session.report - name = self.envconfig.envname rconfig = CreationConfig.readconfig(self.path_config) if not self.envconfig.recreate and rconfig and \ rconfig.matches(self._getliveconfig()): @@ -142,7 +139,8 @@ class VirtualEnv(object): self.install_deps(action) except tox.exception.InvocationError: v = sys.exc_info()[1] - return "could not install deps %s" %(self.envconfig.deps,) + return "could not install deps %s; v = %r" % ( + self.envconfig.deps, v) def _getliveconfig(self): python = self.envconfig._basepython_info.executable diff --git a/tox/_verlib.py b/tox/_verlib.py index 1df3645..a234176 100644 --- a/tox/_verlib.py +++ b/tox/_verlib.py @@ -8,7 +8,6 @@ licensed under the PSF license (i guess) """ -import sys import re class IrrationalVersionError(Exception): diff --git a/tox/interpreters.py b/tox/interpreters.py index e225fcc..5d38929 100644 --- a/tox/interpreters.py +++ b/tox/interpreters.py @@ -1,8 +1,6 @@ import sys -import os import py import re -import subprocess import inspect class Interpreters: -- cgit v1.2.1 -- cgit v1.2.1 From adcb5b45141ad54afb19aea96d1bc979e0909e0d Mon Sep 17 00:00:00 2001 From: Marc Abramowitz Date: Mon, 28 Apr 2014 09:35:11 -0700 Subject: test_quickstart: Use multilines and add comments for better understanding as suggested by Ronny Pfannschmidt at https://bitbucket.org/hpk42/tox/pull-request/99/fix-test_quickstart-failures/diff#comment-1746221 --- tests/test_quickstart.py | 160 ++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 139 insertions(+), 21 deletions(-) diff --git a/tests/test_quickstart.py b/tests/test_quickstart.py index 709fdc6..df8a98f 100644 --- a/tests/test_quickstart.py +++ b/tests/test_quickstart.py @@ -6,6 +6,7 @@ import tox._quickstart def cleandir(tmpdir): tmpdir.chdir() + class TestToxQuickstartMain(object): def mock_term_input_return_values(self, return_values): @@ -23,12 +24,26 @@ class TestToxQuickstartMain(object): return mock_term_input - def test_quickstart_main_choose_individual_pythons_and_pytest(self, - monkeypatch): + def test_quickstart_main_choose_individual_pythons_and_pytest( + self, + monkeypatch): monkeypatch.setattr( tox._quickstart, 'term_input', self.get_mock_term_input( - ['4', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'N', 'py.test', 'pytest'])) + [ + '4', # Python versions: choose one by one + 'Y', # py26 + 'Y', # py27 + 'Y', # py32 + 'Y', # py33 + 'Y', # py34 + 'Y', # pypy + 'N', # jython + 'py.test', # command to run tests + 'pytest' # test dependencies + ] + ) + ) tox._quickstart.main(argv=['tox-quickstart']) @@ -49,11 +64,26 @@ deps = result = open('tox.ini').read() assert(result == expected_tox_ini) - def test_quickstart_main_choose_individual_pythons_and_nose_adds_deps(self, monkeypatch): + def test_quickstart_main_choose_individual_pythons_and_nose_adds_deps( + self, + monkeypatch): monkeypatch.setattr( tox._quickstart, 'term_input', - self.get_mock_term_input(['4', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'N', - 'nosetests', ''])) + self.get_mock_term_input( + [ + '4', # Python versions: choose one by one + 'Y', # py26 + 'Y', # py27 + 'Y', # py32 + 'Y', # py33 + 'Y', # py34 + 'Y', # pypy + 'N', # jython + 'nosetests', # command to run tests + '' # test dependencies + ] + ) + ) tox._quickstart.main(argv=['tox-quickstart']) @@ -74,11 +104,26 @@ deps = result = open('tox.ini').read() assert(result == expected_tox_ini) - def test_quickstart_main_choose_individual_pythons_and_trial_adds_deps(self, monkeypatch): + def test_quickstart_main_choose_individual_pythons_and_trial_adds_deps( + self, + monkeypatch): monkeypatch.setattr( tox._quickstart, 'term_input', - self.get_mock_term_input(['4', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'N', - 'trial', ''])) + self.get_mock_term_input( + [ + '4', # Python versions: choose one by one + 'Y', # py26 + 'Y', # py27 + 'Y', # py32 + 'Y', # py33 + 'Y', # py34 + 'Y', # pypy + 'N', # jython + 'trial', # command to run tests + '' # test dependencies + ] + ) + ) tox._quickstart.main(argv=['tox-quickstart']) @@ -99,11 +144,26 @@ deps = result = open('tox.ini').read() assert(result == expected_tox_ini) - def test_quickstart_main_choose_individual_pythons_and_pytest_adds_deps(self, monkeypatch): + def test_quickstart_main_choose_individual_pythons_and_pytest_adds_deps( + self, + monkeypatch): monkeypatch.setattr( tox._quickstart, 'term_input', - self.get_mock_term_input(['4', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'N', - 'py.test', ''])) + self.get_mock_term_input( + [ + '4', # Python versions: choose one by one + 'Y', # py26 + 'Y', # py27 + 'Y', # py32 + 'Y', # py33 + 'Y', # py34 + 'Y', # pypy + 'N', # jython + 'py.test', # command to run tests + '' # test dependencies + ] + ) + ) tox._quickstart.main(argv=['tox-quickstart']) expected_tox_ini = """ @@ -123,10 +183,19 @@ deps = result = open('tox.ini').read() assert(result == expected_tox_ini) - def test_quickstart_main_choose_py27_and_pytest_adds_deps(self, monkeypatch): + def test_quickstart_main_choose_py27_and_pytest_adds_deps( + self, + monkeypatch): monkeypatch.setattr( tox._quickstart, 'term_input', - self.get_mock_term_input(['1', 'py.test', ''])) + self.get_mock_term_input( + [ + '1', # py27 + 'py.test', # command to run tests + '' # test dependencies + ] + ) + ) tox._quickstart.main(argv=['tox-quickstart']) @@ -147,10 +216,19 @@ deps = result = open('tox.ini').read() assert(result == expected_tox_ini) - def test_quickstart_main_choose_py27_and_py33_and_pytest_adds_deps(self, monkeypatch): + def test_quickstart_main_choose_py27_and_py33_and_pytest_adds_deps( + self, + monkeypatch): monkeypatch.setattr( tox._quickstart, 'term_input', - self.get_mock_term_input(['2', 'py.test', ''])) + self.get_mock_term_input( + [ + '2', # py27 and py33 + 'py.test', # command to run tests + '' # test dependencies + ] + ) + ) tox._quickstart.main(argv=['tox-quickstart']) @@ -171,10 +249,19 @@ deps = result = open('tox.ini').read() assert(result == expected_tox_ini) - def test_quickstart_main_choose_all_pythons_and_pytest_adds_deps(self, monkeypatch): + def test_quickstart_main_choose_all_pythons_and_pytest_adds_deps( + self, + monkeypatch): monkeypatch.setattr( tox._quickstart, 'term_input', - self.get_mock_term_input(['3', 'py.test', ''])) + self.get_mock_term_input( + [ + '3', # all Python versions + 'py.test', # command to run tests + '' # test dependencies + ] + ) + ) tox._quickstart.main(argv=['tox-quickstart']) @@ -195,10 +282,26 @@ deps = result = open('tox.ini').read() assert(result == expected_tox_ini) - def test_quickstart_main_choose_individual_pythons_and_defaults(self, monkeypatch): + def test_quickstart_main_choose_individual_pythons_and_defaults( + self, + monkeypatch): monkeypatch.setattr( tox._quickstart, 'term_input', - self.get_mock_term_input(['4', '', '', '', '', '', '', '', '', '', '', ''])) + self.get_mock_term_input( + [ + '4', # Python versions: choose one by one + '', # py26 + '', # py27 + '', # py32 + '', # py33 + '', # py34 + '', # pypy + '', # jython + '', # command to run tests + '' # test dependencies + ] + ) + ) tox._quickstart.main(argv=['tox-quickstart']) @@ -228,7 +331,22 @@ deps = monkeypatch.setattr( tox._quickstart, 'term_input', - self.get_mock_term_input(['4', '', '', '', '', '', '', '', '', '', '', ''])) + self.get_mock_term_input( + [ + '4', # Python versions: choose one by one + '', # py26 + '', # py27 + '', # py32 + '', # py33 + '', # py34 + '', # pypy + '', # jython + '', # command to run tests + '', # test dependencies + '', # tox.ini already exists; overwrite? + ] + ) + ) tox._quickstart.main(argv=['tox-quickstart']) -- cgit v1.2.1 From 3bd552c799ea29f90eb6a759cd4270a9681bc55d Mon Sep 17 00:00:00 2001 From: Alexandre Conrad Date: Wed, 30 Apr 2014 17:22:37 -0700 Subject: make test more specific, less prone to failures Checking for the non-existence of the string "virtualenv" could fail because paths may contain the word virtualenv. --- tests/test_z_cmdline.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_z_cmdline.py b/tests/test_z_cmdline.py index 537db5d..2e10c24 100644 --- a/tests/test_z_cmdline.py +++ b/tests/test_z_cmdline.py @@ -565,7 +565,7 @@ def test_sdistonly(initproj, cmd): result.stdout.fnmatch_lines([ "*sdist-make*setup.py*", ]) - assert "virtualenv" not in result.stdout.str() + assert "-mvirtualenv" not in result.stdout.str() def test_separate_sdist_no_sdistfile(cmd, initproj): distshare = cmd.tmpdir.join("distshare") -- cgit v1.2.1 From ecd8e2fc9d278b099464e8b835e31146971eaa9b Mon Sep 17 00:00:00 2001 From: Alexandre Conrad Date: Wed, 30 Apr 2014 23:17:45 -0700 Subject: support skipping interpreters if any are missing This implements the option --skip-missing-interpreters. If this option is passed to tox, the tests won't fail if interpreters are missing. The exit status will be 0 if all tests pass but interpreters were missing. --- tests/test_z_cmdline.py | 16 ++++++++++++++++ tox/_cmdline.py | 12 +++++++++++- tox/_config.py | 2 ++ 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/tests/test_z_cmdline.py b/tests/test_z_cmdline.py index 537db5d..6d2575f 100644 --- a/tests/test_z_cmdline.py +++ b/tests/test_z_cmdline.py @@ -229,6 +229,22 @@ def test_unknown_interpreter(cmd, initproj): "*ERROR*InterpreterNotFound*xyz_unknown_interpreter*", ]) +def test_skip_unknown_interpreter(cmd, initproj): + initproj("interp123-0.5", filedefs={ + 'tests': {'test_hello.py': "def test_hello(): pass"}, + 'tox.ini': ''' + [testenv:python] + basepython=xyz_unknown_interpreter + [testenv] + changedir=tests + ''' + }) + result = cmd.run("tox", "--skip-missing-interpreters") + assert not result.ret + result.stdout.fnmatch_lines([ + "*SKIPPED*InterpreterNotFound*xyz_unknown_interpreter*", + ]) + def test_unknown_dep(cmd, initproj): initproj("dep123-0.7", filedefs={ 'tests': {'test_hello.py': "def test_hello(): pass"}, diff --git a/tox/_cmdline.py b/tox/_cmdline.py index 192658d..5d58a18 100644 --- a/tox/_cmdline.py +++ b/tox/_cmdline.py @@ -222,6 +222,9 @@ class Reporter(object): def error(self, msg): self.logline("ERROR: " + msg, red=True) + def skip(self, msg): + self.logline("SKIPPED:" + msg, yellow=True) + def logline(self, msg, **opts): self._reportedlines.append(msg) self.tw.line("%s" % msg, **opts) @@ -461,7 +464,14 @@ class Session: retcode = 0 for venv in self.venvlist: status = venv.status - if status and status != "skipped tests": + if isinstance(status, tox.exception.InterpreterNotFound): + msg = " %s: %s" %(venv.envconfig.envname, str(status)) + if self.config.option.skip_missing_interpreters: + self.report.skip(msg) + else: + retcode = 1 + self.report.error(msg) + elif status and status != "skipped tests": msg = " %s: %s" %(venv.envconfig.envname, str(status)) self.report.error(msg) retcode = 1 diff --git a/tox/_config.py b/tox/_config.py index 2753780..57df84d 100644 --- a/tox/_config.py +++ b/tox/_config.py @@ -129,6 +129,8 @@ def prepare_parse(pkgname): "'pytest<2.7' or 'django>=1.6'.") parser.add_argument("--sitepackages", action="store_true", help="override sitepackages setting to True in all envs") + parser.add_argument("--skip-missing-interpreters", action="store_true", + help="don't fail tests for missing interpreters") parser.add_argument("args", nargs="*", help="additional arguments available to command positional substitution") -- cgit v1.2.1 From 33f11ebdcbe4da15449fcaac3ef6e3a7f4839a12 Mon Sep 17 00:00:00 2001 From: Alexandre Conrad Date: Thu, 1 May 2014 12:12:42 -0700 Subject: update CHANGELOG and CONTRIBUTORS --- CHANGELOG | 6 ++++++ CONTRIBUTORS | 1 + 2 files changed, 7 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index e6168cb..99b24c9 100755 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,9 @@ +development +----------- + +- fix issue59: add option "--skip-missing-interpreters" which won't fail the + build if Python interpreters listed in tox.ini are missing. + 1.7.1 --------- diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 0244c2b..74557f6 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -23,3 +23,4 @@ Matt Good Mattieu Agopian Asmund Grammeltwedt Ionel Maries Cristian +Alexandre Conrad -- cgit v1.2.1 From 9805f6fbaad6724df1bd168e60dd955519d0fe68 Mon Sep 17 00:00:00 2001 From: Marc Abramowitz Date: Thu, 1 May 2014 14:18:18 -0700 Subject: .hgignore: Ignore .cache dir created by flakes --- .hgignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgignore b/.hgignore index cf24d86..8cacf58 100644 --- a/.hgignore +++ b/.hgignore @@ -14,3 +14,4 @@ dist doc/_build/ tox.egg-info .tox +.cache -- cgit v1.2.1 From d3e444560eb36b9c69f35eeb3fb9174a1498e3cc Mon Sep 17 00:00:00 2001 From: holger krekel Date: Thu, 8 May 2014 21:04:03 +0200 Subject: fix issue59 -- add --skip-if-missing-interpreter. Thanks Alexandre Conrad for the PR. --- CHANGELOG | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 99b24c9..8afc346 100755 --- a/CHANGELOG +++ b/CHANGELOG @@ -2,7 +2,8 @@ development ----------- - fix issue59: add option "--skip-missing-interpreters" which won't fail the - build if Python interpreters listed in tox.ini are missing. + build if Python interpreters listed in tox.ini are missing. Thanks + Alexandre Conrad for the PR. 1.7.1 --------- -- cgit v1.2.1