Created attachment 392402 [details] my emerge --info The new release of logilab-common, 0.63.2 has the testsuite fail with the setup inherited by the previous ebuild. The suite is written to be run post system install. ~/cvsPortage/gentoo-x86/dev-python/logilab-common $ PYTHON_TARGETS=python2_7 ebuild logilab-common-0.63.2.ebuild clean test yields going into /mnt/gen2/TmpDir/portage/dev-python/logilab-common-0.63.2/work/logilab-common-0.63.2-python2_7/build/test/lib/logilab_common-0.63.2-py2.7.egg/logilab/common/test ******************************************************************************* Ran 427 test cases in 11.38s (0.36s CPU), 1 skipped All 22 modules OK >>> Completed testing dev-python/logilab-common-0.63.2 with py3.3 Ran 419 test cases in 11.48s (0.47s CPU), 24 skipped All 21 modules OK >>> Completed testing dev-python/logilab-common-0.63.2 The outcome though is conditional. With the package purged from the system, the testsuite will pass fine. If the prior version is installed, it will fail with a series of ------------------------------------------ File "/mnt/gen2/TmpDir/portage/dev-python/logilab-common-0.63.2/work/logilab-common-0.63.2-python2_7/build/test/lib/logilab_common-0.63.2-py2.7.egg/logilab/common/test/unittest_pytest.py", line 54, in test_replace_trace with replace_trace(tracefn): NameError: global name 'replace_trace' is not defined ----------------------------------------- ditto py3.3 a Simple grep between the two files pytest.py between the 2 versions reveals "replace_trace" is a new addition to logilab's inhouse testrunner 'pytest'. This is proof enough that if a previous version is installed, the testsuite imports from the installed system and not the local structure generated by 'distutils_install_for_testing'. It appears to be a case of PYTHONPATH needing to point ONLY at the source generated by this function. It seems to be over-ridden. The log submitted here lists some other failures occurring in the run by py3.3. These are separate issues of the suite or package itself.
Created attachment 392404 [details] build log of the test run
Created attachment 392406 [details, diff] diff -u of most recent ebuild ebuild or the new release
Please follow the rules when assigning bugs.
what rules?
mgorny CC'd in light of him being the author of the eclass and this function
(In reply to Ian Delaney from comment #5) > mgorny CC'd in light of him being the author of the eclass and this function Please restrain from adding random people to CC. In case you didn't get that yet, I'm on python@.
*** Bug 546686 has been marked as a duplicate of this bug. ***
this has nothing to do with `distutils_install_for_testing`: the testsuite does not expect the package to be installed (otherwise it would actually install the tests in site-packages as well, which it does not). The problem is that `logilab.common` declares a namespace and namespaces have precedence over simple modules causing an already installed module (belonging to that namespace) to be loaded before. This can be checked by looking at `python -c 'import sys; print(sys.modules)'`.
I've fixed this in the version bump to 1.2.2 by manually clearing the list of registered modules in the runscript (in a `pytest-local` based on `pytest`): import sys try: # remove an already installed logilab-common module from # the list of namespaces to force the local module to be tested del sys.modules['logilab'] except KeyError: pass This forces the local module to be used instead of one already registered for the namespace. Compare (nicer output with python2, but the same with python3): /tmp/logilab-common-1.2.2 $ PYTHONPATH=. python2 -v -c 'import logilab.common' |& grep "import logilab" import logilab.common # directory /usr/lib64/python2.7/site-packages/logilab/common import logilab.common # from /usr/lib64/python2.7/site-packages/logilab/common/__init__.py import logilab # directory /tmp/logilab-common-1.2.2/logilab import logilab # precompiled from /tmp/logilab-common-1.2.2/logilab/__init__.pyc vs. /tmp/logilab-common-1.2.2 $ PYTHONPATH=. python2 -v -c 'import sys; del sys.modules["logilab"]; import logilab.common' |& grep "import logilab" import logilab # directory logilab import logilab # precompiled from logilab/__init__.pyc import logilab.common # directory logilab/common import logilab.common # precompiled from logilab/common/__init__.pyc In the first example logilab.common is directly loaded from site-packages while only the logilab/__init__.py from the local dir is used (which contains nothing). The second one shows the correct way: first load logilab and then logilab.common from the local dir.