Skip to content
This repository was archived by the owner on Aug 5, 2020. It is now read-only.

Commit 9b149b3

Browse files
committed
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
1 parent 0eb6476 commit 9b149b3

2 files changed

Lines changed: 12 additions & 7 deletions

File tree

tests/integration/standard/test_client_warnings.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,8 @@ class ClientWarningTests(unittest.TestCase):
3333
@classmethod
3434
def setUpClass(cls):
3535
if PROTOCOL_VERSION < 4:
36-
raise unittest.SkipTest(
37-
"Native protocol 4,0+ is required for client warnings, currently using %r"
38-
% (PROTOCOL_VERSION,))
36+
return
37+
3938
cls.cluster = Cluster(protocol_version=PROTOCOL_VERSION)
4039
cls.session = cls.cluster.connect()
4140

@@ -51,8 +50,17 @@ def setUpClass(cls):
5150

5251
@classmethod
5352
def tearDownClass(cls):
53+
if PROTOCOL_VERSION < 4:
54+
return
55+
5456
cls.cluster.shutdown()
5557

58+
def setUp(self):
59+
if PROTOCOL_VERSION < 4:
60+
raise unittest.SkipTest(
61+
"Native protocol 4,0+ is required for client warnings, currently using %r"
62+
% (PROTOCOL_VERSION,))
63+
5664
def test_warning_basic(self):
5765
"""
5866
Test to validate that client warnings can be surfaced

tests/integration/standard/test_custom_payload.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,11 @@ def setup_module():
2828

2929
class CustomPayloadTests(unittest.TestCase):
3030

31-
@classmethod
32-
def setUpClass(cls):
31+
def setUp(self):
3332
if PROTOCOL_VERSION < 4:
3433
raise unittest.SkipTest(
3534
"Native protocol 4,0+ is required for custom payloads, currently using %r"
3635
% (PROTOCOL_VERSION,))
37-
38-
def setUp(self):
3936
self.cluster = Cluster(protocol_version=PROTOCOL_VERSION)
4037
self.session = self.cluster.connect()
4138

0 commit comments

Comments
 (0)