https://hg.python.org/cpython/rev/9694185cdd9f changeset: 101186:9694185cdd9f parent: 101184:39397748a5b0 parent: 101185:110dfb244b27 user: Berker Peksag <berker.peksag@gmail.com> date: Fri Apr 29 17:25:51 2016 +0300 summary: Issue #25551: Test condition behavior instead of its internals test_reset_internal_locks was looking at Event's _cond._lock. This makes it harder to change internals of the Condition object and makes the test fragile. The test was added by Nir Soffer in 6108d30dde21. Patch by Nir Soffer. files: Lib/test/lock_tests.py | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Lib/test/lock_tests.py b/Lib/test/lock_tests.py --- a/Lib/test/lock_tests.py +++ b/Lib/test/lock_tests.py @@ -407,12 +407,13 @@ self.assertEqual(results, [True] * N) def test_reset_internal_locks(self): + # ensure that condition is still using a Lock after reset evt = self.eventtype() - old_lock = evt._cond._lock + with evt._cond: + self.assertFalse(evt._cond.acquire(False)) evt._reset_internal_locks() - new_lock = evt._cond._lock - self.assertIsNot(new_lock, old_lock) - self.assertIs(type(new_lock), type(old_lock)) + with evt._cond: + self.assertFalse(evt._cond.acquire(False)) class ConditionTests(BaseTestCase): -- Repository URL: https://hg.python.org/cpython