[Python-checkins] cpython: Remove test_importable(). Couldn't see how to make this reliable across all

Nick Coghlan ncoghlan at gmail.com
Fri Mar 25 12:37:09 CET 2011


On Fri, Mar 25, 2011 at 3:51 AM, raymond.hettinger
<python-checkins at python.org> wrote:
> http://hg.python.org/cpython/rev/5adddc6be3c1
> changeset:   68902:5adddc6be3c1
> user:        Raymond Hettinger <python at rcn.com>
> date:        Thu Mar 24 10:51:06 2011 -0700
> summary:
>  Remove test_importable().  Couldn't see how to make this reliable across all platforms.

For this particular use case, a temporary directory added to sys,path,
then some subsequent cleanup of sys.modules, sys.path and
sys.path_importer_cache would likely do the trick.

I've actually never been a fan of using TESTFN in tests - the tempfile
module always struck me as being significantly more useful. It also
makes tidying up the files afterwards really easy - the temporary
directory context manager will blow everything away for you.

Then again, quite a few of the tests I've written involved convoluted
module hierarchies, so I'm likely a little biased by my typical use
cases :)

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia


More information about the Python-checkins mailing list