This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author christian.heimes
Recipients christian.heimes, gvanrossum
Date 2007-11-12.19:14:35
SpamBayes Score 0.07051189
Marked as misclassified No
Message-id <1194894875.63.0.0908101332141.issue1414@psf.upfronthosting.co.za>
In-reply-to
Content
How do you like;

class TestPkg(unittest.TestCase):

    def setUp(self):
        self.root = None
        self.syspath = list(sys.path)
        self.sysmodules = sys.modules.copy()

    def tearDown(self):
        sys.path[:] = self.syspath
        sys.modules.clear()
        sys.modules.update(self.sysmodules)
        del self.sysmodules
        cleanout(self.root)

Or I could use the paranoid approach: create set from sys.modules.keys()
in setUp + tearDown and remove the items that are in the second set but
not in the first set.
History
Date User Action Args
2007-11-12 19:14:35christian.heimessetspambayes_score: 0.0705119 -> 0.07051189
recipients: + christian.heimes, gvanrossum
2007-11-12 19:14:35christian.heimessetspambayes_score: 0.0705119 -> 0.0705119
messageid: <1194894875.63.0.0908101332141.issue1414@psf.upfronthosting.co.za>
2007-11-12 19:14:35christian.heimeslinkissue1414 messages
2007-11-12 19:14:35christian.heimescreate