From 5db0d86b5c7c7f04589e67db859578793a967808 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Mon, 30 Nov 2020 15:32:47 -0800 Subject: [PATCH] run_unittests: make another test inprocess safe --- run_unittests.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/run_unittests.py b/run_unittests.py index 2219dedb4..b3402572b 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -8455,9 +8455,13 @@ class NativeFileTests(BasePlatformTests): testcase = os.path.join(self.common_test_dir, '224 persubproject options') config = self.helper_create_native_file({'sub2:built-in options': {'default_library': 'shared'}}) - with self.assertRaises(subprocess.CalledProcessError) as cm: + with self.assertRaises((RuntimeError, subprocess.CalledProcessError)) as cm: self.init(testcase, extra_args=['--native-file', config]) - self.assertIn(cm.exception.stdout, 'Parent should override default_library') + if isinstance(cm, RuntimeError): + check = str(cm.exception) + else: + check = cm.exception.stdout + self.assertIn(check, 'Parent should override default_library') def test_builtin_options_subprojects_dont_inherits_parent_override(self): # If the buildfile says subproject(... default_library: shared), ensure that's overwritten