Kaydet (Commit) bd3d5cf9 authored tarafından Vinay Sajip's avatar Vinay Sajip

Skip some tests in the absence of multiprocessing.

üst ce7c9781
...@@ -2504,6 +2504,7 @@ class ConfigDictTest(BaseTest): ...@@ -2504,6 +2504,7 @@ class ConfigDictTest(BaseTest):
logging.config.stopListening() logging.config.stopListening()
t.join(2.0) t.join(2.0)
@unittest.skipUnless(threading, 'Threading required for this test.')
def test_listen_config_10_ok(self): def test_listen_config_10_ok(self):
with captured_stdout() as output: with captured_stdout() as output:
self.setup_via_listener(json.dumps(self.config10)) self.setup_via_listener(json.dumps(self.config10))
...@@ -2523,6 +2524,7 @@ class ConfigDictTest(BaseTest): ...@@ -2523,6 +2524,7 @@ class ConfigDictTest(BaseTest):
('ERROR', '4'), ('ERROR', '4'),
], stream=output) ], stream=output)
@unittest.skipUnless(threading, 'Threading required for this test.')
def test_listen_config_1_ok(self): def test_listen_config_1_ok(self):
with captured_stdout() as output: with captured_stdout() as output:
self.setup_via_listener(textwrap.dedent(ConfigFileTest.config1)) self.setup_via_listener(textwrap.dedent(ConfigFileTest.config1))
...@@ -3062,15 +3064,19 @@ class LogRecordTest(BaseTest): ...@@ -3062,15 +3064,19 @@ class LogRecordTest(BaseTest):
def test_multiprocessing(self): def test_multiprocessing(self):
r = logging.makeLogRecord({}) r = logging.makeLogRecord({})
self.assertEqual(r.processName, 'MainProcess') self.assertEqual(r.processName, 'MainProcess')
import multiprocessing as mp try:
r = logging.makeLogRecord({}) import multiprocessing as mp
self.assertEqual(r.processName, mp.current_process().name) r = logging.makeLogRecord({})
self.assertEqual(r.processName, mp.current_process().name)
except ImportError:
pass
def test_optional(self): def test_optional(self):
r = logging.makeLogRecord({}) r = logging.makeLogRecord({})
NOT_NONE = self.assertIsNotNone NOT_NONE = self.assertIsNotNone
NOT_NONE(r.thread) if threading:
NOT_NONE(r.threadName) NOT_NONE(r.thread)
NOT_NONE(r.threadName)
NOT_NONE(r.process) NOT_NONE(r.process)
NOT_NONE(r.processName) NOT_NONE(r.processName)
log_threads = logging.logThreads log_threads = logging.logThreads
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment