Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions rege/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
"""Test-session setup shared by the rege test suite.

``rege.formatting`` reads ``NO_COLOR`` once at import time and blanks every
``Colors`` attribute when it is set. Agent harnesses and many CI shells export
``NO_COLOR=1``, which made the colour tests fail depending on the caller's
environment rather than the code (issue #34). Clear it before any test module
imports ``rege.formatting``; tests that exercise the NO_COLOR path set it
themselves with ``monkeypatch``/``patch.dict``.
"""

import os

os.environ.pop("NO_COLOR", None)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Medium · Caller loses its colour setting

When pytest is invoked with pytest.main() in a long-lived process whose environment has NO_COLOR set, os.environ.pop removes the caller’s NO_COLOR in the pytest host process, and this conftest has no teardown to restore it, so subsequent application output in that process includes ANSI colours.

Save the original value and restore it in a pytest session teardown hook.

Prompt for AI agents
In `rege/tests/conftest.py` at line 13:

**Caller loses its colour setting**

When pytest is invoked with `pytest.main()` in a long-lived process whose environment has `NO_COLOR` set, `os.environ.pop` removes the caller’s `NO_COLOR` in the pytest host process, and this conftest has no teardown to restore it, so subsequent application output in that process includes ANSI colours.

Save the original value and restore it in a pytest session teardown hook.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚪ Low · Change lacks narrative counterpart

When this PR adds test-suite setup without a docs/logos/ update, the added test-session environment change has no corresponding entry in docs/logos/, so the required narrative record omits this change.

Add a corresponding update to the narrative record in docs/logos/.

Prompt for AI agents
In `rege/tests/conftest.py` at line 13:

**Change lacks narrative counterpart**

When this PR adds test-suite setup without a `docs/logos/` update, the added test-session environment change has no corresponding entry in `docs/logos/`, so the required narrative record omits this change.

Add a corresponding update to the narrative record in `docs/logos/`.

From GEMINI.md L181:

Nature demands a documentation counterpart. This formation maintains its narrative record in `docs/logos/`.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Medium · Verify module-state isolation

The issue asks to reproduce the Colors tests individually and after tests that disable colors before attributing the failures. This setup clears ambient NO_COLOR, but the receipt does not establish whether order-dependent module-state failures persist.

Prompt for AI agents
In `rege/tests/conftest.py` at line 13:

**Verify module-state isolation**

The issue asks to reproduce the Colors tests individually and after tests that disable colors before attributing the failures. This setup clears ambient NO_COLOR, but the receipt does not establish whether order-dependent module-state failures persist.

From #34:

Reproduce the Colors tests individually and after tests that disable colors; make isolation deterministic only if the defect persists.

Loading