diff options
| author | Dylan Baker <dylan@pnwbakers.com> | 2025-03-04 12:57:40 -0800 |
|---|---|---|
| committer | Eli Schwartz <eschwartz93@gmail.com> | 2025-03-06 23:01:53 -0500 |
| commit | f64cda3d80f34db42cc59fefd3abbe904fc3231a (patch) | |
| tree | 73166ee94b18f44bc9771131ea6a75e50fc1ac72 /unittests/platformagnostictests.py | |
| parent | e7a405c7e2a384e68c39ee3d6397a974df4df36f (diff) | |
| download | meson-f64cda3d80f34db42cc59fefd3abbe904fc3231a.tar.gz | |
unittests: Use more subtests
Diffstat (limited to 'unittests/platformagnostictests.py')
| -rw-r--r-- | unittests/platformagnostictests.py | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/unittests/platformagnostictests.py b/unittests/platformagnostictests.py index 5707553ba..cb6a931fc 100644 --- a/unittests/platformagnostictests.py +++ b/unittests/platformagnostictests.py @@ -167,21 +167,25 @@ class PlatformAgnosticTests(BasePlatformTests): self.init(testdir) # no-op change works - self.setconf(f'--backend=ninja') - self.init(testdir, extra_args=['--reconfigure', '--backend=ninja']) + with self.subTest('set the option to the same value'): + self.setconf('--backend=ninja') + self.init(testdir, extra_args=['--reconfigure', '--backend=ninja']) # Change backend option is not allowed - with self.assertRaises(subprocess.CalledProcessError) as cm: - self.setconf('-Dbackend=none') - self.assertIn("ERROR: Tried to modify read only option 'backend'", cm.exception.stdout) + with self.subTest('Changing the backend'): + with self.assertRaises(subprocess.CalledProcessError) as cm: + self.setconf('-Dbackend=none') + self.assertIn("ERROR: Tried to modify read only option 'backend'", cm.exception.stdout) # Check that the new value was not written in the store. - self.assertEqual(self.getconf('backend'), 'ninja') + with self.subTest('option is stored correctly'): + self.assertEqual(self.getconf('backend'), 'ninja') # Wipe with a different backend is allowed - self.init(testdir, extra_args=['--wipe', '--backend=none']) + with self.subTest('Changing the backend with wipe'): + self.init(testdir, extra_args=['--wipe', '--backend=none']) - self.assertEqual(self.getconf('backend'), 'none') + self.assertEqual(self.getconf('backend'), 'none') def test_validate_dirs(self): testdir = os.path.join(self.common_test_dir, '1 trivial') |
