File tree Expand file tree Collapse file tree 1 file changed +16
-6
lines changed Expand file tree Collapse file tree 1 file changed +16
-6
lines changed Original file line number Diff line number Diff line change 2
2
"""Test the CWL Expression refactoring tool."""
3
3
import os
4
4
import shutil
5
+ import sys
5
6
import tarfile
6
7
from pathlib import Path
7
- from typing import Generator
8
+ from typing import TYPE_CHECKING , Generator , cast
8
9
9
10
import pytest
10
11
import requests
22
23
23
24
from .util import get_data
24
25
26
+ if TYPE_CHECKING :
27
+ from http .client import HTTPResponse
28
+
25
29
26
30
def test_v1_0_workflow_top_level_format_expr () -> None :
27
31
"""Test for the correct error when converting a format expression in a workflow level input."""
@@ -244,11 +248,17 @@ def cwl_v1_0_dir(
244
248
) -> Generator [str , None , None ]:
245
249
"""Download the CWL 1.0.2 specs and return a path to the directory."""
246
250
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 :
251
258
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 )
253
263
yield str (tmp_path / "common-workflow-language-1.0.2" )
254
264
shutil .rmtree (os .path .join (tmp_path ))
You can’t perform that action at this time.
0 commit comments