Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapt for pytest and add back import of os in rdflib/parser.py #1480

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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((".jldt", ".json", ".jsonld")): # 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