1. holger krekel
  2. tox


holger krekel  committed 86efef4

introduce --no-network switch for running tests

  • Participants
  • Parent commits cc81cfe
  • Branches default

Comments (0)

Files changed (4)


View file
 - drop Python2.5 compatibility because it became too hard due
   to the setuptools-2.0 dropping support.  tox now has no 
-  support for creating python2.5 based environments anymore.
+  support for creating python2.5 based environments anymore
+  and all internal special-handling has been removed.
 - merged PR81: new option --force-dep which allows to 
   override tox.ini specified dependencies in setuptools-style.
 - fix issue126: depend on virtualenv>=1.10.1 so that we can rely
   (hopefully) on a pip version which supports --pre. (tox by default
-  uses to --pre).  Note that tox also vendors an older virtualenv 
-  for supporting python2.5 -- although the latter will be dropped at some point.
+  uses to --pre).
 - fix issue130: you can now set install_command=easy_install {opts} {packages}
   and expect it to work for repeated tox runs (previously it only worked
 - make sure that the --installpkg option trumps any usedevelop settings
   in tox.ini or
+- introduce --no-network to tox's own test suite to skip tests
+  requiring networks

File tests/test_venv.py

View file
 def test_install_python3(tmpdir, newmocksession):
-    if not py.path.local.sysfind('python3.1'):
-        py.test.skip("needs python3.1")
+    if not py.path.local.sysfind('python3.3'):
+        pytest.skip("needs python3.3")
     mocksession = newmocksession([], """
-        basepython=python3.1
+        basepython=python3.3

File tox.ini

View file
 rsyncdirs=tests tox
+addopts = -rsxXf

File tox/_pytestplugin.py

View file
     if 'HUDSON_URL' in os.environ:
         del os.environ['HUDSON_URL']
+def pytest_addoption(parser):
+    parser.addoption("--no-network", action="store_true",
+        dest="no_network",
+        help="don't run tests requiring network")
 def pytest_report_header():
     return "tox comes from: %r" % (tox.__file__)
 def cmd(request):
+    if request.config.option.no_network:
+        pytest.skip("--no-network was specified, test cannot run")
     return Cmd(request)
 class ReportExpectMock:
         self.request = request
         current = py.path.local()
     def chdir(self, target):