Debian Codegraph @

raster/r.mask.status/tests/conftest.py

raw
1 """Fixtures for simple sessions"""
2
3 import os
4 import pytest
5 import grass.script as gs
6
7
8 @pytest.fixture
9 def session_no_data(tmp_path):
10 """Set up a GRASS session for the tests."""
11 project = "test_project"
12 gs.create_project(tmp_path, project)
13 with gs.setup.init(tmp_path / project, env=os.environ.copy()) as session:
14 yield session
15
16
17 @pytest.fixture
18 def session_with_data(tmp_path):
19 """Set up a GRASS session for the tests."""
20 project = tmp_path / "test_project"
21 gs.create_project(project)
22 with gs.setup.init(project, env=os.environ.copy()) as session:
23 gs.run_command("g.region", rows=2, cols=2, env=session.env)
24 gs.mapcalc("a = 1", env=session.env)
25 yield session