1. holger krekel
  2. tox

Commits

Trevor Bekolay  committed 4d9994e

Better setuptools integration in basic

  • Participants
  • Parent commits acb4f0d
  • Branches tbekolay/better-setuptools-integration-in-basic-1400524487298

Comments (0)

Files changed (1)

File doc/example/basic.txt

View file
-
 Basic usage
 =============================================
 
     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 = []
         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(
 
     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``.