classification
Title: test_importlib.test_locks fails --without-threads
Type: behavior Stage: resolved
Components: Tests Versions: Python 3.5
process
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.

Files
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/case.py", line 58, in testPartExecutor
    yield
  File "/home/berker/projects/cpython-default/Lib/unittest/case.py", line 577, in run
    testMethod()
  File "/home/berker/projects/cpython-default/Lib/unittest/loader.py", 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/loader.py", line 312, in _find_tests
    module = self._get_module_from_name(name)
  File "/home/berker/projects/cpython-default/Lib/unittest/loader.py", line 290, in _get_module_from_name
    __import__(name)
  File "/home/berker/projects/cpython-default/Lib/test/test_importlib/test_locks.py", line 123, in <module>
    DeadlockError=DEADLOCK_ERRORS)
  File "/home/berker/projects/cpython-default/Lib/test/test_importlib/util.py", line 82, in test_both
    return split_frozen(test_class, base, **kwargs)
  File "/home/berker/projects/cpython-default/Lib/test/test_importlib/util.py", line 76, in split_frozen
    frozen = specialize_class(cls, 'Frozen', base, **kwargs)
  File "/home/berker/projects/cpython-default/Lib/test/test_importlib/util.py", 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 http://buildbot.python.org/all/builders/AMD64%20Fedora%20without%20threads%203.x/builds/6779/steps/test/logs/stdio
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
http://hg.python.org/cpython/rev/b88525a8c01d
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.
History
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