Reset kafka.conn logger level in tearDown

This commit is contained in:
Dana Powers
2015-06-09 20:25:13 -07:00
parent f035de49da
commit fc30855953

View File

@@ -50,6 +50,11 @@ class ConnTest(unittest.TestCase):
# Reset any mock counts caused by __init__ # Reset any mock counts caused by __init__
self.MockCreateConn.reset_mock() self.MockCreateConn.reset_mock()
def tearDown(self):
# Return connection logging to INFO
logging.getLogger('kafka.conn').setLevel(logging.INFO)
def test_collect_hosts__happy_path(self): def test_collect_hosts__happy_path(self):
hosts = "localhost:1234,localhost" hosts = "localhost:1234,localhost"
results = collect_hosts(hosts) results = collect_hosts(hosts)
@@ -172,6 +177,14 @@ class ConnTest(unittest.TestCase):
class TestKafkaConnection(unittest.TestCase): class TestKafkaConnection(unittest.TestCase):
def setUp(self):
# kafka.conn debug logging is verbose, so only enable in conn tests
logging.getLogger('kafka.conn').setLevel(logging.DEBUG)
def tearDown(self):
# Return connection logging to INFO
logging.getLogger('kafka.conn').setLevel(logging.INFO)
@mock.patch('socket.create_connection') @mock.patch('socket.create_connection')
def test_copy(self, socket): def test_copy(self, socket):
"""KafkaConnection copies work as expected""" """KafkaConnection copies work as expected"""