Skip to content

Commit 1a7ae3b

Browse files
committed
Make assertRaisesRegex available in python2
1 parent c72d716 commit 1a7ae3b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

scripts/tests/Test_Tagging.py

+6
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,13 @@
1111
except ImportError: # for python3
1212
import builtins
1313
builtin_module_name = 'builtins'
14+
1415
import unittest
16+
try: # monkey patch python2 to also use non-deprecated functionality
17+
unittest.TestCase.assertRaisesRegex
18+
except AttributeError:
19+
unittest.TestCase.assertRaisesRegex = unittest.TestCase.assertRaisesRegexp
20+
1521
import os
1622
import shutil
1723
import sys

0 commit comments

Comments
 (0)