Use pre-python 3.9 type hint in cli qa

This commit is contained in:
Marek Roszko 2023-05-15 20:05:31 -04:00
parent 1adcb86e0b
commit 06b3edec53
2 changed files with 7 additions and 5 deletions

View File

@ -26,6 +26,7 @@ import re
import os import os
from pathlib import Path from pathlib import Path
import pytest import pytest
from typing import List
@pytest.mark.parametrize("test_file,output_dir,compare_fn,cli_args", @pytest.mark.parametrize("test_file,output_dir,compare_fn,cli_args",
[("cli/basic_test/basic_test.kicad_sch", "basic_test", "cli/basic_test/basic_test.png", []), [("cli/basic_test/basic_test.kicad_sch", "basic_test", "cli/basic_test/basic_test.png", []),
@ -36,7 +37,7 @@ def test_sch_export_svg( kitest,
test_file: str, test_file: str,
output_dir: str, output_dir: str,
compare_fn: str, compare_fn: str,
cli_args: list): cli_args: List[str] ):
input_file = kitest.get_data_file_path( test_file ) input_file = kitest.get_data_file_path( test_file )
output_path = kitest.get_output_path( "cli/{}/".format( output_dir ) ) output_path = kitest.get_output_path( "cli/{}/".format( output_dir ) )
@ -84,7 +85,7 @@ def test_sch_export_netlist( kitest,
output_fn: str, output_fn: str,
line_skip_count: int, line_skip_count: int,
skip_compare: bool, skip_compare: bool,
cli_args: list): cli_args: List[str] ):
input_file = kitest.get_data_file_path( test_file ) input_file = kitest.get_data_file_path( test_file )
compare_filepath = kitest.get_data_file_path( "cli/basic_test/{}".format( output_fn ) ) compare_filepath = kitest.get_data_file_path( "cli/basic_test/{}".format( output_fn ) )
@ -116,7 +117,7 @@ def test_sch_export_netlist( kitest,
def test_sch_export_pdf( kitest, def test_sch_export_pdf( kitest,
test_file: str, test_file: str,
output_fn: str, output_fn: str,
cli_args: list): cli_args: List[str] ):
input_file = kitest.get_data_file_path( test_file ) input_file = kitest.get_data_file_path( test_file )
output_filepath = kitest.get_output_path( "cli/" ).joinpath( output_fn ) output_filepath = kitest.get_output_path( "cli/" ).joinpath( output_fn )
@ -142,7 +143,7 @@ def test_sch_export_pythonbom( kitest,
test_file: str, test_file: str,
output_fn: str, output_fn: str,
line_skip_count: int, line_skip_count: int,
cli_args: list): cli_args: List[str] ):
input_file = kitest.get_data_file_path( test_file ) input_file = kitest.get_data_file_path( test_file )
compare_filepath = kitest.get_data_file_path( "cli/basic_test/{}".format( output_fn ) ) compare_filepath = kitest.get_data_file_path( "cli/basic_test/{}".format( output_fn ) )

View File

@ -24,10 +24,11 @@ import difflib
import logging import logging
import subprocess import subprocess
import os import os
from typing import Tuple
logger = logging.getLogger("cli_util") logger = logging.getLogger("cli_util")
def run_and_capture( command: list ) -> tuple[ str, str, int ]: def run_and_capture( command: list ) -> Tuple[ str, str, int ]:
logger.info("Executing command \"%s\"", " ".join( command )) logger.info("Executing command \"%s\"", " ".join( command ))
proc = subprocess.Popen( command, proc = subprocess.Popen( command,