| 1 |
import os |
| 2 |
|
| 3 |
import pytest |
| 4 |
|
| 5 |
import grass.script as gs |
| 6 |
from grass.tools import Tools |
| 7 |
|
| 8 |
|
| 9 |
@pytest.fixture |
| 10 |
def xy_dataset_session(tmp_path): |
| 11 |
"""Active session in an XY location (scope: function)""" |
| 12 |
project = tmp_path / "xy_test" |
| 13 |
gs.create_project(project) |
| 14 |
with ( |
| 15 |
gs.setup.init(project, env=os.environ.copy()) as session, |
| 16 |
Tools(session=session) as tools, |
| 17 |
): |
| 18 |
tools.g_region(s=0, n=5, w=0, e=6, res=1) |
| 19 |
tools.r_mapcalc(expression="rows_raster = row()") |
| 20 |
yield session |