diff options
Diffstat (limited to 'doc/example/basic.txt')
-rw-r--r-- | doc/example/basic.txt | 44 |
1 files changed, 40 insertions, 4 deletions
diff --git a/doc/example/basic.txt b/doc/example/basic.txt index 55b0848..49baeee 100644 --- a/doc/example/basic.txt +++ b/doc/example/basic.txt @@ -1,4 +1,3 @@ - Basic usage ============================================= @@ -13,6 +12,7 @@ reside next to your ``setup.py`` file:: [tox] envlist = py26,py27 [testenv] + deps=pytest # or 'nose' or ... commands=py.test # or 'nosetests' or ... To sdist-package, install and test your project, you can @@ -38,8 +38,10 @@ Available "default" test environments names are:: py31 py32 py33 + py34 jython pypy + pypy3 However, you can also create your own test environment names, see some of the examples in :doc:`examples <../examples>`. @@ -74,7 +76,7 @@ you can add it to your ``deps`` variable like this:: deps = -rrequirements.txt -All installation commands are executed using ``{toxinidir}}`` +All installation commands are executed using ``{toxinidir}`` (the directory where ``tox.ini`` resides) as the current working directory. Therefore, the underlying ``pip`` installation will assume ``requirements.txt`` to exist at ``{toxinidir}/requirements.txt``. @@ -175,6 +177,31 @@ a PYTHONPATH setting that will lead Python to also import from the ``subdir`` below the directory where your ``tox.ini`` file resides. +special handling of PYTHONHASHSEED +------------------------------------------- + +.. versionadded:: 1.6.2 + +By default, Tox sets PYTHONHASHSEED_ for test commands to a random integer +generated when ``tox`` is invoked. This mimics Python's hash randomization +enabled by default starting `in Python 3.3`_. To aid in reproducing test +failures, Tox displays the value of ``PYTHONHASHSEED`` in the test output. + +You can tell Tox to use an explicit hash seed value via the ``--hashseed`` +command-line option to ``tox``. You can also override the hash seed value +per test environment in ``tox.ini`` as follows:: + + [testenv] + setenv = + PYTHONHASHSEED = 100 + +If you wish to disable this feature, you can pass the command line option +``--hashseed=noset`` when ``tox`` is invoked. You can also disable it from the +``tox.ini`` by setting ``PYTHONHASHSEED = 0`` as described above. + +.. _`in Python 3.3`: http://docs.python.org/3/whatsnew/3.3.html#builtin-functions-and-types +.. _PYTHONHASHSEED: http://docs.python.org/using/cmdline.html#envvar-PYTHONHASHSEED + Integration with setuptools/distribute test commands ---------------------------------------------------- @@ -186,6 +213,10 @@ a test run when ``python setup.py test`` is issued:: import sys class Tox(TestCommand): + user_options = [('tox-args=', 'a', "Arguments to pass to tox")] + def initialize_options(self): + TestCommand.initialize_options(self) + self.tox_args = None def finalize_options(self): TestCommand.finalize_options(self) self.test_args = [] @@ -193,7 +224,8 @@ a test run when ``python setup.py test`` is issued:: def run_tests(self): #import here, cause outside the eggs aren't loaded import tox - errno = tox.cmdline(self.test_args) + import shlex + errno = tox.cmdline(args=shlex.split(self.tox_args)) sys.exit(errno) setup( @@ -206,5 +238,9 @@ Now if you run:: python setup.py test -this will install tox and then run tox. +this will install tox and then run tox. You can pass arguments to ``tox`` +using the ``--tox-args`` or ``-a`` command-line options. For example:: + + python setup.py test -a "-epy27" +is equivalent to running ``tox -epy27``. |