Skip to content

Commit 8224ad4

Browse files
superstitious
1 parent 7e0c0d3 commit 8224ad4

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

mpcontribs-lux/tests/projects/esoteric_ephemera/test_schemas.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,19 @@
1313

1414
@pytest.fixture(scope="module")
1515
def task_doc(test_data_dir) -> TaskDoc:
16-
with gzip.open(
17-
test_data_dir / "by_user" / "esoteric_ephemera" / "r2scan_task.json.gz", "rb"
16+
17+
with open(
18+
fname := test_data_dir
19+
/ "by_user"
20+
/ "esoteric_ephemera"
21+
/ "r2scan_task.json.gz",
22+
"rb",
1823
) as f:
24+
magic = f.read(2)
25+
26+
opener = gzip.open if magic in {b"\x1f\x8b", b"\037\213"} else open
27+
28+
with opener(fname, "rb") as f:
1929
return TaskDoc(**orjson.loads(f.read()))
2030

2131

0 commit comments

Comments
 (0)