Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tests when NO_COLOR is set in the calling environment #12415

Merged
merged 3 commits into from
Mar 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ on:
schedule:
- cron: 0 0 * * MON # Run every Monday at 00:00 UTC

env:
# The "FORCE_COLOR" variable, when set to 1,
# tells Nox to colorize itself.
FORCE_COLOR: "1"

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
Expand Down
Empty file.
4 changes: 4 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,10 @@ def isolate(tmpdir: Path, monkeypatch: pytest.MonkeyPatch) -> None:
# Make sure tests don't share a requirements tracker.
monkeypatch.delenv("PIP_BUILD_TRACKER", False)

# Make sure color control variables don't affect internal output.
monkeypatch.delenv("FORCE_COLOR", False)
monkeypatch.delenv("NO_COLOR", False)

# FIXME: Windows...
os.makedirs(os.path.join(home_dir, ".config", "git"))
with open(os.path.join(home_dir, ".config", "git", "config"), "wb") as fp:
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/test_inspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from tests.lib import PipTestEnvironment, ScriptFactory, TestData


@pytest.fixture(scope="session")
@pytest.fixture
def simple_script(
tmpdir_factory: pytest.TempPathFactory,
script_factory: ScriptFactory,
Expand Down