New submission from STINNER Victor: I added Lib/test/bisect.py in the commit d7955b8196578306e9d86f6c61c9cb3ee72edab0, bpo-29512.
When a test is loaded by Lib/test/regrtest.py when regrtest.py runs with "python -m test", test files like Lib/test/test_bisect.py are created with __package__ = ['test']. In this case, "import bisect" loads Lib/test/bisect.py rather than Lib/bisect.py. For test_bisect.py, I worked around the issue using "from __future__ import absolute_import". But then I saw this bug: http://buildbot.python.org/all/builders/AMD64%20FreeBSD%20CURRENT%20Non-Debug%202.7/builds/159/steps/test/logs/stdio Run tests in parallel using 2 child processes (...) 0:02:41 [144/403/1] test_multiprocessing failed test test_multiprocessing failed -- Traceback (most recent call last): File "/usr/home/buildbot/python/2.7.koobs-freebsd-current.nondebug/build/Lib/test/test_multiprocessing.py", line 1669, in test_connection self.assertEqual(poll(TIMEOUT1), True) AssertionError: False != True (...) Re-running test 'test_multiprocessing' in verbose mode (...) ====================================================================== ERROR: test_array (test.test_multiprocessing.WithProcessesTestArray) ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/home/buildbot/python/2.7.koobs-freebsd-current.nondebug/build/Lib/test/test_multiprocessing.py", line 1027, in test_array arr = self.Array('i', seq) File "/usr/home/buildbot/python/2.7.koobs-freebsd-current.nondebug/build/Lib/multiprocessing/__init__.py", line 260, in Array return Array(typecode_or_type, size_or_initializer, **kwds) File "/usr/home/buildbot/python/2.7.koobs-freebsd-current.nondebug/build/Lib/multiprocessing/sharedctypes.py", line 120, in Array obj = RawArray(typecode_or_type, size_or_initializer) File "/usr/home/buildbot/python/2.7.koobs-freebsd-current.nondebug/build/Lib/multiprocessing/sharedctypes.py", line 93, in RawArray result = _new_value(type_) File "/usr/home/buildbot/python/2.7.koobs-freebsd-current.nondebug/build/Lib/multiprocessing/sharedctypes.py", line 68, in _new_value wrapper = heap.BufferWrapper(size) File "/usr/home/buildbot/python/2.7.koobs-freebsd-current.nondebug/build/Lib/multiprocessing/heap.py", line 243, in __init__ block = BufferWrapper._heap.malloc(size) File "/usr/home/buildbot/python/2.7.koobs-freebsd-current.nondebug/build/Lib/multiprocessing/heap.py", line 223, in malloc (arena, start, stop) = self._malloc(size) File "/usr/home/buildbot/python/2.7.koobs-freebsd-current.nondebug/build/Lib/multiprocessing/heap.py", line 115, in _malloc i = bisect.bisect_left(self._lengths, size) AttributeError: 'module' object has no attribute 'bisect_left' The wrong bisect module was picked when test_multiprocessing was run for the second time. The first run was done in a slave process. The second run was done in the main regrtest process. ---------- components: Tests messages: 297618 nosy: haypo priority: normal severity: normal status: open title: Lib/test/site.py conflicts with Lib/site.py when running tests versions: Python 2.7 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30843> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com