Author chris.jerdonek
Recipients alexgarel, brett.cannon, chris.jerdonek, michael.foord, r.david.murray, rbcollins, slmnhq
Date 2012-06-04.15:20:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1338823238.93.0.890061818308.issue7559@psf.upfronthosting.co.za>
In-reply-to
Content
Because we don't know if the rest of the test code will adhere to this, we might want to consider clearing the cache before each test as well.

Alternatively, we could avoid having to call importlib.invalidate_caches() at all (and having to think about for which tests it is necessary) if we do each test in a different directory and with a different name for the test package.  We could do the former as follows:

    with support.temp_cwd(support.TESTFN):
        dir_name = self.id().split('.')[-1]  # test method name
        with support.temp_cwd(dir_name) as cwd:
            with support.DirsOnSysPath(cwd):
                # Create package and run test.

An approach like this might be less prone to issues that are hard to troubleshoot.  I verified that it works.
History
Date User Action Args
2012-06-04 15:20:39chris.jerdoneksetrecipients: + chris.jerdonek, brett.cannon, rbcollins, r.david.murray, michael.foord, slmnhq, alexgarel
2012-06-04 15:20:38chris.jerdoneksetmessageid: <1338823238.93.0.890061818308.issue7559@psf.upfronthosting.co.za>
2012-06-04 15:20:38chris.jerdoneklinkissue7559 messages
2012-06-04 15:20:37chris.jerdonekcreate