forked from mirrors/nixpkgs
Merge pull request #168609 from rnhmjoj/pr-test-driver
nixos/test-driver: highlight driver log lines
This commit is contained in:
commit
6b414c5b66
|
@ -86,7 +86,7 @@ class Driver:
|
||||||
|
|
||||||
def subtest(self, name: str) -> Iterator[None]:
|
def subtest(self, name: str) -> Iterator[None]:
|
||||||
"""Group logs under a given test name"""
|
"""Group logs under a given test name"""
|
||||||
with rootlog.nested(name):
|
with rootlog.nested("subtest: " + name):
|
||||||
try:
|
try:
|
||||||
yield
|
yield
|
||||||
return True
|
return True
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from colorama import Style
|
from colorama import Style, Fore
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
from typing import Any, Dict, Iterator
|
from typing import Any, Dict, Iterator
|
||||||
from queue import Queue, Empty
|
from queue import Queue, Empty
|
||||||
|
@ -81,7 +81,11 @@ class Logger:
|
||||||
|
|
||||||
@contextmanager
|
@contextmanager
|
||||||
def nested(self, message: str, attributes: Dict[str, str] = {}) -> Iterator[None]:
|
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("nest", attrs={})
|
||||||
self.xml.startElement("head", attributes)
|
self.xml.startElement("head", attributes)
|
||||||
|
|
Loading…
Reference in a new issue