@@ -13,9 +13,8 @@ def cleanup_output_files():
13
13
14
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
- output_file = os .path .join (os .path .dirname (__file__ ), file )
17
- if os .path .exists (output_file ):
18
- os .remove (output_file )
16
+ if os .path .exists (file ):
17
+ os .remove (file )
19
18
20
19
21
20
def run_example (example_file : str ):
@@ -30,25 +29,19 @@ def test_spdx2_parse_file():
30
29
@pytest .mark .usefixtures ("cleanup_output_files" )
31
30
def test_spdx2_convert_to_spdx3 ():
32
31
run_example ("spdx2_convert_to_spdx3.py" )
33
-
34
- output_file = os .path .join (os .path .dirname (__file__ ), "spdx2_to_3.jsonld" )
35
- assert os .path .exists (output_file )
32
+ assert os .path .exists ("spdx2_to_3.jsonld" )
36
33
37
34
38
35
@pytest .mark .usefixtures ("cleanup_output_files" )
39
36
def test_spdx2_document_from_scratch ():
40
37
run_example ("spdx2_document_from_scratch.py" )
41
-
42
- output_file = os .path .join (os .path .dirname (__file__ ), "my_spdx_document.spdx.json" )
43
- assert os .path .exists (output_file )
38
+ assert os .path .exists ("my_spdx_document.spdx.json" )
44
39
45
40
46
41
@pytest .mark .usefixtures ("cleanup_output_files" )
47
42
def test_spdx2_convert_format ():
48
43
run_example ("spdx2_convert_format.py" )
49
-
50
- output_file = os .path .join (os .path .dirname (__file__ ), "converted_format.xml" )
51
- assert os .path .exists (output_file )
44
+ assert os .path .exists ("converted_format.xml" )
52
45
53
46
54
47
@pytest .mark .usefixtures ("cleanup_output_files" )
@@ -60,6 +53,4 @@ def test_spdx2_generate_graph():
60
53
pytest .skip ("Missing optional dependencies" )
61
54
62
55
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 )
56
+ assert os .path .exists ("graph.png" )
0 commit comments