Skip to content

Commit aa0d770

Browse files
committed
type fix and python3.13 fix
1 parent 82f0d1b commit aa0d770

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

tests/test_etools_to_clt.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
"""Test the CWL Expression refactoring tool."""
33
import os
44
import shutil
5+
import sys
56
import tarfile
67
from pathlib import Path
7-
from typing import Generator
8+
from typing import TYPE_CHECKING, Generator, cast
89

910
import pytest
1011
import requests
@@ -22,6 +23,9 @@
2223

2324
from .util import get_data
2425

26+
if TYPE_CHECKING:
27+
from http.client import HTTPResponse
28+
2529

2630
def test_v1_0_workflow_top_level_format_expr() -> None:
2731
"""Test for the correct error when converting a format expression in a workflow level input."""
@@ -244,11 +248,17 @@ def cwl_v1_0_dir(
244248
) -> Generator[str, None, None]:
245249
"""Download the CWL 1.0.2 specs and return a path to the directory."""
246250
tmp_path = tmp_path_factory.mktemp("cwl_v1_0_dir")
247-
with requests.get(
248-
"https://github.com/common-workflow-language/common-workflow-language/archive/v1.0.2.tar.gz",
249-
stream=True,
250-
).raw as specfileobj:
251+
with cast(
252+
"HTTPResponse",
253+
requests.get(
254+
"https://github.com/common-workflow-language/common-workflow-language/archive/v1.0.2.tar.gz",
255+
stream=True,
256+
).raw,
257+
) as specfileobj:
251258
tf = tarfile.open(fileobj=specfileobj)
252-
tf.extractall(path=tmp_path)
259+
if sys.version_info > (3, 12):
260+
tf.extractall(path=tmp_path, filter="data")
261+
else:
262+
tf.extractall(path=tmp_path)
253263
yield str(tmp_path / "common-workflow-language-1.0.2")
254264
shutil.rmtree(os.path.join(tmp_path))

0 commit comments

Comments
 (0)