Skip to content

Commit

Permalink
Simplify clean_env() fixture
Browse files Browse the repository at this point in the history
Simplify the clean_env() fixture to build upon pytest's monkeypatch
fixture.
  • Loading branch information
mgorny committed Nov 24, 2023
1 parent 354ed73 commit 5c50df4
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import os

import pytest

import click
Expand All @@ -12,9 +10,6 @@ def runner():


@pytest.fixture(autouse=True)
def clean_env():
old = dict(os.environ)
os.environ.pop("FORCE_COLOR", None)
os.environ.pop("NO_COLOR", None)
yield
os.environ = old
def clean_env(monkeypatch):
monkeypatch.delenv("FORCE_COLOR", raising=False)
monkeypatch.delenv("NO_COLOR", raising=False)

0 comments on commit 5c50df4

Please sign in to comment.