Skip to content

Commit c9b6019

Browse files
committed
fix for Pytho< 3.8 support in tests
Signed-off-by: Paul Horton <[email protected]>
1 parent 53a82cf commit c9b6019

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tests/base.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,18 @@
1818
# Copyright (c) OWASP Foundation. All Rights Reserved.
1919

2020
import json
21+
import sys
2122
import xml.etree.ElementTree
2223
from datetime import datetime, timezone
23-
from importlib.metadata import version
2424
from unittest import TestCase
2525
from uuid import uuid4
2626
from xml.dom import minidom
2727

28+
if sys.version_info >= (3, 8, 0):
29+
from importlib.metadata import version
30+
else:
31+
from importlib_metadata import version
32+
2833
cyclonedx_lib_name: str = 'cyclonedx-python-lib'
2934
cyclonedx_lib_version: str = version(cyclonedx_lib_name)
3035
single_uuid: str = 'urn:uuid:{}'.format(uuid4())

0 commit comments

Comments
 (0)