diff options
Diffstat (limited to 'nixos/lib/test-driver')
-rw-r--r-- | nixos/lib/test-driver/test_driver/driver.py | 2 | ||||
-rw-r--r-- | nixos/lib/test-driver/test_driver/logger.py | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/nixos/lib/test-driver/test_driver/driver.py b/nixos/lib/test-driver/test_driver/driver.py index f792c04591996..7dfbfdcf1c2aa 100644 --- a/nixos/lib/test-driver/test_driver/driver.py +++ b/nixos/lib/test-driver/test_driver/driver.py @@ -99,7 +99,7 @@ class Driver: def subtest(self, name: str) -> Iterator[None]: """Group logs under a given test name""" - with rootlog.nested("subtest: " + name): + with rootlog.subtest(name): try: yield return True diff --git a/nixos/lib/test-driver/test_driver/logger.py b/nixos/lib/test-driver/test_driver/logger.py index 0b0623bddfa1e..1b802f992f640 100644 --- a/nixos/lib/test-driver/test_driver/logger.py +++ b/nixos/lib/test-driver/test_driver/logger.py @@ -80,6 +80,11 @@ class Logger: pass @contextmanager + def subtest(self, name: str, attributes: Dict[str, str] = {}) -> Iterator[None]: + with self.nested("subtest: " + name, attributes): + yield + + @contextmanager def nested(self, message: str, attributes: Dict[str, str] = {}) -> Iterator[None]: self._eprint( self.maybe_prefix( |