Skip to content

Commit

Permalink
Adapt for pytest and add back import of os in rdflib/parser.py
Browse files Browse the repository at this point in the history
test/jsonld/test_onedotone.py got a bit messed up with a merge from
master. Looking at the original changes from @ashleysommer, all he did
was change a condition. This applies the same change but essentially
rebased on master.

For comparison see: RDFLib/rdflib@ab31c5e...c4b679f

Also add back import os in rdflib/parser.py

This is now needed after RDFLib#1441 was
merged.
  • Loading branch information
aucampia committed Nov 28, 2021
1 parent 39fe561 commit 721a594
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 23 deletions.
1 change: 1 addition & 0 deletions rdflib/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

from typing import TYPE_CHECKING
import codecs
import os
import pathlib
import sys

Expand Down
26 changes: 3 additions & 23 deletions test/jsonld/test_onedotone.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def get_test_suite_cases():
):
# Skip the JSON v1.0 tests
continue
if inputpath.endswith(".jsonld"): # toRdf
if inputpath.endswith(".jsonld") or inputpath.endswith(".json") or inputpath.endswith(".jldt"): # toRdf
if expectedpath.endswith(".jsonld"): # compact/expand/flatten
func = runner.do_test_json
else: # toRdf
Expand All @@ -222,28 +222,8 @@ def get_test_suite_cases():
def global_state():
old_cwd = getcwd()
chdir(test_dir)
try:
for cat, num, inputpath, expectedpath, context, options in read_manifest(
skiptests
):
if options:
if (
SKIP_1_0_TESTS
and "specVersion" in options
and str(options["specVersion"]).lower() == "json-ld-1.0"
):
# Skip the JSON v1.0 tests
continue
if inputpath.endswith((".jldt", ".json", ".jsonld")): # toRdf
if expectedpath.endswith(".jsonld"): # compact/expand/flatten
func = runner.do_test_json
else: # toRdf
func = runner.do_test_parser
else: # fromRdf
func = runner.do_test_serializer
yield func, TC_BASE, cat, num, inputpath, expectedpath, context, options
finally:
chdir(old_cwd)
yield
chdir(old_cwd)


@pytest.mark.parametrize(
Expand Down

0 comments on commit 721a594

Please sign in to comment.