summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorholger krekel <holger@merlinux.eu>2013-12-09 15:54:19 +0100
committerholger krekel <holger@merlinux.eu>2013-12-09 15:54:19 +0100
commit142f0130c09177989c20a4c5527156aab93311b2 (patch)
treeefd0e8da59a581e6336fd80e1ee0dcdec52b773b
parentb05f70be1296bf9c00af1020faeb8a8209e23066 (diff)
downloadtox-142f0130c09177989c20a4c5527156aab93311b2.tar.gz
introduce --no-network switch for running tests
-rwxr-xr-xCHANGELOG9
-rw-r--r--tests/test_venv.py6
-rw-r--r--tox.ini2
-rw-r--r--tox/_pytestplugin.py9
4 files changed, 19 insertions, 7 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 1bd4117..09de503 100755
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -3,7 +3,8 @@
- 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.
@@ -23,8 +24,7 @@
- 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
@@ -44,6 +44,9 @@
- 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
-----
diff --git a/tests/test_venv.py b/tests/test_venv.py
index 6f4a06a..ad968d1 100644
--- a/tests/test_venv.py
+++ b/tests/test_venv.py
@@ -307,11 +307,11 @@ def test_install_command_not_installed(newmocksession):
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
diff --git a/tox.ini b/tox.ini
index 29525c9..f2fc791 100644
--- a/tox.ini
+++ b/tox.ini
@@ -23,4 +23,4 @@ setenv= PIP_INSECURE=1
[pytest]
rsyncdirs=tests tox
-
+addopts = -rsxXf
diff --git a/tox/_pytestplugin.py b/tox/_pytestplugin.py
index f6421f4..4f00d3f 100644
--- a/tox/_pytestplugin.py
+++ b/tox/_pytestplugin.py
@@ -16,6 +16,12 @@ def pytest_configure():
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__)
@@ -37,6 +43,8 @@ def newconfig(request, tmpdir):
@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:
@@ -156,6 +164,7 @@ class Cmd:
self.request = request
current = py.path.local()
self.request.addfinalizer(current.chdir)
+
def chdir(self, target):
target.chdir()