[Python-Dev] cpython: Issue #14080: fix sporadic test_imp failure. Patch by Stefan Krah. (original) (raw)

Antoine Pitrou solipsis at pitrou.net
Sun Feb 26 23:00:06 CET 2012


On Sun, 26 Feb 2012 16🔞54 -0500 Brett Cannon <brett at python.org> wrote:

> > diff --git a/Lib/test/testimp.py b/Lib/test/testimp.py > --- a/Lib/test/testimp.py > +++ b/Lib/test/testimp.py > @@ -325,6 +325,7 @@ > self.addCleanup(cleanup) > # Touch the init.py file. > support.createemptyfile('pep3147/init.py') > + importlib.invalidatecaches() > expected_file = os.sep.join(('.', 'pep3147', 'init.py'))_ > m = import('pep3147') > self.assertEqual(m.file, expected_file, (m.file,_ > m.path))

Should that just go into support.createemptyfile()? Since it's just a performance issue I don't see it causing unexpected test failures and it might help with any future issues.

I don't think adding import-specific workarounds in create_empty_file() is a very good idea. (I'm also not sure why that function exists)

Regards

Antoine.



More information about the Python-Dev mailing list