11
11
def cleanup_output_files ():
12
12
yield
13
13
14
- files_to_delete = ["spdx2_to_3.jsonld" , "my_spdx_document.spdx.json" , "converted_format.xml" ]
14
+ files_to_delete = ["spdx2_to_3.jsonld" , "my_spdx_document.spdx.json" , "converted_format.xml" , "graph.png" ]
15
15
for file in files_to_delete :
16
16
output_file = os .path .join (os .path .dirname (__file__ ), file )
17
17
if os .path .exists (output_file ):
@@ -27,25 +27,39 @@ def test_spdx2_parse_file():
27
27
run_example ("spdx2_parse_file.py" )
28
28
29
29
30
- @pytest .mark .usefixtures (' cleanup_output_files' )
30
+ @pytest .mark .usefixtures (" cleanup_output_files" )
31
31
def test_spdx2_convert_to_spdx3 ():
32
32
run_example ("spdx2_convert_to_spdx3.py" )
33
33
34
34
output_file = os .path .join (os .path .dirname (__file__ ), "spdx2_to_3.jsonld" )
35
35
assert os .path .exists (output_file )
36
36
37
37
38
- @pytest .mark .usefixtures (' cleanup_output_files' )
38
+ @pytest .mark .usefixtures (" cleanup_output_files" )
39
39
def test_spdx2_document_from_scratch ():
40
40
run_example ("spdx2_document_from_scratch.py" )
41
41
42
42
output_file = os .path .join (os .path .dirname (__file__ ), "my_spdx_document.spdx.json" )
43
43
assert os .path .exists (output_file )
44
44
45
45
46
- @pytest .mark .usefixtures (' cleanup_output_files' )
46
+ @pytest .mark .usefixtures (" cleanup_output_files" )
47
47
def test_spdx2_convert_format ():
48
48
run_example ("spdx2_convert_format.py" )
49
49
50
50
output_file = os .path .join (os .path .dirname (__file__ ), "converted_format.xml" )
51
51
assert os .path .exists (output_file )
52
+
53
+
54
+ @pytest .mark .usefixtures ("cleanup_output_files" )
55
+ def test_spdx2_generate_graph ():
56
+ try :
57
+ import networkx # noqa F401
58
+ import pygraphviz # noqa F401
59
+ except ImportError :
60
+ pytest .skip ("Missing optional dependencies" )
61
+
62
+ run_example ("spdx2_generate_graph.py" )
63
+
64
+ output_file = os .path .join (os .path .dirname (__file__ ), "graph.png" )
65
+ assert os .path .exists (output_file )
0 commit comments