Skip to content

Commit be9f409

Browse files
author
Dana Powers
committed
use setUp / tearDown to rebuild fixtures for each test in test_failover_integration
1 parent 3ab9a42 commit be9f409

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

test/test_failover_integration.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717
class TestFailover(KafkaIntegrationTestCase):
1818
create_client = False
1919

20-
@classmethod
21-
def setUpClass(cls): # noqa
20+
def setUp(self):
2221
if not os.environ.get('KAFKA_VERSION'):
2322
return
2423

@@ -27,22 +26,23 @@ def setUpClass(cls): # noqa
2726
partitions = 2
2827

2928
# mini zookeeper, 2 kafka brokers
30-
cls.zk = ZookeeperFixture.instance()
31-
kk_args = [cls.zk.host, cls.zk.port, zk_chroot, replicas, partitions]
32-
cls.brokers = [KafkaFixture.instance(i, *kk_args) for i in range(replicas)]
29+
self.zk = ZookeeperFixture.instance()
30+
kk_args = [self.zk.host, self.zk.port, zk_chroot, replicas, partitions]
31+
self.brokers = [KafkaFixture.instance(i, *kk_args) for i in range(replicas)]
3332

34-
hosts = ['%s:%d' % (b.host, b.port) for b in cls.brokers]
35-
cls.client = KafkaClient(hosts)
33+
hosts = ['%s:%d' % (b.host, b.port) for b in self.brokers]
34+
self.client = KafkaClient(hosts)
35+
super(TestFailover, self).setUp()
3636

37-
@classmethod
38-
def tearDownClass(cls):
37+
def tearDown(self):
38+
super(TestFailover, self).tearDown()
3939
if not os.environ.get('KAFKA_VERSION'):
4040
return
4141

42-
cls.client.close()
43-
for broker in cls.brokers:
42+
self.client.close()
43+
for broker in self.brokers:
4444
broker.close()
45-
cls.zk.close()
45+
self.zk.close()
4646

4747
@kafka_versions("all")
4848
def test_switch_leader(self):

0 commit comments

Comments
 (0)