diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2015-03-18 22:56:46 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2015-03-18 22:56:46 (GMT) |
commit | d833779ceaebeb29352488ffddabf5fc2f070364 (patch) | |
tree | 83ff79a3d53920897701d6180472e40ec4e72e93 /Lib/unittest/test | |
parent | c4c19b39381460a2353c2789f13fa2bb1ab565c1 (diff) | |
download | cpython-d833779ceaebeb29352488ffddabf5fc2f070364.zip cpython-d833779ceaebeb29352488ffddabf5fc2f070364.tar.gz cpython-d833779ceaebeb29352488ffddabf5fc2f070364.tar.bz2 |
Issue #22903: The fake test case created by unittest.loader when it fails importing a test module is now picklable.
Diffstat (limited to 'Lib/unittest/test')
-rw-r--r-- | Lib/unittest/test/test_discovery.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/unittest/test/test_discovery.py b/Lib/unittest/test/test_discovery.py index abb9066..f12e898 100644 --- a/Lib/unittest/test/test_discovery.py +++ b/Lib/unittest/test/test_discovery.py @@ -2,6 +2,7 @@ import os import re import sys import types +import pickle import builtins from test import support @@ -216,6 +217,10 @@ class TestDiscovery(unittest.TestCase): with self.assertRaises(ImportError): test.test_this_does_not_exist() + # Check picklability + for proto in range(pickle.HIGHEST_PROTOCOL + 1): + pickle.loads(pickle.dumps(test, proto)) + def test_discover_with_module_that_raises_SkipTest_on_import(self): loader = unittest.TestLoader() @@ -232,6 +237,10 @@ class TestDiscovery(unittest.TestCase): suite.run(result) self.assertEqual(len(result.skipped), 1) + # Check picklability + for proto in range(pickle.HIGHEST_PROTOCOL + 1): + pickle.loads(pickle.dumps(suite, proto)) + def test_command_line_handling_parseArgs(self): program = TestableTestProgram() |