Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3eda4f9

Browse filesBrowse files
committed
test with all data in the data dir
previous version of the test was unstable to directory order the first file found was used, and some more simple files have good conversion while more complex are failing Signed-off-by: Pierre Tardy <pierre.tardy@renault.com>
1 parent 03174b6 commit 3eda4f9
Copy full SHA for 3eda4f9

1 file changed

+22-24Lines changed: 22 additions & 24 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎tests/test_write_anything.py‎

Copy file name to clipboardExpand all lines: tests/test_write_anything.py
+22-24Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -21,31 +21,29 @@
2121

2222
dirname = os.path.join(os.path.dirname(__file__), "data", "formats")
2323
test_files = [os.path.join(dirname, fn) for fn in os.listdir(dirname)]
24-
UNSTABLE_CONVERSIONS = [
25-
"rdf->rdf",
26-
"yaml->rdf",
27-
"xml->rdf",
28-
"json->rdf",
29-
"tag->rdf",
30-
"rdf->yaml",
31-
"tag->yaml",
32-
"rdf->xml",
33-
"tag->xml",
34-
"rdf->json",
35-
"tag->json",
36-
"rdf->tag",
37-
"yaml->tag",
38-
"xml->tag",
39-
"json->tag",
40-
]
24+
UNSTABLE_CONVERSIONS = {
25+
"SPDXTagExample.tag-rdf",
26+
"SPDXTagExample.tag-yaml",
27+
"SPDXTagExample.tag-xml",
28+
"SPDXTagExample.tag-json",
29+
"SPDXSimpleTag.tag-rdf",
30+
"SPDXXmlExample.xml-rdf",
31+
"SPDXXmlExample.xml-tag",
32+
"SPDXJsonExample.json-rdf",
33+
"SPDXJsonExample.json-tag",
34+
"SPDXYamlExample.yaml-rdf",
35+
"SPDXYamlExample.yaml-tag",
36+
"SPDXRdfExample.rdf-rdf",
37+
"SPDXRdfExample.rdf-yaml",
38+
"SPDXRdfExample.rdf-xml",
39+
"SPDXRdfExample.rdf-json",
40+
"SPDXRdfExample.rdf-tag",
41+
}
4142

42-
@pytest.mark.parametrize("in_format", ['rdf', 'yaml', 'xml', 'json', 'tag'])
4343
@pytest.mark.parametrize("out_format", ['rdf', 'yaml', 'xml', 'json', 'tag'])
44-
def test_write_anything(in_format, out_format, tmpdir):
45-
46-
for in_file in test_files:
47-
if in_file.endswith(in_format):
48-
break
44+
@pytest.mark.parametrize("in_file", test_files, ids=lambda x: os.path.basename(x))
45+
def test_write_anything(in_file, out_format, tmpdir):
46+
in_basename = os.path.basename(in_file)
4947
doc, error = parse_anything.parse_file(in_file)
5048

5149
assert not error
@@ -58,7 +56,7 @@ def test_write_anything(in_format, out_format, tmpdir):
5856
result2 = utils_test.TestParserUtils.to_dict(doc2)
5957
assert not error2
6058

61-
test = in_format + "->" + out_format
59+
test = in_basename + "-" + out_format
6260
if test not in UNSTABLE_CONVERSIONS:
6361
utils_test.compare(result, result2)
6462
else:

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.