21
21
22
22
from ddt import data , ddt , idata , named_data , unpack
23
23
24
- from cyclonedx .exception import CycloneDxException
24
+ from cyclonedx .exception import CycloneDxException , MissingOptionalDependencyException
25
25
from cyclonedx .exception .model import LicenseExpressionAlongWithOthersException , UnknownComponentDependencyException
26
26
from cyclonedx .exception .output import FormatNotSupportedException
27
27
from cyclonedx .model .bom import Bom
31
31
from tests import SnapshotMixin , mksname , uuid_generator
32
32
from tests ._data .models import all_get_bom_funct_invalid , all_get_bom_funct_valid
33
33
34
- UNSUPPORTED_SV = frozenset ((SchemaVersion .V1_1 , SchemaVersion .V1_0 , ))
34
+ UNSUPPORTED_SV = frozenset ((SchemaVersion .V1_1 , SchemaVersion .V1_0 ,))
35
35
36
36
37
37
@ddt
@@ -56,7 +56,10 @@ def test_valid(self, get_bom: Callable[[], Bom], sv: SchemaVersion, *_: Any, **_
56
56
snapshot_name = mksname (get_bom , sv , OutputFormat .JSON )
57
57
bom = get_bom ()
58
58
json = BY_SCHEMA_VERSION [sv ](bom ).output_as_string (indent = 2 )
59
- errors = JsonStrictValidator (sv ).validate_str (json )
59
+ try :
60
+ errors = JsonStrictValidator (sv ).validate_str (json )
61
+ except MissingOptionalDependencyException :
62
+ errors = None # skipped validation
60
63
self .assertIsNone (errors )
61
64
self .assertEqualSnapshot (json , snapshot_name )
62
65
0 commit comments