File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22"""Test the CWL Expression refactoring tool."""
33import os
44import shutil
5+ import sys
56import tarfile
67from pathlib import Path
7- from typing import Generator
8+ from typing import TYPE_CHECKING , Generator , cast
89
910import pytest
1011import requests
2223
2324from .util import get_data
2425
26+ if TYPE_CHECKING :
27+ from http .client import HTTPResponse
28+
2529
2630def 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 ))
You can’t perform that action at this time.
0 commit comments