Commits

holger krekel committed b4c2adf Merge

merge Chris Rose changes and enhancements/fixes to issue10 and 15

Comments (0)

Files changed (20)

-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
 -----------------
+
+contributions (under the MIT license):
+
+Sridhar Ratnakumar
+Jannis Leidl
+Chris Rose

doc/announce/release-0.5.txt

 * 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
 substitutions for positional arguments in commands
 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
+.. versionadded:: 1.0
+
 If you specify a substitution string like this::
 
     {posargs:DEFAULTS}

doc/example/basic.txt

 
 would trigger a complete reinstallation of the existing py27 environment
 (or create it afresh if it doesn't exist).
+

doc/example/general.txt

 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
 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/
 

doc/example/hudson.txt

-
-Using Tox with the Hudson Integration Server
-=================================================
-
-Using Hudson multi-configuration jobs
--------------------------------------------
-
-The Hudson_ 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,
-using these steps:
-
-* create a "multi-configuration" job, give it a name of your choice
-* configure your repository so that Hudson 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.
-
-* add a **Python-build step** with this content (see also next example)::
-
-    import tox
-    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
-  test results in the JUnit XML format.
-
-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
-
-See a real-life example in action with the `pytest Hudson job`_
-
-.. _`pytest Hudson job`: http://hudson.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
-released tox (or latest development version) and want to skip manually
-installing ``tox`` then substitute the above **Python build step** code
-with this::
-
-    import urllib, os
-    url = "https://pytox.googlecode.com/hg/toxbootstrap.py"
-    #os.environ['USETOXDEV']="1"  # use tox dev version
-    d = dict(__file__='toxbootstrap.py')
-    exec urllib.urlopen(url).read() in d
-    d['cmdline'](['--recreate'])
-
-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
-  development-release version of tox instead of the
-  latest released version.
-
-* adapt the options in the last line as needed (the example code
-  will cause tox to reinstall all virtual environments all the time
-  which is often what one wants in CI server contexts)
-
-.. _`toxbootstrap.py`: https://pytox.googlecode.com/hg/toxbootstrap.py
-
-Integrating "sphinx" documentation checks in a Hudson job
-----------------------------------------------------------------
-
-If you are using a multi-configuration Hudson 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
-is to have ``py.test`` wrap the sphinx-checks and create a
-JUnit result file which wraps the result of calling sphinx-build.
-Here is an example:
-
-1. create a ``docs`` environment in your ``tox.ini`` file like this::
-
-    [testenv:docs]
-    basepython=python
-    changedir=doc # or whereever you keep your sphinx-docs
-    deps=sphinx
-        py
-    commands=
-        py.test --tb=line -v --junitxml=junit-{envname}.xml check_sphinx.py
-
-2. create a ``doc/check_sphinx.py`` file like this::
-
-    import py
-    import subprocess
-    def test_linkcheck(tmpdir):
-        doctrees = tmpdir.join("doctrees")
-        htmldir = tmpdir.join("html")
-        subprocess.check_call(
-            ["sphinx-build", "-W", "-blinkcheck",
-              "-d", str(doctrees), ".", str(htmldir)])
-    def test_build_docs(tmpdir):
-        doctrees = tmpdir.join("doctrees")
-        htmldir = tmpdir.join("html")
-        subprocess.check_call([
-            "sphinx-build", "-W", "-bhtml",
-              "-d", str(doctrees), ".", str(htmldir)])
-
-3. run ``tox -e docs`` and then you may integrate this environment
-   along with your other environments into Hudson.
-
-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`:
-
-Access package artifacts between Hudson jobs
---------------------------------------------------------
-
-.. _`Hudson Copy Artifact plugin`: http://wiki.hudson-ci.org/display/HUDSON/Copy+Artifact+Plugin
-
-In an extension to :ref:`artifacts` you can also configure Hudson jobs to
-access each others artifacts.  ``tox`` uses the ``distshare`` directory
-to access artifacts and in a Hudson 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`_
-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
-    Artifacts to copy: .tox/dist/*.zip   # where tox jobs create artifacts
-    Target directory: .tox/distshare     # where we want it to appear for us
-    Flatten Directories: CHECK           # create no subdir-structure
-
-You also need to configure the "other" job to archive artifacts; This
-is done by checking ``Archive the artifacts`` and entering::
-
-    Files to archive: .tox/dist/*.zip
-
-So our "other" job will create an sdist-package artifact and
-the "copy-artifacts" plugin will copy it to our ``distshare`` area.
-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.
-
-.. include:: ../links.txt
-
-

doc/example/jenkins.txt

+
+Using Tox with the Jenkins Integration Server
+=================================================
+
+Using Jenkins multi-configuration jobs
+-------------------------------------------
+
+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 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 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 Jenkins/tox to execute.
+
+* add a **Python-build step** with this content (see also next example)::
+
+    import tox
+    tox.cmdline() # environment is selected by ``TOXENV`` env variable
+
+* check ``Publish JUnit test result report`` and enter
+  ``**/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,
+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 Jenkins job`_
+
+.. _`pytest Jenkins job`: http://jenkins.testrun.org/view/pytest/job/pytest/
+
+**zero-installation** for slaves
+-------------------------------------------------------------
+
+.. versionadded:: 0.9
+
+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::
+
+    import urllib, os
+    url = "https://pytox.googlecode.com/hg/toxbootstrap.py"
+    #os.environ['USETOXDEV']="1"  # use tox dev version
+    d = dict(__file__='toxbootstrap.py')
+    exec urllib.urlopen(url).read() in d
+    d['cmdline'](['--recreate'])
+
+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
+  development-release version of tox instead of the
+  latest released version.
+
+* adapt the options in the last line as needed (the example code
+  will cause tox to reinstall all virtual environments all the time
+  which is often what one wants in CI server contexts)
+
+.. _`toxbootstrap.py`: https://pytox.googlecode.com/hg/toxbootstrap.py
+
+Integrating "sphinx" documentation checks in a Jenkins job
+----------------------------------------------------------------
+
+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
+is to have ``py.test`` wrap the sphinx-checks and create a
+JUnit result file which wraps the result of calling sphinx-build.
+Here is an example:
+
+1. create a ``docs`` environment in your ``tox.ini`` file like this::
+
+    [testenv:docs]
+    basepython=python
+    changedir=doc # or whereever you keep your sphinx-docs
+    deps=sphinx
+        py
+    commands=
+        py.test --tb=line -v --junitxml=junit-{envname}.xml check_sphinx.py
+
+2. create a ``doc/check_sphinx.py`` file like this::
+
+    import py
+    import subprocess
+    def test_linkcheck(tmpdir):
+        doctrees = tmpdir.join("doctrees")
+        htmldir = tmpdir.join("html")
+        subprocess.check_call(
+            ["sphinx-build", "-W", "-blinkcheck",
+              "-d", str(doctrees), ".", str(htmldir)])
+    def test_build_docs(tmpdir):
+        doctrees = tmpdir.join("doctrees")
+        htmldir = tmpdir.join("html")
+        subprocess.check_call([
+            "sphinx-build", "-W", "-bhtml",
+              "-d", str(doctrees), ".", str(htmldir)])
+
+3. run ``tox -e docs`` and then you may integrate this environment
+   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.
+
+.. _`jenkins artifact example`:
+
+Access package artifacts between Jenkins jobs
+--------------------------------------------------------
+
+.. _`Jenkins Copy Artifact plugin`: http://wiki.jenkins-ci.org/display/HUDSON/Copy+Artifact+Plugin
+
+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 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 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
+    Artifacts to copy: .tox/dist/*.zip   # where tox jobs create artifacts
+    Target directory: .tox/distshare     # where we want it to appear for us
+    Flatten Directories: CHECK           # create no subdir-structure
+
+You also need to configure the "other" job to archive artifacts; This
+is done by checking ``Archive the artifacts`` and entering::
+
+    Files to archive: .tox/dist/*.zip
+
+So our "other" job will create an sdist-package artifact and
+the "copy-artifacts" plugin will copy it to our ``distshare`` area.
+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 Jenkins jobs.
+
+.. include:: ../links.txt
+
+
    example/unittest
    example/nose.txt
    example/general.txt
-   example/hudson.txt
+   example/jenkins.txt
 
 
     - 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>`
 
 
 * **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**
 
 .. _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
 
 
 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',

tests/test_config.py

         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]
         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 =

tests/test_venv.py

     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)
     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'):
     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
 
 
 [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 []
 #
-__version__ = '0.9.1.dev1'
+__version__ = '0.9.1.dev4'
 
 from py.apipkg import initpkg
 
 """
 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
 
     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):
         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"
 
 def getcontextname():
     if 'HUDSON_URL' in os.environ:
-        return 'hudson'
+        return 'jenkins'
     return None
         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(
         #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:
 
         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)
             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):
 =============
 
 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
 
     $ 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
 
 """
 
-__version__ = '0.9.1.dev1'
+__version__ = '0.9.1.dev4'
 
 import sys
 import os
 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"""
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.