From 03fcf057dd61e8a9330d18c3f2f73f01760487ac Mon Sep 17 00:00:00 2001 From: David Wilson Date: Thu, 29 Mar 2018 07:25:11 +0000 Subject: [PATCH] tests: just call log_to_file() from testlib Now we can run test.sh with MITOGEN_LOG_LEVEL=debug and things just work. --- tests/importer_test.py | 7 ------- tests/testlib.py | 7 +++---- tests/tty_create_child_test.py | 3 +-- 3 files changed, 4 insertions(+), 13 deletions(-) diff --git a/tests/importer_test.py b/tests/importer_test.py index 882db78f..1a654a2d 100644 --- a/tests/importer_test.py +++ b/tests/importer_test.py @@ -15,13 +15,6 @@ import mitogen.utils import testlib -import logging -logging.basicConfig(level=logging.DEBUG) -mitogen.core._v = True -mitogen.core._vv = True -mitogen.core.IOLOG.setLevel(logging.DEBUG) - - class ImporterMixin(testlib.RouterMixin): modname = None diff --git a/tests/testlib.py b/tests/testlib.py index a43c8b1d..fd41298b 100644 --- a/tests/testlib.py +++ b/tests/testlib.py @@ -10,6 +10,8 @@ import urlparse import unittest2 import mitogen.master +import mitogen.utils + if mitogen.is_master: # TODO: shouldn't be necessary. import docker @@ -17,10 +19,7 @@ if mitogen.is_master: # TODO: shouldn't be necessary. DATA_DIR = os.path.join(os.path.dirname(__file__), 'data') sys.path.append(DATA_DIR) - -def set_debug(): - import logging - logging.getLogger('mitogen').setLevel(logging.DEBUG) +mitogen.utils.log_to_file() def data_path(suffix): diff --git a/tests/tty_create_child_test.py b/tests/tty_create_child_test.py index dca1d375..879373ca 100644 --- a/tests/tty_create_child_test.py +++ b/tests/tty_create_child_test.py @@ -4,6 +4,7 @@ import tempfile import time import unittest2 +import testlib import mitogen.parent @@ -11,8 +12,6 @@ class TtyCreateChildTest(unittest2.TestCase): func = staticmethod(mitogen.parent.tty_create_child) def test_dev_tty_open_succeeds(self): - import logging - logging.basicConfig(level=logging.DEBUG) tf = tempfile.NamedTemporaryFile() try: pid, fd = self.func(