Commits

holger krekel committed 86efef4

introduce --no-network switch for running tests

Comments (0)

Files changed (4)

 
 - 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
+
 1.6.1
 -----
 

tests/test_venv.py

 
 
 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([], """
         [testenv:py123]
-        basepython=python3.1
+        basepython=python3.3
         deps=
             dep1
             dep2
 
 [pytest]
 rsyncdirs=tests tox
-
+addopts = -rsxXf

tox/_pytestplugin.py

     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__)
 
 
 @pytest.fixture
 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()
         self.request.addfinalizer(current.chdir)
+
     def chdir(self, target):
         target.chdir()