From 88375ad64aa2f53b9447df1ccd7aa7ee77cb04ef Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Mon, 21 Sep 2015 02:26:47 +0200 Subject: fix minor bugs, add py.test compatibility --- test/tservers.py | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) (limited to 'test/tservers.py') 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() -- cgit v1.2.3