mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
do not disable colorama in tests (#9187)
skip disabling colorama in tests It might affect pytest as it wraps sys.stderr/sys.stdout for capsys fixture. This is a temporary hack, as we might get rid of colorama soon.
This commit is contained in:
+5
-2
@@ -1,4 +1,4 @@
|
||||
from contextlib import contextmanager
|
||||
from contextlib import contextmanager, nullcontext
|
||||
from typing import (
|
||||
TYPE_CHECKING,
|
||||
Any,
|
||||
@@ -132,9 +132,12 @@ class Console:
|
||||
sort_keys=sort_keys,
|
||||
)
|
||||
if not highlight:
|
||||
import os
|
||||
|
||||
# we don't need colorama to try to strip ansi codes
|
||||
# when highlighting is disabled
|
||||
with disable_colorama():
|
||||
ctx = nullcontext() if "DVC_TEST" in os.environ else disable_colorama()
|
||||
with ctx:
|
||||
return self.write(json.text, stderr=stderr)
|
||||
return self.rich_print(json, stderr=stderr, soft_wrap=True)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user