Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

grass.jupyter: Fix session tests on Windows #4368

Merged
merged 1 commit into from
Sep 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 4 additions & 14 deletions python/grass/jupyter/tests/grass_jupyter_session_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
import os
import sys

import pytest


# All init tests change the global environment, but we use a separate process
# only when it is necessary.
Expand All @@ -22,19 +20,15 @@ def run_in_subprocess(file):
return process.stdout


@pytest.mark.xfail(
sys.platform == "win32",
reason="tmp_path string in interpolated code should be escaped or use raw strings",
)
def test_init_finish(tmp_path):
"""Check that init function works with an explicit session finish"""
location = "test"
script = f"""
import os
import grass.script as gs
import grass.jupyter as gj
gs.core._create_location_xy("{tmp_path}", "{location}")
session = gj.init("{tmp_path / location}")
gs.core._create_location_xy(r"{tmp_path}", r"{location}")
session = gj.init(r"{tmp_path / location}")
gs.read_command("g.region", flags="p")
print(os.environ["GISRC"])
session.finish()
Expand All @@ -48,19 +42,15 @@ def test_init_finish(tmp_path):
assert not os.path.exists(session_file), f"Session file {session_file} not deleted"


@pytest.mark.xfail(
sys.platform == "win32",
reason="tmp_path string in interpolated code should be escaped or use raw strings",
)
def test_init_with_auto_finish(tmp_path):
"""Check that init function works with an implicit session finish"""
location = "test"
script = f"""
import os
import grass.script as gs
import grass.jupyter as gj
gs.core._create_location_xy("{tmp_path}", "{location}")
session = gj.init("{tmp_path / location}")
gs.core._create_location_xy(r"{tmp_path}", r"{location}")
session = gj.init(r"{tmp_path / location}")
print(os.environ["GISRC"])
"""

Expand Down
Loading