Skip to content

Commit 33695a0

Browse files
committed
Remove manual decompression of HPO JSON files - leave that for hpotk
1 parent 86761a1 commit 33695a0

2 files changed

Lines changed: 10 additions & 18 deletions

File tree

tests/conftest.py

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,20 @@
1010
@pytest.fixture(scope="session")
1111
def fpath_test_dir() -> str:
1212
"""
13-
Path to `tests` folder.
13+
Path to `tests/data/` folder.
1414
"""
15-
return os.path.dirname(os.path.abspath(__file__))
15+
return os.path.join(os.path.dirname(__file__), "data")
1616

1717

1818
@pytest.fixture(scope="session")
1919
def fpath_hpo(fpath_test_dir: str) -> str:
20-
return os.path.join(fpath_test_dir, "data", "hp.v2024-04-26.json.gz")
20+
return os.path.join(fpath_test_dir, "hp.v2024-04-26.json.gz")
2121

2222

2323
@pytest.fixture(scope="session")
2424
def hpo(fpath_hpo: str) -> hpotk.MinimalOntology:
25-
return hpotk.load_minimal_ontology(fpath_hpo)
26-
27-
28-
# use the `hpo` already defined above in this file
29-
@pytest.fixture
30-
def decompressed_hpo(fpath_hpo: str, tmp_path: Path) -> str:
31-
"""
32-
Decompress the gzipped HPO JSON to a plain JSON file and return its path.
33-
"""
34-
out = tmp_path / "hp.json"
35-
with gzip.open(fpath_hpo, "rb") as f_in, open(out, "wb") as f_out:
36-
shutil.copyfileobj(f_in, f_out)
37-
return str(out)
25+
'''
26+
The PATH to a JSON file of HPO terms and IDs.
27+
`hpotk` should be able to read this directly without manual decompression.
28+
'''
29+
return hpotk.load_minimal_ontology(fpath_hpo)

tests/test_full_features.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
)
1212

1313

14-
def test_full_features_parse_creates_all_blocks(decompressed_hpo):
14+
def test_full_features_parse_creates_all_blocks(fpath_hpo):
1515
runner = CliRunner()
1616
result = runner.invoke(
17-
main, ["parse-excel", "-e", FULL_XLSX, "--custom-hpo", decompressed_hpo]
17+
main, ["parse-excel", "-e", FULL_XLSX, "--custom-hpo", fpath_hpo]
1818
)
1919
assert result.exit_code == 0, result.output
2020

0 commit comments

Comments
 (0)