Merge pull request #168609 from rnhmjoj/pr-test-driver

nixos/test-driver: highlight driver log lines
This commit is contained in:
Jacek Galowicz
2022-04-14 13:09:36 +02:00
committed by GitHub
2 changed files with 7 additions and 3 deletions
+1 -1
View File
@@ -86,7 +86,7 @@ class Driver:
def subtest(self, name: str) -> Iterator[None]:
"""Group logs under a given test name"""
with rootlog.nested(name):
with rootlog.nested("subtest: " + name):
try:
yield
return True
+6 -2
View File
@@ -1,4 +1,4 @@
from colorama import Style
from colorama import Style, Fore
from contextlib import contextmanager
from typing import Any, Dict, Iterator
from queue import Queue, Empty
@@ -81,7 +81,11 @@ class Logger:
@contextmanager
def nested(self, message: str, attributes: Dict[str, str] = {}) -> Iterator[None]:
self._eprint(self.maybe_prefix(message, attributes))
self._eprint(
self.maybe_prefix(
Style.BRIGHT + Fore.GREEN + message + Style.RESET_ALL, attributes
)
)
self.xml.startElement("nest", attrs={})
self.xml.startElement("head", attributes)