We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent cf8597b commit 40a42f5Copy full SHA for 40a42f5
1 file changed
tests/conftest.py
@@ -1,4 +1,5 @@
1
import json
2
+from importlib import resources
3
from pathlib import Path
4
5
import pytest
@@ -17,3 +18,17 @@ def user_filesystem(tmp_path):
17
18
json.dump(home_config_data, f)
19
20
yield tmp_path
21
+
22
23
+def get_datafile(filename):
24
+ return str(resources.files(__package__).joinpath("testdata/" + filename))
25
26
27
+@pytest.fixture
28
+def datafile():
29
+ """Fixture to dynamically load any test file."""
30
31
+ def _load(filename):
32
+ return get_datafile(filename)
33
34
+ return _load
0 commit comments