Make the test insensitive if it is running in CI or not. Use `@pytest.mark.keep_ci_var` in a test to avoid applying this fixture, letting the test see the real `CI` variable (if present).
(monkeypatch: MonkeyPatch, request: pytest.FixtureRequest)
| 241 | |
| 242 | @pytest.fixture(autouse=True) |
| 243 | def remove_ci_env_var(monkeypatch: MonkeyPatch, request: pytest.FixtureRequest) -> None: |
| 244 | """Make the test insensitive if it is running in CI or not. |
| 245 | |
| 246 | Use `@pytest.mark.keep_ci_var` in a test to avoid applying this fixture, letting the test |
| 247 | see the real `CI` variable (if present). |
| 248 | """ |
| 249 | has_keep_ci_mark = request.node.get_closest_marker("keep_ci_var") is not None |
| 250 | if not has_keep_ci_mark: |
| 251 | monkeypatch.delenv("CI", raising=False) |
nothing calls this directly
no test coverage detected