classification
Title: test_unittest failure in leaks searching mode
Type: behavior Stage: resolved
Components: Tests Versions: Python 3.6
process
Status: closed Resolution: fixed
Dependencies: Superseder: test_unittest fails when hunting reference leaks
View: 30813
Assigned To: Nosy List: ezio.melotti, michael.foord, rbcollins, serhiy.storchaka, vstinner, xiang.zhang
Priority: normal Keywords:

Created on 2015-11-27 18:07 by serhiy.storchaka, last changed 2017-07-11 07:04 by serhiy.storchaka. This issue is now closed.

Messages (4)
msg255471 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2015-11-27 18:07
$ ./python -m test.regrtest -uall -R 3:3 test_unittest
[1/1] test_unittest
test test_unittest failed -- multiple errors occurred; run in verbose mode for details
1 test failed:
    test_unittest

$ ./python -m test.regrtest -vvuall -R 3:3 test_unittest
...
======================================================================
ERROR: test_discover_with_init_module_that_raises_SkipTest_on_import (unittest.test.test_discovery.TestDiscovery)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/serhiy/py/cpython-debug/Lib/unittest/test/test_discovery.py", line 532, in test_discover_with_init_module_that_raises_SkipTest_on_import
    pickle.loads(pickle.dumps(suite, proto))
_pickle.PicklingError: Can't pickle <class 'unittest.loader.ModuleSkipped'>: attribute lookup ModuleSkipped on unittest.loader failed

======================================================================
ERROR: test_discover_with_module_that_raises_SkipTest_on_import (unittest.test.test_discovery.TestDiscovery)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/serhiy/py/cpython-debug/Lib/unittest/test/test_discovery.py", line 508, in test_discover_with_module_that_raises_SkipTest_on_import
    pickle.loads(pickle.dumps(suite, proto))
_pickle.PicklingError: Can't pickle <class 'unittest.loader.ModuleSkipped'>: attribute lookup ModuleSkipped on unittest.loader failed

----------------------------------------------------------------------
msg273176 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2016-08-20 00:44
While checking that I didn't introduce a reference leak recently with my changes around _PyObject_FastCall(), I found the same issue: test_unittest doesn't work with regrtest -R.

I get the same error:

$ ./python -m test -R 0:1 -v test_unittest
======================================================================
ERROR: test_discover_with_init_module_that_raises_SkipTest_on_import (unittest.test.test_discovery.TestDiscovery)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/haypo/prog/python/default/Lib/unittest/test/test_discovery.py", line 572, in test_discover_with_init_module_that_raises_SkipTest_on_import
    pickle.loads(pickle.dumps(suite, proto))
_pickle.PicklingError: Can't pickle <class 'unittest.loader.ModuleSkipped'>: attribute lookup ModuleSkipped on unittest.loader failed

======================================================================
ERROR: test_discover_with_module_that_raises_SkipTest_on_import (unittest.test.test_discovery.TestDiscovery)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/haypo/prog/python/default/Lib/unittest/test/test_discovery.py", line 548, in test_discover_with_module_that_raises_SkipTest_on_import
    pickle.loads(pickle.dumps(suite, proto))
_pickle.PicklingError: Can't pickle <class 'unittest.loader.ModuleSkipped'>: attribute lookup ModuleSkipped on unittest.loader failed

----------------------------------------------------------------------
msg273210 - (view) Author: Xiang Zhang (xiang.zhang) * (Python committer) Date: 2016-08-20 13:43
Simple reproduction:

>>> pickle.dumps(unittest.loader._make_skipped_test('hello', RuntimeError, unittest.suite.TestSuite))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
_pickle.PicklingError: Can't pickle <class 'unittest.loader.ModuleSkipped'>: attribute lookup ModuleSkipped on unittest.loader failed

Exporting ModuleSkipped in unittest.loader can solve this. But maybe any more elegant method?
msg298135 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-07-11 07:04
Fixed in duplicate issue30813.
History
Date User Action Args
2017-07-11 07:04:23serhiy.storchakasetstatus: open -> closed
superseder: test_unittest fails when hunting reference leaks
messages: + msg298135

resolution: fixed
stage: needs patch -> resolved
2016-12-05 07:32:55serhiy.storchakalinkissue28873 superseder
2016-08-20 13:43:49xiang.zhangsetnosy: + xiang.zhang
messages: + msg273210
2016-08-20 00:44:55vstinnersetnosy: + vstinner
messages: + msg273176
2015-12-31 00:31:04ezio.melottisetstage: needs patch
2015-11-27 18:07:31serhiy.storchakacreate