diff --git a/unittests/failuretests.py b/unittests/failuretests.py index a966a0ac4c1f..42ee9ed97a10 100644 --- a/unittests/failuretests.py +++ b/unittests/failuretests.py @@ -248,8 +248,8 @@ def test_objc_detection(self) -> None: env = get_fake_env() try: detect_objc_compiler(env, MachineChoice.HOST) - except EnvironmentException: - self.assertMesonRaises("add_languages('objc')", r"(Unknown compiler|GCC was not built with support)") + except EnvironmentException as e: + self.assertRegex(str(e), r"(Unknown compiler|GCC was not built with support)") else: raise unittest.SkipTest('Working objective-c Compiler found, cannot test error.') @@ -257,8 +257,8 @@ def test_objcpp_detection(self) -> None: env = get_fake_env() try: detect_objcpp_compiler(env, MachineChoice.HOST) - except EnvironmentException: - self.assertMesonRaises("add_languages('objcpp')", r"(Unknown compiler|GCC was not built with support)") + except EnvironmentException as e: + self.assertRegex(str(e), r"(Unknown compiler|GCC was not built with support)") else: raise unittest.SkipTest('Working objective-c++ Compiler found, cannot test error.')