Skip to content

Commit 7fc49c4

Browse files
Fix/address flaky tests (#289)
1 parent 19e36b4 commit 7fc49c4

2 files changed

Lines changed: 9 additions & 7 deletions

File tree

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:

tests/unit/conftest.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import pytest # type: ignore
22

3-
from grimp.application.config import settings
43
from grimp.application.graph import ImportGraph
54
from grimp.adaptors.modulefinder import ModuleFinder
5+
from tests.config import override_settings
66

77

88
@pytest.fixture(scope="module", autouse=True)
99
def configure_unit_tests():
10-
settings.configure(
10+
with override_settings(
1111
IMPORT_GRAPH_CLASS=ImportGraph,
1212
MODULE_FINDER=ModuleFinder(),
1313
FILE_SYSTEM=None,
14-
)
14+
):
15+
yield

0 commit comments

Comments
 (0)