Skip to content

Commit 0d312d3

Browse files
Use more robust path handling in test_syntax_error_includes_module to avoid flakiness when running via VS Code GUI
1 parent ce83089 commit 0d312d3

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

tests/functional/test_error_handling.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
import os
1+
from pathlib import Path
22

33
import pytest # type: ignore
44

55
from grimp import build_graph, exceptions
66

77

88
def test_syntax_error_includes_module():
9-
dirname = os.path.dirname(__file__)
10-
filename = os.path.abspath(
11-
os.path.join(dirname, "..", "assets", "syntaxerrorpackage", "foo", "one.py")
9+
filename = str(
10+
(
11+
Path(__file__).parent.parent / "assets" / "syntaxerrorpackage" / "foo" / "one.py"
12+
).resolve()
1213
)
1314

1415
with pytest.raises(exceptions.SourceSyntaxError) as excinfo:

0 commit comments

Comments
 (0)