diff options
author | Xavier Claessens <xavier.claessens@collabora.com> | 2018-05-13 10:36:58 -0400 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek.chauhan@gmail.com> | 2018-06-06 20:02:37 +0000 |
commit | b38452636cc25ffd38d379645607f1563de59d80 (patch) | |
tree | 1853b59217d548ceaa99b59661c21ac0865f0f84 /run_unittests.py | |
parent | f4d60acaa924b4735fc71b7a9c716fbea824c877 (diff) | |
download | meson-b38452636cc25ffd38d379645607f1563de59d80.zip meson-b38452636cc25ffd38d379645607f1563de59d80.tar.gz meson-b38452636cc25ffd38d379645607f1563de59d80.tar.bz2 |
Fix command line unit test not actually testing failure message
self.init() raise an exception so anything else in the 'with' block is
not executed.
Diffstat (limited to 'run_unittests.py')
-rwxr-xr-x | run_unittests.py | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/run_unittests.py b/run_unittests.py index 715dbe2..5d60d99 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -563,7 +563,7 @@ class BasePlatformTests(unittest.TestCase): if p.returncode != 0: if 'MESON_SKIP_TEST' in p.stdout: raise unittest.SkipTest('Project requested skipping.') - raise subprocess.CalledProcessError(p.returncode, command) + raise subprocess.CalledProcessError(p.returncode, command, output=p.stdout) return p.stdout def init(self, srcdir, extra_args=None, default_args=True, inprocess=False): @@ -2094,14 +2094,15 @@ recommended as it can lead to undefined behaviour on some platforms''') self.wipe() # Mixing --option and -Doption is forbidden - with self.assertRaises(subprocess.CalledProcessError) as e: + with self.assertRaises(subprocess.CalledProcessError) as cm: self.init(testdir, extra_args=['--warnlevel=1', '-Dwarning_level=3']) - self.assertNotEqual(0, e.returncode) - self.assertIn('passed as both', e.stderr) - with self.assertRaises(subprocess.CalledProcessError) as e: - self.setconf('--warnlevel=1', '-Dwarning_level=3') - self.assertNotEqual(0, e.returncode) - self.assertIn('passed as both', e.stderr) + self.assertNotEqual(0, cm.exception.returncode) + self.assertIn('as both', cm.exception.output) + self.init(testdir) + with self.assertRaises(subprocess.CalledProcessError) as cm: + self.setconf(['--warnlevel=1', '-Dwarning_level=3']) + self.assertNotEqual(0, cm.exception.returncode) + self.assertIn('as both', cm.exception.output) self.wipe() # --default-library should override default value from project() |