|
42 | 42 | else: |
43 | 43 | from importlib_metadata import version |
44 | 44 |
|
| 45 | +from . import CDX_SCHEMA_DIRECTORY |
| 46 | + |
45 | 47 | cyclonedx_lib_name: str = 'cyclonedx-python-lib' |
46 | 48 | cyclonedx_lib_version: str = version(cyclonedx_lib_name) |
47 | 49 | single_uuid: str = 'urn:uuid:{}'.format(uuid4()) |
48 | | -schema_directory = os.path.join(os.path.dirname(__file__), '..', 'cyclonedx', 'schema') |
49 | 50 |
|
50 | 51 |
|
51 | 52 | class BaseJsonTestCase(TestCase): |
52 | 53 |
|
53 | 54 | def assertValidAgainstSchema(self, bom_json: str, schema_version: SchemaVersion) -> None: |
54 | 55 | if sys.version_info >= (3, 7): |
55 | 56 | schema_fn = os.path.join( |
56 | | - schema_directory, |
| 57 | + CDX_SCHEMA_DIRECTORY, |
57 | 58 | f'bom-{schema_version.name.replace("_", ".").replace("V", "")}.schema.json' |
58 | 59 | ) |
59 | 60 | with open(schema_fn) as schema_fd: |
@@ -107,7 +108,7 @@ def assertEqualJsonBom(self, a: str, b: str) -> None: |
107 | 108 | class BaseXmlTestCase(TestCase): |
108 | 109 |
|
109 | 110 | def assertValidAgainstSchema(self, bom_xml: str, schema_version: SchemaVersion) -> None: |
110 | | - xsd_fn = os.path.join(schema_directory, f'bom-{schema_version.name.replace("_", ".").replace("V", "")}.xsd') |
| 111 | + xsd_fn = os.path.join(CDX_SCHEMA_DIRECTORY, f'bom-{schema_version.name.replace("_", ".").replace("V", "")}.xsd') |
111 | 112 | with open(xsd_fn) as xsd_fd: |
112 | 113 | xsd_doc = etree.parse(xsd_fd) |
113 | 114 |
|
|
0 commit comments