diff options
| author | holger krekel <holger@merlinux.eu> | 2011-04-28 18:20:11 +0200 |
|---|---|---|
| committer | holger krekel <holger@merlinux.eu> | 2011-04-28 18:20:11 +0200 |
| commit | 077260a8a5b413029bc494ee0557e7ccbc88344d (patch) | |
| tree | 954045b54d5c7d6bbe990c3e52af8842fa6115d2 | |
| parent | 07e475358b3dbddca24eaa16af8c79fb50d73708 (diff) | |
| parent | 01f1f80b3c1ac8e1600ff77f78e7e0f01a0c3c19 (diff) | |
| download | tox-077260a8a5b413029bc494ee0557e7ccbc88344d.tar.gz | |
merge Chris Rose changes and enhancements/fixes to issue10 and 15
| -rw-r--r-- | CHANGELOG.txt | 10 | ||||
| -rw-r--r-- | CONTRIBUTORS | 6 | ||||
| -rw-r--r-- | doc/announce/release-0.5.txt | 2 | ||||
| -rw-r--r-- | doc/config.txt | 2 | ||||
| -rw-r--r-- | doc/example/basic.txt | 1 | ||||
| -rw-r--r-- | doc/example/general.txt | 4 | ||||
| -rw-r--r-- | doc/example/jenkins.txt (renamed from doc/example/hudson.txt) | 44 | ||||
| -rw-r--r-- | doc/examples.txt | 2 | ||||
| -rw-r--r-- | doc/index.txt | 9 | ||||
| -rw-r--r-- | doc/links.txt | 2 | ||||
| -rw-r--r-- | setup.py | 6 | ||||
| -rw-r--r-- | tests/test_config.py | 6 | ||||
| -rw-r--r-- | tests/test_venv.py | 20 | ||||
| -rw-r--r-- | tox.ini | 2 | ||||
| -rw-r--r-- | tox/__init__.py | 2 | ||||
| -rw-r--r-- | tox/_cmdline.py | 9 | ||||
| -rw-r--r-- | tox/_config.py | 4 | ||||
| -rw-r--r-- | tox/_venv.py | 11 | ||||
| -rw-r--r-- | toxbootstrap.py | 15 |
19 files changed, 86 insertions, 71 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt index ebd8bd6..13f19e9 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,9 +1,17 @@ -0.9.1 +1.0.dev ----------------- - require virtualenv-1.5.1 as to make pypy-1.4 work +- fix issue14: report errors related to test command +- fix issue20: document format of URLs for specifying dependencies +- fix issue19: substitute Hudson for Jenkins everywhere following the renaming + of the project. NOTE: if you used the special [tox:jenkins] + section it will now need to be named [tox:jenkins]. +- fix issue 23 / apply some ReST fixes +- added a CONTRIBUTORS file - change the positional argument specifier to use {posargs:} syntax - Fix issues #15 and #10 with changes to the argument parsing method + (many thanks to Chris Rose) 0.9 ----------------- diff --git a/CONTRIBUTORS b/CONTRIBUTORS new file mode 100644 index 0000000..5586ed9 --- /dev/null +++ b/CONTRIBUTORS @@ -0,0 +1,6 @@ + +contributions (under the MIT license): + +Sridhar Ratnakumar +Jannis Leidl +Chris Rose diff --git a/doc/announce/release-0.5.txt b/doc/announce/release-0.5.txt index e770566..8a1239e 100644 --- a/doc/announce/release-0.5.txt +++ b/doc/announce/release-0.5.txt @@ -12,7 +12,7 @@ from a simple ``tox.ini`` file, including: * testing packages against each other without needing to upload to PyPI ``tox`` runs well on Python2.4 up until Python3.1 and integrates -well with Continous Integration servers Hudson. There are many +well with Continous Integration servers Jenkins. There are many real-life examples and a good chunk of docs. Read it up on http://codespeak.net/tox diff --git a/doc/config.txt b/doc/config.txt index 62ab6b7..5cef3e2 100644 --- a/doc/config.txt +++ b/doc/config.txt @@ -214,6 +214,8 @@ does not exist. substitutions for positional arguments in commands ++++++++++++++++++++++++++++++++++++++++++++++++++++++ +.. versionadded:: 1.0 + If you specify a substitution string like this:: {posargs:DEFAULTS} diff --git a/doc/example/basic.txt b/doc/example/basic.txt index 3ceeb87..9bf0b68 100644 --- a/doc/example/basic.txt +++ b/doc/example/basic.txt @@ -103,3 +103,4 @@ To for tox to recreate a (particular) virtual environment:: would trigger a complete reinstallation of the existing py27 environment (or create it afresh if it doesn't exist). + diff --git a/doc/example/general.txt b/doc/example/general.txt index f8c316e..2cee354 100644 --- a/doc/example/general.txt +++ b/doc/example/general.txt @@ -99,7 +99,7 @@ Access package artifacts between multiple tox-runs If you have multiple projects using tox you can make use of a ``distshare`` directory where ``tox`` will copy in sdist-packages so that another tox run can find the "latest" dependency. This feature -allows to to test a package against an unreleased development version +allows to test a package against an unreleased development version or even an uncommitted version on your own machine. By default, ``{homedir}/.tox/distshare`` will be used for @@ -120,7 +120,7 @@ into the ``distshare`` directory after which a ``tox`` run on project highest version will be taken. ``tox`` uses verlib_ to compare version strings which must be compliant with :pep:`386`. -If you want to use this with Hudson_, also checkout the :ref:`hudson artifact example`. +If you want to use this with Jenkins_, also checkout the :ref:`jenkins artifact example`. .. _verlib: http://bitbucket.org/tarek/distutilsversion/ diff --git a/doc/example/hudson.txt b/doc/example/jenkins.txt index d0a1691..ad26f60 100644 --- a/doc/example/hudson.txt +++ b/doc/example/jenkins.txt @@ -1,23 +1,23 @@ -Using Tox with the Hudson Integration Server +Using Tox with the Jenkins Integration Server ================================================= -Using Hudson multi-configuration jobs +Using Jenkins multi-configuration jobs ------------------------------------------- -The Hudson_ continous integration server allows to define "jobs" with +The Jenkins_ continous integration server allows to define "jobs" with "build steps" which can be test invocations. If you :doc:`install <../install>` ``tox`` on your -default Python installation on each Hudson slave, you can easily create -a Hudson multi-configuration job that will drive your tox runs from the CI-server side, +default Python installation on each Jenkins slave, you can easily create +a Jenkins multi-configuration job that will drive your tox runs from the CI-server side, using these steps: * create a "multi-configuration" job, give it a name of your choice -* configure your repository so that Hudson can pull it +* configure your repository so that Jenkins can pull it * (optional) configure multiple nodes so that tox-runs are performed on multiple hosts * configure ``axes`` by using :ref:`TOXENV <TOXENV>` as an axis name and as values provide space-separated test environment names - you want Hudson/tox to execute. + you want Jenkins/tox to execute. * add a **Python-build step** with this content (see also next example):: @@ -25,7 +25,7 @@ using these steps: tox.cmdline() # environment is selected by ``TOXENV`` env variable * check ``Publish JUnit test result report`` and enter - ``**/junit-*.xml`` as the pattern so that Hudson collects + ``**/junit-*.xml`` as the pattern so that Jenkins collects test results in the JUnit XML format. The last point requires that your test command creates JunitXML files, @@ -33,16 +33,16 @@ for example with ``py.test`` it is done like this: commands=py.test --junitxml=junit-{envname}.xml -See a real-life example in action with the `pytest Hudson job`_ +See a real-life example in action with the `pytest Jenkins job`_ -.. _`pytest Hudson job`: http://hudson.testrun.org/view/pytest/job/pytest/ +.. _`pytest Jenkins job`: http://jenkins.testrun.org/view/pytest/job/pytest/ **zero-installation** for slaves ------------------------------------------------------------- .. versionadded:: 0.9 -If you manage many Hudson slaves and want to use the latest officially +If you manage many Jenkins slaves and want to use the latest officially released tox (or latest development version) and want to skip manually installing ``tox`` then substitute the above **Python build step** code with this:: @@ -67,10 +67,10 @@ install ``tox`` in a virtual sub environment. Notes: .. _`toxbootstrap.py`: https://pytox.googlecode.com/hg/toxbootstrap.py -Integrating "sphinx" documentation checks in a Hudson job +Integrating "sphinx" documentation checks in a Jenkins job ---------------------------------------------------------------- -If you are using a multi-configuration Hudson job which collects +If you are using a multi-configuration Jenkins job which collects JUnit Test results you will run into problems using the previous method of running the sphinx-build command because it will not generate JUnit results. To accomodate this issue one solution @@ -106,27 +106,27 @@ Here is an example: "-d", str(doctrees), ".", str(htmldir)]) 3. run ``tox -e docs`` and then you may integrate this environment - along with your other environments into Hudson. + along with your other environments into Jenkins. Note that ``py.test`` is only installed into the docs environment and does not need to be in use or installed with any other environment. -.. _`hudson artifact example`: +.. _`jenkins artifact example`: -Access package artifacts between Hudson jobs +Access package artifacts between Jenkins jobs -------------------------------------------------------- -.. _`Hudson Copy Artifact plugin`: http://wiki.hudson-ci.org/display/HUDSON/Copy+Artifact+Plugin +.. _`Jenkins Copy Artifact plugin`: http://wiki.jenkins-ci.org/display/HUDSON/Copy+Artifact+Plugin -In an extension to :ref:`artifacts` you can also configure Hudson jobs to +In an extension to :ref:`artifacts` you can also configure Jenkins jobs to access each others artifacts. ``tox`` uses the ``distshare`` directory -to access artifacts and in a Hudson context (detected via existence +to access artifacts and in a Jenkins context (detected via existence of the environment variable ``HUDSON_URL``); it defaults to to ``{toxworkdir}/distshare``. This means that each workspace will have its own ``distshare`` -directory and we need to configure Hudson to perform artifact copying. -The recommend way to do this is to install the `Hudson Copy Artifact plugin`_ +directory and we need to configure Jenkins to perform artifact copying. +The recommend way to do this is to install the `Jenkins Copy Artifact plugin`_ and for each job which "receives" artifacts you add a **Copy artifacts from another project** build step using roughly this configuration:: Project-name: name of the other (tox-managed) job you want the artifact from @@ -145,7 +145,7 @@ Now everything proceeds as :ref:`artifacts` shows it. So if you are using defaults you can re-use and debug exactly the same ``tox.ini`` file and make use of automatical sharing of -your artifacts between runs or Hudson jobs. +your artifacts between runs or Jenkins jobs. .. include:: ../links.txt diff --git a/doc/examples.txt b/doc/examples.txt index ec40dfa..523a211 100644 --- a/doc/examples.txt +++ b/doc/examples.txt @@ -10,5 +10,5 @@ tox configuration and usage examples example/unittest example/nose.txt example/general.txt - example/hudson.txt + example/jenkins.txt diff --git a/doc/index.txt b/doc/index.txt index f3305fa..1b496db 100644 --- a/doc/index.txt +++ b/doc/index.txt @@ -61,7 +61,7 @@ Current features - installs your ``setup.py`` based project into each virtual environment - - test-tool agnostic: runs py.test, nose or unittests a uniform manner + - test-tool agnostic: runs py.test, nose or unittests in a uniform manner * supports :ref:`using different / multiple PyPI index servers <multiindex>` @@ -72,11 +72,12 @@ Current features * **cross-platform**: Windows and Unix style environments -* **integrates with continous integration servers** like Hudson_ and helps - you to avoid boilerplatish and platform-specific build-step hacks. +* **integrates with continous integration servers** like Jenkins_ + (formerly known as Hudson) and helps you to avoid boilerplatish + and platform-specific build-step hacks. * **unified automatic artifact management** between ``tox`` runs both - in a local developer shell as well as in a CI/Hudson context. + in a local developer shell as well as in a CI/Jenkins context. * **driven by a simple ini-style config file** diff --git a/doc/links.txt b/doc/links.txt index 0f5b744..f1f979f 100644 --- a/doc/links.txt +++ b/doc/links.txt @@ -13,7 +13,7 @@ .. _pip: http://pypi.python.org/pypi/pip .. _setuptools: http://pypi.python.org/pypi/setuptools .. _distribute: http://pypi.python.org/pypi/distribute -.. _`hudson`: http://hudson-ci.org/ +.. _`jenkins`: http://jenkins-ci.org/ .. _sphinx: http://pypi.python.org/pypi/Sphinx .. _discover: http://pypi.python.org/pypi/discover .. _unittest2: http://pypi.python.org/pypi/unittest2 @@ -27,15 +27,13 @@ http://codespeak.net/tox def main(): - install_requires=['virtualenv5>=1.3.4.5'] - if sys.version_info[0] < 3: - install_requires+=['virtualenv>=1.5.1'] + install_requires=['virtualenv>=1.6'] setup( name='tox', description='virtualenv-based automation of test activities', long_description=long_description, url='http://codespeak.net/tox', - version='0.9.1.dev1', + version='0.9.1.dev4', license='GPLv2 or later', platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'], author='holger krekel', diff --git a/tests/test_config.py b/tests/test_config.py index a878178..e4e49e3 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -445,7 +445,7 @@ class TestGlobalOptions: config = newconfig(["-vv"], "") assert config.opts.verbosity == 2 - def test_substitution_hudson_default(self, tmpdir, monkeypatch, newconfig): + def test_substitution_jenkins_default(self, tmpdir, monkeypatch, newconfig): monkeypatch.setenv("HUDSON_URL", "xyz") config = newconfig(""" [testenv:py24] @@ -457,11 +457,11 @@ class TestGlobalOptions: expect_path = config.toxworkdir.join("distshare") assert argv[0][0] == expect_path - def test_substitution_hudson_context(self, tmpdir, monkeypatch, newconfig): + def test_substitution_jenkins_context(self, tmpdir, monkeypatch, newconfig): monkeypatch.setenv("HUDSON_URL", "xyz") monkeypatch.setenv("WORKSPACE", tmpdir) config = newconfig(""" - [tox:hudson] + [tox:jenkins] distshare = {env:WORKSPACE}/hello [testenv:py24] commands = diff --git a/tests/test_venv.py b/tests/test_venv.py index 145a901..953e220 100644 --- a/tests/test_venv.py +++ b/tests/test_venv.py @@ -45,11 +45,6 @@ def test_getsupportedinterpreter(monkeypatch, newconfig, mocksession): interp = venv.getsupportedinterpreter() assert interp == sys.executable monkeypatch.setattr(sys, 'platform', "win32") - monkeypatch.setattr(venv.envconfig, 'basepython', 'python3') - py.test.raises(tox.exception.UnsupportedInterpreter, - venv.getsupportedinterpreter) - monkeypatch.undo() - monkeypatch.setattr(sys, 'platform', "win32") monkeypatch.setattr(venv.envconfig, 'basepython', 'jython') py.test.raises(tox.exception.UnsupportedInterpreter, venv.getsupportedinterpreter) @@ -199,6 +194,17 @@ def test_install_recreate(newmocksession): mocksession.report.expect("action", "*creating virtualenv*") venv.update() mocksession.report.expect("action", "recreating virtualenv*") + +def test_install_error(newmocksession): + mocksession = newmocksession(['--recreate'], """ + [testenv] + deps=xyz + commands= + qwelkqw + """) + venv = mocksession.getenv('python') + venv.test() + mocksession.report.expect("error", "*not find*qwelkqw*") def test_install_python3(tmpdir, newmocksession): if not py.path.local.sysfind('python3.1'): @@ -215,12 +221,12 @@ def test_install_python3(tmpdir, newmocksession): l = mocksession._pcalls assert len(l) == 1 args = l[0].args - assert 'virtualenv5' in args[0] + assert 'virtualenv' in args[0] l[:] = [] venv._install(["hello"]) assert len(l) == 1 args = l[0].args - assert 'easy_install' in str(args[0]) + assert 'pip' in str(args[0]) for x in args: assert "--download-cache" not in args, args @@ -7,7 +7,7 @@ indexserver = [testenv] commands=py.test --junitxml={envlogdir}/junit-{envname}.xml [] -deps=:testrun:pytest +deps=pytest [testenv:py27-xdist] commands=py.test -n5 --junitxml={envlogdir}/junit-{envname}.xml [] diff --git a/tox/__init__.py b/tox/__init__.py index ce9dfc3..7e18c15 100644 --- a/tox/__init__.py +++ b/tox/__init__.py @@ -1,5 +1,5 @@ # -__version__ = '0.9.1.dev1' +__version__ = '0.9.1.dev4' from py.apipkg import initpkg diff --git a/tox/_cmdline.py b/tox/_cmdline.py index 9f42db6..8a166e5 100644 --- a/tox/_cmdline.py +++ b/tox/_cmdline.py @@ -1,8 +1,8 @@ """ Automatically package and test a Python project against configurable Python2 and Python3 based virtual environments. Environments are -setup by using virtualenv and virtualenv5 respectively. Configuration -is generally done through an INI-style "tox.ini" file. +setup by using virtualenv. Configuration is generally done through an +INI-style "tox.ini" file. """ import tox import py @@ -247,9 +247,8 @@ class Session: def info_versions(self): versions = ['tox-%s' % tox.__version__] - for tool in ('virtualenv', 'virtualenv5'): - version = py.process.cmdexec("%s --version" % tool) - versions.append("%s-%s" %(tool, version.strip())) + version = py.process.cmdexec("virtualenv --version") + versions.append("virtualenv-%s" % version.strip()) self.report.keyvalue("tool-versions:", " ".join(versions)) def pcall(self, args, log=None, cwd=None, env=None): diff --git a/tox/_config.py b/tox/_config.py index 98419d9..5d79ee9 100644 --- a/tox/_config.py +++ b/tox/_config.py @@ -114,7 +114,7 @@ class parseini: config._cfg = self._cfg self.config = config ctxname = getcontextname() - if ctxname == "hudson": + if ctxname == "jenkins": reader = IniReader(self._cfg, fallbacksections=['tox']) toxsection = "tox:%s" % ctxname distshare_default = "{toxworkdir}/distshare" @@ -526,5 +526,5 @@ class CommandParser(object): def getcontextname(): if 'HUDSON_URL' in os.environ: - return 'hudson' + return 'jenkins' return None diff --git a/tox/_venv.py b/tox/_venv.py index f5bb3a3..fa0cbf9 100644 --- a/tox/_venv.py +++ b/tox/_venv.py @@ -138,9 +138,6 @@ class VirtualEnv(object): return x def getsupportedinterpreter(self): - if sys.platform == "win32" and self._ispython3(): - raise tox.exception.UnsupportedInterpreter( - "python3/virtualenv3 is buggy on windows") if sys.platform == "win32" and self.envconfig.basepython and \ "jython" in self.envconfig.basepython: raise tox.exception.UnsupportedInterpreter( @@ -154,7 +151,7 @@ class VirtualEnv(object): #if self.getcommandpath("activate").dirpath().check(): # return config_interpreter = self.getsupportedinterpreter() - args = ['virtualenv' + (self._ispython3() and "5" or "")] + args = ['virtualenv'] if not self._ispython3() and self.envconfig.distribute: args.append('--distribute') if not self.envconfig.sitepackages: @@ -229,10 +226,7 @@ class VirtualEnv(object): for repo in l: args = d[repo] - if self._ispython3(): - self.easy_install(args, repo) - else: - self.pip_install(args, repo) + self.pip_install(args, repo) def test(self): self.session.make_emptydir(self.envconfig.envtmpdir) @@ -241,6 +235,7 @@ class VirtualEnv(object): try: self._pcall(argv, log=-1, cwd=cwd) except tox.exception.InvocationError: + self.session.report.error(str(sys.exc_info()[1])) return True def _pcall(self, args, venv=True, log=None, cwd=None): diff --git a/toxbootstrap.py b/toxbootstrap.py index be25ceb..c54861c 100644 --- a/toxbootstrap.py +++ b/toxbootstrap.py @@ -23,9 +23,9 @@ tox-bootstrap ============= A bootstrap script to automatically install tox on machines that do not already -have it. This is especially useful when configuring a number of Hudson slaves +have it. This is especially useful when configuring a number of Jenkins slaves quickly (see `zero installation for slaves -<http://codespeak.net/tox/example/hudson.html#zero-installation-for-slaves>` in +<http://codespeak.net/tox/example/jenkins.html#zero-installation-for-slaves>` in tox documentation); only Python needs to be pre-installed. Getting started @@ -44,8 +44,8 @@ will take care of installing tox (if not already installed into $ python toxbootstrap.py -Note that, when configuring Hudson slaves, you need not add `toxbootstrap.py` to -your source tree; see the above linked Hudson configuration example in tox +Note that, when configuring Jenkins slaves, you need not add `toxbootstrap.py` to +your source tree; see the above linked Jenkins configuration example in tox documentation. ToDo @@ -58,7 +58,7 @@ ToDo """ -__version__ = '0.9.1.dev1' +__version__ = '0.9.1.dev4' import sys import os @@ -82,9 +82,8 @@ else: logging.basicConfig(level=logging.INFO) -# Last stable: 1.5.1 -VIRTUALENVPY_URL = ( - 'http://bitbucket.org/ianb/virtualenv/raw/eb94c9ebe0ba/virtualenv.py') +# Last stable: 1.6 (now on github) +VIRTUALENVPY_URL = ('https://github.com/pypa/virtualenv/raw/master/virtualenv.py') def run(cmd, shell=True): """Run the given command in shell""" |
