[pypy-dev] autopath/conftest/whatsoever bug?

holger krekel hpk at trillke.net
Mon Mar 20 03:29:25 CET 2006


On Sun, Mar 19, 2006 at 18:20 -0800, Christian Tismer wrote:
> >On Thu, Mar 16, 2006 at 05:33:31PM -0800, Christian Tismer wrote:
> >>But when I then run my test actually with the --view option,
> >>this option is simply ignored. No error message, the test
> >>runs, but no PyGame window.
> >
> >It's because the option is stored in the conftest module imported from
> >the *copied* file, but then the test itself does "from pypy import
> >conftest", which gets a new copy of the module, this time from the
> >*original* file and with all options set to their defaults.
> >
> >A way to get this right is to create your own conftest.py that imports
> >the one from PyPy, instead of copying it:
> >
> >    from pypy.conftest import *
> 
> Ahh, that's most interesting.
> It works nicely!
> You are just a feakin' genious

no doubt about this :)  sidenote: i think we need to a
bit more restrictive or specific about "conftest.py" usage
... note btw, there is "--traceconfig" where py.test shows which
conftest.py files it uses.  

Most confusing is: "globally" importable "conftest.py" are imported
in a mangled way - thus the module that py.test sees as a tool 
is not identical to the module you get from a global "import conftest". 
This can lead to subtle problems.   The reason for this "mangling"
of global conftest.py files is that there are real life uses 
of multiple global conftest's (e.g. one of them residing in 
Armin's home directory globally configuring py.test to use 
his hacked RXVT terminal and then e.g. the pypy-dist/conftest.py 
file etc.).  I am still wondering on how to best simplify 
the situation. 

    holger



More information about the Pypy-dev mailing list