From: Victor Stinner Date: Fri, 14 May 2010 20:08:55 +0000 (+0000) Subject: test/support.py: remove TESTFN if it is a directory X-Git-Tag: v3.1.3rc1~769 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7f6423a0b42a53cba4879aa97dd3702811b86278;p=python test/support.py: remove TESTFN if it is a directory Because of my previous commit (r81171), test_os failed without removing TESTFN directory (shutil.rmtree() was broken). Some buildbots still have a @test directory and some tests fail because of that. The bug is reproductible with: mkdir @test touch @test/abc ./python Lib/test/regrtest.py test_site --- diff --git a/Lib/test/support.py b/Lib/test/support.py index 08828a82df..e3a3b38333 100644 --- a/Lib/test/support.py +++ b/Lib/test/support.py @@ -365,6 +365,10 @@ else: 'Unicode filename tests may not be effective' % TESTFN_UNICODE_UNENCODEABLE) +if os.path.isdir(TESTFN): + # a test failed (eg. test_os) without removing TESTFN directory + shutil.rmtree(TESTFN) + # Make sure we can write to TESTFN, try in /tmp if we can't fp = None try: