diff options
| -rw-r--r-- | .travis.yml | 2 | ||||
| -rw-r--r-- | README.rst | 4 | ||||
| -rw-r--r-- | docs/dev/testing.rst | 5 | ||||
| -rw-r--r-- | docs/transparent/osx.rst | 2 | ||||
| -rw-r--r-- | libmproxy/controller.py | 1 | ||||
| -rw-r--r-- | setup.py | 5 | ||||
| -rw-r--r-- | test/test_console_common.py | 2 | ||||
| -rw-r--r-- | test/test_console_help.py | 2 | ||||
| -rw-r--r-- | test/test_console_palettes.py | 2 | ||||
| -rw-r--r-- | test/test_server.py | 4 | ||||
| -rw-r--r-- | test/tutils.py | 5 | 
11 files changed, 19 insertions, 15 deletions
diff --git a/.travis.yml b/.travis.yml index 7708670e..aee1a2a5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -41,7 +41,7 @@ before_script:    - "openssl version -a"  script: -  - "nosetests --with-cov --cov-report term-missing" +  - "py.test -n 4 --cov libmproxy"  after_success:    - coveralls @@ -69,7 +69,7 @@ mitmproxy test suite:  .. code-block:: text      . ../venv.mitmproxy/bin/activate # ..\venv.mitmproxy\Scripts\activate.bat on Windows -    nosetests ./test +    py.test -n 4 --cov libmproxy  Note that the main executables for the project - ``mitmdump``, ``mitmproxy`` and  ``mitmweb`` - are all created within the virtualenv. After activating the @@ -92,7 +92,7 @@ requirements installed, and you can simply run the test suite:  .. code-block:: text -    nosetests --with-cov --cov-report term-missing +    py.test -n 4 --cov libmproxy  Please ensure that all patches are accompanied by matching changes in the test  suite. The project maintains 100% test coverage. diff --git a/docs/dev/testing.rst b/docs/dev/testing.rst index 36c85426..d7554954 100644 --- a/docs/dev/testing.rst +++ b/docs/dev/testing.rst @@ -7,10 +7,10 @@ All the mitmproxy projects strive to maintain 100% code coverage. In general,  patches and pull requests will be declined unless they're accompanied by a  suitable extension to the test suite. -Our tests are written for the nose_ test framework. +Our tests are written for the `py.test`_ or nose_ test frameworks.  At the point where you send your pull request, a command like this: ->>> nosetests --with-cov --cov-report term-missing ./test +>>> py.test -n 4 --cov libmproxy  Should give output something like this: @@ -44,3 +44,4 @@ excluded from coverage analysis either in the **.coveragerc** file, or using  these measures as sparingly as possible.  .. _nose: https://nose.readthedocs.org/en/latest/ +.. _py.test: https://pytest.org/ diff --git a/docs/transparent/osx.rst b/docs/transparent/osx.rst index 5a4a3173..1791105f 100644 --- a/docs/transparent/osx.rst +++ b/docs/transparent/osx.rst @@ -30,7 +30,7 @@ Note that this means we don't support transparent mode for earlier versions of O   5. And now enable it: -    >>>sudo pfctl -e +    >>> sudo pfctl -e   6. Configure sudoers to allow mitmproxy to access pfctl. Edit the file      **/etc/sudoers** on your system as root. Add the following line to the end diff --git a/libmproxy/controller.py b/libmproxy/controller.py index 98a3aec7..24b229c5 100644 --- a/libmproxy/controller.py +++ b/libmproxy/controller.py @@ -106,6 +106,7 @@ class Master(object):              while True:                  msg = q.get(timeout=timeout)                  self.handle(*msg) +                q.task_done()                  changed = True          except Queue.Empty:              pass @@ -40,8 +40,9 @@ scripts = {  # Developer dependencies  dev_deps = {      "mock>=1.0.1", -    "nose>=1.3.0", -    "nose-cov>=1.6", +    "pytest>=2.8.0", +    "pytest-xdist>=1.13.1", +    "pytest-cov>=2.1.0",      "coveralls>=0.4.1",      "pathod>=%s, <%s" % (version.MINORVERSION, version.NEXT_MINORVERSION),      "sphinx>=1.3.1", diff --git a/test/test_console_common.py b/test/test_console_common.py index 459539c5..3e176d75 100644 --- a/test/test_console_common.py +++ b/test/test_console_common.py @@ -1,5 +1,5 @@  import os -from nose.plugins.skip import SkipTest +from unittest.case import SkipTest  if os.name == "nt":      raise SkipTest("Skipped on Windows.") diff --git a/test/test_console_help.py b/test/test_console_help.py index a7a8b745..dc2591e5 100644 --- a/test/test_console_help.py +++ b/test/test_console_help.py @@ -1,5 +1,5 @@  import os -from nose.plugins.skip import SkipTest +from unittest.case import SkipTest  if os.name == "nt":      raise SkipTest("Skipped on Windows.") diff --git a/test/test_console_palettes.py b/test/test_console_palettes.py index a3b7fe4f..9cf5d95c 100644 --- a/test/test_console_palettes.py +++ b/test/test_console_palettes.py @@ -1,5 +1,5 @@  import os -from nose.plugins.skip import SkipTest +from unittest.case import SkipTest  if os.name == "nt":      raise SkipTest("Skipped on Windows.")  import libmproxy.console.palettes as palettes diff --git a/test/test_server.py b/test/test_server.py index c81a2843..5f644c96 100644 --- a/test/test_server.py +++ b/test/test_server.py @@ -124,6 +124,8 @@ class TcpMixin:          i2 = self.pathod("306")          self._ignore_off() +        self.master.masterq.join() +          assert n.status_code == 304          assert i.status_code == 305          assert i2.status_code == 306 @@ -168,6 +170,8 @@ class TcpMixin:          i2 = self.pathod("306")          self._tcpproxy_off() +        self.master.masterq.join() +          assert n.status_code == 304          assert i.status_code == 305          assert i2.status_code == 306 diff --git a/test/tutils.py b/test/tutils.py index f1db7842..cc8c407f 100644 --- a/test/tutils.py +++ b/test/tutils.py @@ -6,16 +6,13 @@ import sys  from cStringIO import StringIO  from contextlib import contextmanager -from nose.plugins.skip import SkipTest -from mock import Mock +from unittest.case import SkipTest  import netlib.tutils  from libmproxy import utils, controller  from libmproxy.models import (      ClientConnection, ServerConnection, Error, HTTPRequest, HTTPResponse, HTTPFlow  ) -from libmproxy.console.flowview import FlowView -from libmproxy.console import ConsoleState  def _SkipWindows(*args):  | 
