On Sat, Aug 20, 2016 at 7:34 AM, Brett Cannon <br...@python.org> wrote: >> 1) Demand that .pth files restrict themselves to what's already >> imported. This means startup is still fast even if you have a bunch of >> pths. Downside: Third-party code can break Python's rules. Upside: >> When they do, it can be reported as a bug, the fixing of which will >> improve startup times when that's installed. >> >> 2) Change the test to somehow disable .pth execution while keeping the >> rest of site.py intact. This gives more consistent test results, but >> still is mostly applicable to normal usage. >> >> 3) Ignore the problem and assume that the Python test suite will be >> run with no site-packages installed. Status quo, basically. Possibly >> with some tweaks so running 'make test' ignores site-packages? >> >> Is #2 doable? > > > Anything is doable given enough time and effort. ;) As of right now the only > way is with -S.
Heh. I guess what I really mean is: Is #2 a good idea, or would it be considered horrendously hacky? This is my itch, so I'm not afraid to be the one to code a solution, but I don't want to make things overall worse to fix one specific use case. >> If not, can 'make test' somehow hack out site-packages? > > > The problem is you're dealing with startup which means it won't come into > effect until it's too late. Yeah, but the 'make test' operation could set an environment variable or something to say "there are no site-packages, kthxbye". Again, there's currently no such facility, and probably that one is a bad idea, as it'd have implications (possibly security implications) for other runnings of Python. Steve's suggestion would keep all the visible hackery in test_site.py, and it's well known that tests often need to do dark and dangerous things. On Sat, Aug 20, 2016 at 7:51 AM, Steve Dower <steve.do...@python.org> wrote: > > If you start the process with "-S", then run: > > import site > site.addpackage = lambda *a: None > site.main() > # rest of the test > > Then that should do it. This will cut out all .pth processing, but shouldn't > affect any of the other steps. If I make a patch to do that, would it have a good chance of being accepted? ChrisA _______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com