Skip to content

Commit 43ecc66

Browse files
committed
Fix config and console regressions
1 parent 4c5fcbd commit 43ecc66

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

src/_pytask/config.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,14 @@ def is_file_system_case_sensitive() -> bool:
6464
@hookimpl
6565
def pytask_configure(pm: PluginManager, raw_config: dict[str, Any]) -> dict[str, Any]:
6666
"""Configure pytask."""
67-
# Add all values by default so that many plugins do not need to copy over values.
6867
markers = raw_config.get("markers", {})
6968
if not isinstance(markers, (dict, list, tuple)):
7069
msg = "'markers' must be a mapping or a sequence of marker definitions."
7170
raise TypeError(msg)
72-
config = {"pm": pm, "markers": parse_markers(markers)} | raw_config
71+
72+
# Add all values by default so that many plugins do not need to copy over values.
73+
config = {"pm": pm, "markers": {}} | raw_config
74+
config["markers"] = parse_markers(markers)
7375

7476
pm.hook.pytask_parse_config(config=config)
7577
pm.hook.pytask_post_parse(config=config)

src/_pytask/console.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import functools
66
import inspect
77
from contextlib import suppress
8+
from copy import copy
89
from pathlib import Path
910
from typing import TYPE_CHECKING
1011
from typing import Any
@@ -111,10 +112,15 @@ def render_to_string(
111112
example, render warnings with colors or text in exceptions.
112113
113114
"""
114-
buffer = console.render(renderable)
115+
render_console = console
116+
if not strip_styles and console.no_color:
117+
render_console = copy(console)
118+
render_console.no_color = False
119+
120+
buffer = render_console.render(renderable)
115121
if strip_styles:
116122
buffer = Segment.strip_styles(buffer)
117-
return console._render_buffer(buffer)
123+
return render_console._render_buffer(buffer)
118124

119125

120126
def format_task_name(task: PTask, editor_url_scheme: str) -> Text:

0 commit comments

Comments
 (0)