1616# Copyright (c) OWASP Foundation. All Rights Reserved.
1717
1818import ast
19- import sys
2019from collections .abc import Generator , Iterable
2120from decimal import Decimal
2221from enum import Enum
2524from json import load as json_load
2625from os import path
2726from typing import Any , Optional
28- from unittest import TestCase , skipIf
27+ from unittest import TestCase
2928from warnings import warn
3029from xml .etree .ElementTree import parse as xml_parse # nosec B405
3130
@@ -981,7 +980,6 @@ def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any,
981980# add new test cases above this line
982981
983982
984- @skipIf (sys .version_info < (3 , 10 ), 'Requires Python 3.10+' )
985983@ddt
986984class TestCaseCompleteness (TestCase ):
987985 """
@@ -1008,10 +1006,10 @@ def __get_defined_enumcases(cls) -> tuple[str, ...]:
10081006
10091007 @staticmethod
10101008 def __get_defined_model_enums () -> Generator [str , None , None ]:
1011- models_path = path .join (path .dirname (__file__ ), '..' , 'cyclonedx' , 'model' )
1012- model_files = glob (path .join ('**' , '*.py' ), root_dir = models_path , recursive = True )
1009+ models_path = path .abspath ( path . join (path .dirname (__file__ ), '..' , 'cyclonedx' , 'model' ) )
1010+ model_files = glob (path .join (models_path , '**' , '*.py' ), recursive = True )
10131011 for model_file in model_files :
1014- with open (path . join ( models_path , model_file ) , encoding = 'utf-8' ) as f :
1012+ with open (model_file , encoding = 'utf-8' ) as f :
10151013 tree = ast .parse (f .read (), filename = model_file )
10161014 for node in ast .walk (tree ):
10171015 if isinstance (node , ast .ClassDef ):
@@ -1025,7 +1023,9 @@ def __get_defined_model_enums() -> Generator[str, None, None]:
10251023 yield node .name
10261024 break
10271025
1028- @idata (__get_defined_model_enums ())
1026+ @idata (
1027+ __get_defined_model_enums .__func__ () # py3.9 compat
1028+ )
10291029 def test_case_exists (self , enum_name : str ) -> None :
10301030 self .assertIn (f'{ self .__TestCasePrefix } { enum_name } ' ,
10311031 self .__get_defined_enumcases (),
0 commit comments