Skip to content

Commit

Permalink
Add mock for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
wenzeslaus committed May 3, 2024
1 parent 7cfab05 commit b5d8256
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions python/grass/script/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
"""Fixtures for grass.script"""

import pytest


@pytest.fixture
def mock_no_session(monkeypatch):
"""Set the environment variables as if there would be no background session.
Use with usefixtures (not as a paramter) to avoid warnings about an unused
parameter::
@pytest.mark.usefixtures("mock_no_session")
def test_session_handling():
pass
There may or may not be a session in the background (we don't check either way).
"""
monkeypatch.delenv("GISRC", raising=False)
monkeypatch.delenv("GISBASE", raising=False)

0 comments on commit b5d8256

Please sign in to comment.