Workaround to fix a QA not working test on platforms is Python older than 3.9

A Pcbnew Python test in QA cli (to test SVG outputs) fails in old Python
because it uses a function only existing in Python 3.9 and newer.
So skip this test for older Python version
This commit is contained in:
jean-pierre charras 2023-12-14 11:57:10 +01:00
parent 140a734589
commit b9a5e04ad0
1 changed files with 6 additions and 2 deletions

View File

@ -27,6 +27,7 @@ import pytest
import re import re
from typing import List, Tuple from typing import List, Tuple
from conftest import KiTestFixture from conftest import KiTestFixture
import sys
def get_generated_path(kitest: KiTestFixture, def get_generated_path(kitest: KiTestFixture,
@ -90,8 +91,11 @@ def test_pcb_export_svg( kitest: KiTestFixture,
svg_source_path = str( Path( input_file ).with_suffix( "" ) ) svg_source_path = str( Path( input_file ).with_suffix( "" ) )
svg_source_path += layer_name_fixed + ".svg" svg_source_path += layer_name_fixed + ".svg"
# Comparison DPI = 1270 => 1px == 20um. I.e. allowable error of 60 um after eroding # This test works only with Python >= 3.9 because it uses a pathlib function only existing
assert utils.svgs_are_equivalent( str( generated_svg_path ), svg_source_path, 1270 ) # in 3.9 and newer. So skip it for previous versions
if sys.hexversion >= 0x03090000 :
# Comparison DPI = 1270 => 1px == 20um. I.e. allowable error of 60 um after eroding
assert utils.svgs_are_equivalent( str( generated_svg_path ), svg_source_path, 1270 )
@pytest.mark.skipif(not utils.is_gerbv_installed(), reason="Requires gerbv to be installed") @pytest.mark.skipif(not utils.is_gerbv_installed(), reason="Requires gerbv to be installed")