Don't skipTest in unittest.TestCase.setUpClass

resolves an issue where skipping from class setup errors in unittest2
This is reported fixed in unittest2 0.4.2, but seems to be still
happening in 1.0.1
https://pypi.python.org/pypi/unittest2#id9
This commit is contained in:
Adam Holmberg
2015-05-27 13:35:28 -05:00
parent 0eb6476aaf
commit 9b149b3092
2 changed files with 12 additions and 7 deletions

View File

@@ -33,9 +33,8 @@ class ClientWarningTests(unittest.TestCase):
@classmethod
def setUpClass(cls):
if PROTOCOL_VERSION < 4:
raise unittest.SkipTest(
"Native protocol 4,0+ is required for client warnings, currently using %r"
% (PROTOCOL_VERSION,))
return
cls.cluster = Cluster(protocol_version=PROTOCOL_VERSION)
cls.session = cls.cluster.connect()
@@ -51,8 +50,17 @@ class ClientWarningTests(unittest.TestCase):
@classmethod
def tearDownClass(cls):
if PROTOCOL_VERSION < 4:
return
cls.cluster.shutdown()
def setUp(self):
if PROTOCOL_VERSION < 4:
raise unittest.SkipTest(
"Native protocol 4,0+ is required for client warnings, currently using %r"
% (PROTOCOL_VERSION,))
def test_warning_basic(self):
"""
Test to validate that client warnings can be surfaced

View File

@@ -28,14 +28,11 @@ def setup_module():
class CustomPayloadTests(unittest.TestCase):
@classmethod
def setUpClass(cls):
def setUp(self):
if PROTOCOL_VERSION < 4:
raise unittest.SkipTest(
"Native protocol 4,0+ is required for custom payloads, currently using %r"
% (PROTOCOL_VERSION,))
def setUp(self):
self.cluster = Cluster(protocol_version=PROTOCOL_VERSION)
self.session = self.cluster.connect()