Skip to content

Commit bfe02aa

Browse files
authored
Merge pull request #2052 from leannchen86/fix/lux-use-stdlib-importlib
Fix Lux autogen test in clean installs
2 parents 2b2ac8d + 2d844f6 commit bfe02aa

1 file changed

Lines changed: 6 additions & 13 deletions

File tree

mpcontribs-lux/tests/test_autogen.py

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
"""Test and demo automatic generation of schemas."""
22

33
import gzip
4-
from importlib_resources import files as import_module_path
54
import importlib.util
65
import json
76
from pathlib import Path
@@ -22,20 +21,14 @@ def dynamically_load_module_from_path(path: Path, module_name: str):
2221

2322

2423
def test_schema_generation(test_dir):
25-
26-
base_module_path = import_module_path("mpcontribs.lux")
24+
example_file = (
25+
Path(__file__).resolve().parents[1]
26+
/ "examples"
27+
/ "cubic_solid_expt_data.json.gz"
28+
)
2729

2830
temp_file = NamedTemporaryFile(suffix=".json")
29-
with gzip.open(
30-
(
31-
import_module_path("mpcontribs.lux")
32-
/ ".."
33-
/ ".."
34-
/ "examples"
35-
/ "cubic_solid_expt_data.json.gz"
36-
).resolve(),
37-
"rb",
38-
) as source_file:
31+
with gzip.open(example_file, "rb") as source_file:
3932
temp_file.write(json.dumps(json.load(source_file)["data"]).encode())
4033

4134
temp_file.seek(0)

0 commit comments

Comments
 (0)