Skip to content

Commit fb02435

Browse files
author
Dana Powers
committed
Cleanup new producer tests...
1 parent 7dec992 commit fb02435

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

test/test_producer.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -111,19 +111,19 @@ def test_producer_sync_fail_on_error(self):
111111
with self.assertRaises(FailedPayloadsError):
112112
producer.send_messages('foobar', b'test message')
113113

114-
def test_cleanup_stop_is_called_on_not_stopped_object(self):
114+
def test_cleanup_is_not_called_on_stopped_producer(self):
115115
producer = Producer(MagicMock(), async=True)
116116
producer.stopped = True
117-
with patch('kafka.producer.base.Producer.stop') as base_stop:
117+
with patch.object(producer, 'stop') as mocked_stop:
118118
producer._cleanup_func(producer)
119-
self.assertEqual(base_stop.call_count, 0)
119+
self.assertEqual(mocked_stop.call_count, 0)
120120

121-
def test_cleanup_stop_is_not_called_on_stopped_object(self):
121+
def test_cleanup_is_called_on_running_producer(self):
122122
producer = Producer(MagicMock(), async=True)
123123
producer.stopped = False
124-
with patch('kafka.producer.base.Producer.stop') as base_stop:
124+
with patch.object(producer, 'stop') as mocked_stop:
125125
producer._cleanup_func(producer)
126-
self.assertEqual(base_stop.call_count, 1)
126+
self.assertEqual(mocked_stop.call_count, 1)
127127

128128

129129
class TestKafkaProducerSendUpstream(unittest.TestCase):

0 commit comments

Comments
 (0)