From 1a7ae3bfc23a132687a28e805c79131f7f9dbdce Mon Sep 17 00:00:00 2001 From: Thomas Madlener Date: Wed, 7 Dec 2022 11:59:45 +0100 Subject: [PATCH] Make assertRaisesRegex available in python2 --- scripts/tests/Test_Tagging.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/tests/Test_Tagging.py b/scripts/tests/Test_Tagging.py index 24a8c62f..bcbf9404 100644 --- a/scripts/tests/Test_Tagging.py +++ b/scripts/tests/Test_Tagging.py @@ -11,7 +11,13 @@ except ImportError: # for python3 import builtins builtin_module_name = 'builtins' + import unittest +try: # monkey patch python2 to also use non-deprecated functionality + unittest.TestCase.assertRaisesRegex +except AttributeError: + unittest.TestCase.assertRaisesRegex = unittest.TestCase.assertRaisesRegexp + import os import shutil import sys