[Python-Dev] Failures in test_site.py - how to debug?

Random832 random832 at fastmail.com
Fri Aug 19 22:55:32 EDT 2016


On Fri, Aug 19, 2016, at 18:10, Chris Angelico wrote:
> On Sat, Aug 20, 2016 at 8:07 AM, Sjoerd Job Postmus <sjoerdjob at sjec.nl>
> wrote:
> > I'd like to re-iterate my suggestion in case it was missed: split the
> > current test in 2 tests:
> >
> > * Running with `-S` which is for checking that by default the collections
> > are not imported. (Which is what is currently tested)
> > * Running without `-S` which is for checking that `site` gets imported.
> >
> > I hope that is clear enough. Do you see any problems with such an approach?
> 
> AIUI this wouldn't test that site is sufficiently slim. The test is
> supposed to mimic normal startup, then assert that unnecessary modules
> haven't been loaded. Splitting it would prove that a -S run is nice
> and slim, but would allow bloat in site.py to pass unnoticed.

What about -S and putting "import site" explicitly in the test code? Or
would that go back to importing everything on people who have packages
installed?

Really, there should be a "source-isolated" mode, which removes
/usr/lib/whatever from the path in the same way that -I removes the
user's stuff, but still runs cpython/Lib/site.py , and all tests (and
for that matter stuff like frozen module prep) should be run in this
mode.

I'm not sure I see a downside to having such a mode be the *default*
mode for "python detects it is being run from a source tree".


More information about the Python-Dev mailing list