diff options
| author | Nasser Grainawi <nasser.grainawi@oss.qualcomm.com> | 2026-04-15 10:50:05 -0700 |
|---|---|---|
| committer | gerrit-scoped@luci-project-accounts.iam.gserviceaccount.com <gerrit-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2026-04-22 17:05:55 -0700 |
| commit | 03fb18109fb0db2522f36309242d16d0f83f17d2 (patch) | |
| tree | c2ee646907f144db82acc8ba8f05f396725c5ac4 /tests/conftest.py | |
| parent | 5af71ce907848a546199f0d64a5dfba1db8adca0 (diff) | |
| download | git-repo-03fb18109fb0db2522f36309242d16d0f83f17d2.tar.gz | |
color: type SetDefaultColoring and drop bool states
Also add a test fixture to always disable coloring so that we get
reproducible test behavior. The few tests that want to check color
behavior (e.g. test_color.py) can still reset/change color values as
needed.
Change-Id: I1808139a63e0862c29bf81d7097e885ca8561040
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/573621
Reviewed-by: Gavin Mak <gavinmak@google.com>
Reviewed-by: Mike Frysinger <vapier@google.com>
Commit-Queue: Nasser Grainawi <nasser.grainawi@oss.qualcomm.com>
Tested-by: Nasser Grainawi <nasser.grainawi@oss.qualcomm.com>
Diffstat (limited to 'tests/conftest.py')
| -rw-r--r-- | tests/conftest.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/conftest.py b/tests/conftest.py index a13edd7af..ce3c3d6ce 100644 --- a/tests/conftest.py +++ b/tests/conftest.py | |||
| @@ -18,6 +18,7 @@ import pathlib | |||
| 18 | 18 | ||
| 19 | import pytest | 19 | import pytest |
| 20 | 20 | ||
| 21 | import color | ||
| 21 | import platform_utils | 22 | import platform_utils |
| 22 | import repo_trace | 23 | import repo_trace |
| 23 | 24 | ||
| @@ -28,6 +29,16 @@ def disable_repo_trace(tmp_path): | |||
| 28 | repo_trace._TRACE_FILE = str(tmp_path / "TRACE_FILE_from_test") | 29 | repo_trace._TRACE_FILE = str(tmp_path / "TRACE_FILE_from_test") |
| 29 | 30 | ||
| 30 | 31 | ||
| 32 | @pytest.fixture(autouse=True) | ||
| 33 | def restore_default_coloring() -> None: | ||
| 34 | """Force disable color for reproducible test behavior. | ||
| 35 | |||
| 36 | The few tests that cover color behavior can still reset/change the color as | ||
| 37 | needed. | ||
| 38 | """ | ||
| 39 | color.SetDefaultColoring("never") | ||
| 40 | |||
| 41 | |||
| 31 | # adapted from pytest-home 0.5.1 | 42 | # adapted from pytest-home 0.5.1 |
| 32 | def _set_home(monkeypatch, path: pathlib.Path): | 43 | def _set_home(monkeypatch, path: pathlib.Path): |
| 33 | """ | 44 | """ |
