Skip to content

Commit 40f9fe7

Browse files
committed
use liberal pattern to check whether makedirs wrapper raises an exception if directory already exists, so the check passes with both Python 2 and 3
1 parent 2048143 commit 40f9fe7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

test/framework/filetools.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3396,7 +3396,8 @@ def test_compat_makedirs(self):
33963396
self.assertNotExists(name)
33973397
py2vs3.makedirs(name)
33983398
self.assertExists(name)
3399-
self.assertErrorRegex(Exception, os.path.basename(name), py2vs3.makedirs, name)
3399+
# exception is raised because file exists (OSError in Python 2, FileExistsError in Python 3)
3400+
self.assertErrorRegex(Exception, '.*', py2vs3.makedirs, name)
34003401
py2vs3.makedirs(name, exist_ok=True) # No error
34013402
self.assertExists(name)
34023403

0 commit comments

Comments
 (0)