Commit 02e8c733 authored by Victor Stinner's avatar Victor Stinner

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
parent 8f7f5a30
...@@ -365,6 +365,10 @@ else: ...@@ -365,6 +365,10 @@ else:
'Unicode filename tests may not be effective' 'Unicode filename tests may not be effective'
% TESTFN_UNICODE_UNENCODEABLE) % 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 # Make sure we can write to TESTFN, try in /tmp if we can't
fp = None fp = None
try: try:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment