Title: test_importlib.test_locks fails --without-threads
Type: behavior Stage: resolved
Components: Tests Versions: Python 3.5
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: berker.peksag Nosy List: berker.peksag, brett.cannon, eric.snow, python-dev, r.david.murray
Priority: normal Keywords: patch

Created on 2014-06-14 08:22 by berker.peksag, last changed 2014-07-03 14:54 by berker.peksag. This issue is now closed.

File name Uploaded Description Edit
test_locks.diff berker.peksag, 2014-06-14 08:22 review
Messages (5)
msg220534 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2014-06-14 08:22
ERROR: test.test_importlib.test_locks (unittest.loader.ModuleImportFailure)
Traceback (most recent call last):
  File "/home/berker/projects/cpython-default/Lib/unittest/", line 58, in testPartExecutor
  File "/home/berker/projects/cpython-default/Lib/unittest/", line 577, in run
  File "/home/berker/projects/cpython-default/Lib/unittest/", line 32, in testFailure
    raise exception
ImportError: Failed to import test module: test.test_importlib.test_locks
Traceback (most recent call last):
  File "/home/berker/projects/cpython-default/Lib/unittest/", line 312, in _find_tests
    module = self._get_module_from_name(name)
  File "/home/berker/projects/cpython-default/Lib/unittest/", line 290, in _get_module_from_name
  File "/home/berker/projects/cpython-default/Lib/test/test_importlib/", line 123, in <module>
  File "/home/berker/projects/cpython-default/Lib/test/test_importlib/", line 82, in test_both
    return split_frozen(test_class, base, **kwargs)
  File "/home/berker/projects/cpython-default/Lib/test/test_importlib/", line 76, in split_frozen
    frozen = specialize_class(cls, 'Frozen', base, **kwargs)
  File "/home/berker/projects/cpython-default/Lib/test/test_importlib/", line 70, in specialize_class
    value = values[kind]
KeyError: 'Frozen'

I've used the same logic as ModuleLockAsRLockTests to silence the test failure.

Patch attached.
msg220929 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2014-06-18 10:22
See also
msg222148 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-07-03 03:25
New changeset b88525a8c01d by Berker Peksag in branch 'default':
Issue #21755: Skip {Frozen,Source}_DeadlockAvoidanceTests tests when
msg222174 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2014-07-03 13:12
What is the reason for using the conditional approach rather than a skip decorator?  Does it not work in this context, or is it just that you copied the existing approach?  It's fine either way, but I'm curious.
msg222190 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2014-07-03 14:54
> Does it not work in this context

Yes, it doesn't work after 34d65746d5ca because LOCK_TYPES is an empty dict (test_util.test_both() can't find the 'Frozen' and 'Source' keys in it) when Python is built without threads.
Date User Action Args
2014-07-03 14:54:53berker.peksagsetmessages: + msg222190
2014-07-03 13:12:09r.david.murraysetmessages: + msg222174
2014-07-03 03:27:05berker.peksagsetnosy: + r.david.murray
2014-07-03 03:26:23berker.peksagsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2014-07-03 03:25:13python-devsetnosy: + python-dev
messages: + msg222148
2014-07-03 00:27:24berker.peksagsetassignee: berker.peksag
versions: - Python 3.4
2014-06-18 10:22:55berker.peksagsetmessages: + msg220929
2014-06-14 08:22:29berker.peksagcreate