Skip to content

Commit 598f147

Browse files
committed
dings
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
1 parent 811b78e commit 598f147

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

tests/test_enums.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
# Copyright (c) OWASP Foundation. All Rights Reserved.
1717

1818
import ast
19-
import sys
2019
from collections.abc import Generator, Iterable
2120
from decimal import Decimal
2221
from enum import Enum
@@ -25,7 +24,7 @@
2524
from json import load as json_load
2625
from os import path
2726
from typing import Any, Optional
28-
from unittest import TestCase, skipIf
27+
from unittest import TestCase
2928
from warnings import warn
3029
from 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
986984
class 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

Comments
 (0)