Skip to content

Commit

Permalink
use liberal pattern to check whether makedirs wrapper raises an excep…
Browse files Browse the repository at this point in the history
…tion if directory already exists, so the check passes with both Python 2 and 3
  • Loading branch information
boegel committed Aug 15, 2023
1 parent 2048143 commit 40f9fe7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion test/framework/filetools.py
Original file line number Diff line number Diff line change
Expand Up @@ -3396,7 +3396,8 @@ def test_compat_makedirs(self):
self.assertNotExists(name)
py2vs3.makedirs(name)
self.assertExists(name)
self.assertErrorRegex(Exception, os.path.basename(name), py2vs3.makedirs, name)
# exception is raised because file exists (OSError in Python 2, FileExistsError in Python 3)
self.assertErrorRegex(Exception, '.*', py2vs3.makedirs, name)
py2vs3.makedirs(name, exist_ok=True) # No error
self.assertExists(name)

Expand Down

0 comments on commit 40f9fe7

Please sign in to comment.