[Python-checkins] cpython: Skip some tests in the absence of multiprocessing.
vinay.sajip
python-checkins at python.org
Tue May 17 08:41:28 CEST 2011
http://hg.python.org/cpython/rev/4b7c29201c60
changeset: 70170:4b7c29201c60
user: Vinay Sajip <vinay_sajip at yahoo.co.uk>
date: Tue May 17 07:41:18 2011 +0100
summary:
Skip some tests in the absence of multiprocessing.
files:
Lib/test/test_logging.py | 16 +++++++++++-----
1 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py
--- a/Lib/test/test_logging.py
+++ b/Lib/test/test_logging.py
@@ -2504,6 +2504,7 @@
logging.config.stopListening()
t.join(2.0)
+ @unittest.skipUnless(threading, 'Threading required for this test.')
def test_listen_config_10_ok(self):
with captured_stdout() as output:
self.setup_via_listener(json.dumps(self.config10))
@@ -2523,6 +2524,7 @@
('ERROR', '4'),
], stream=output)
+ @unittest.skipUnless(threading, 'Threading required for this test.')
def test_listen_config_1_ok(self):
with captured_stdout() as output:
self.setup_via_listener(textwrap.dedent(ConfigFileTest.config1))
@@ -3062,15 +3064,19 @@
def test_multiprocessing(self):
r = logging.makeLogRecord({})
self.assertEqual(r.processName, 'MainProcess')
- import multiprocessing as mp
- r = logging.makeLogRecord({})
- self.assertEqual(r.processName, mp.current_process().name)
+ try:
+ import multiprocessing as mp
+ r = logging.makeLogRecord({})
+ self.assertEqual(r.processName, mp.current_process().name)
+ except ImportError:
+ pass
def test_optional(self):
r = logging.makeLogRecord({})
NOT_NONE = self.assertIsNotNone
- NOT_NONE(r.thread)
- NOT_NONE(r.threadName)
+ if threading:
+ NOT_NONE(r.thread)
+ NOT_NONE(r.threadName)
NOT_NONE(r.process)
NOT_NONE(r.processName)
log_threads = logging.logThreads
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list