diff options
author | Maximilian Hils <git@maximilianhils.com> | 2015-09-21 02:26:47 +0200 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2015-09-21 02:26:47 +0200 |
commit | 88375ad64aa2f53b9447df1ccd7aa7ee77cb04ef (patch) | |
tree | d8bb3f92ae9b32fc9bbc33b85789d50fb6c45515 /test/tservers.py | |
parent | 6d27901b6fe44a651788e07d9e2de4d367be925e (diff) | |
download | mitmproxy-88375ad64aa2f53b9447df1ccd7aa7ee77cb04ef.tar.gz mitmproxy-88375ad64aa2f53b9447df1ccd7aa7ee77cb04ef.tar.bz2 mitmproxy-88375ad64aa2f53b9447df1ccd7aa7ee77cb04ef.zip |
fix minor bugs, add py.test compatibility
Diffstat (limited to 'test/tservers.py')
-rw-r--r-- | test/tservers.py | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/test/tservers.py b/test/tservers.py index c5256e53..8e60df60 100644 --- a/test/tservers.py +++ b/test/tservers.py @@ -89,7 +89,7 @@ class ProxTestBase(object): masterclass = TestMaster @classmethod - def setupAll(cls): + def setup_class(cls): cls.server = libpathod.test.Daemon( ssl=cls.ssl, ssloptions=cls.ssloptions) @@ -105,13 +105,15 @@ class ProxTestBase(object): cls.proxy.start() @classmethod - def teardownAll(cls): - shutil.rmtree(cls.cadir) + def teardown_class(cls): + # perf: we want to run tests in parallell + # should this ever cause an error, travis should catch it. + # shutil.rmtree(cls.cadir) cls.proxy.shutdown() cls.server.shutdown() cls.server2.shutdown() - def setUp(self): + def setup(self): self.master.clear_log() self.master.state.clear() self.server.clear_log() @@ -185,8 +187,8 @@ class TransparentProxTest(ProxTestBase): resolver = TResolver @classmethod - def setupAll(cls): - super(TransparentProxTest, cls).setupAll() + def setup_class(cls): + super(TransparentProxTest, cls).setup_class() cls._resolver = mock.patch( "libmproxy.platform.resolver", @@ -195,9 +197,9 @@ class TransparentProxTest(ProxTestBase): cls._resolver.start() @classmethod - def teardownAll(cls): + def teardown_class(cls): cls._resolver.stop() - super(TransparentProxTest, cls).teardownAll() + super(TransparentProxTest, cls).teardown_class() @classmethod def get_proxy_config(cls): @@ -283,9 +285,9 @@ class ChainProxTest(ProxTestBase): n = 2 @classmethod - def setupAll(cls): + def setup_class(cls): cls.chain = [] - super(ChainProxTest, cls).setupAll() + super(ChainProxTest, cls).setup_class() for _ in range(cls.n): config = ProxyConfig(**cls.get_proxy_config()) tmaster = cls.masterclass(config) @@ -298,13 +300,13 @@ class ChainProxTest(ProxTestBase): **cls.get_proxy_config()) @classmethod - def teardownAll(cls): - super(ChainProxTest, cls).teardownAll() + def teardown_class(cls): + super(ChainProxTest, cls).teardown_class() for proxy in cls.chain: proxy.shutdown() - def setUp(self): - super(ChainProxTest, self).setUp() + def setup(self): + super(ChainProxTest, self).setup() for proxy in self.chain: proxy.tmaster.clear_log() proxy.tmaster.state.clear() |