Skip to content

Commit

Permalink
revert test
Browse files Browse the repository at this point in the history
  • Loading branch information
muddymudskipper committed Sep 25, 2024
1 parent 378ef2d commit 2afe298
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 25 deletions.
25 changes: 11 additions & 14 deletions tests/test_pyshacl.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
"""Plugin tests."""

from pathlib import Path
from tempfile import NamedTemporaryFile
from secrets import token_hex
from tempfile import TemporaryDirectory

import pyshacl
import pytest
from cmem.cmempy.dp.proxy.graph import delete, get, post_streamed
from rdflib import PROV, RDF, Graph, URIRef
from rdflib.compare import isomorphic
from cmem.cmempy.dp.proxy.graph import delete, get, post
from rdflib import RDF, Graph, URIRef

from cmem_plugin_pyshacl.plugin_pyshacl import ShaclValidation

from . import __path__
from .utils import TestExecutionContext, needs_cmem

UUID4 = "b36254a836e04279aecf411d2c8e364a"
Expand All @@ -32,9 +31,10 @@ def _setup(request: pytest.FixtureRequest) -> None:
URIRef("https://vocab.eccenca.com/shui/ShapeCatalog"),
)
)
with NamedTemporaryFile(suffix=".nt") as temp:
g.serialize(temp.name, format="nt", encoding="utf-8")
res = post_streamed(SHACL_GRAPH_URI, temp.name, replace=True)
with TemporaryDirectory() as temp:
temp_file = Path(temp) / f"{token_hex(8)}.nt"
g.serialize(temp_file, format="nt", encoding="utf-8")
res = post(SHACL_GRAPH_URI, temp_file, replace=True)
if res.status_code != 204: # noqa: PLR2004
raise OSError(f"Error uploading SHACL-SHACL {res.status_code}: {res.url}")

Expand Down Expand Up @@ -67,9 +67,6 @@ def test_workflow_execution(_setup: None) -> None: # noqa: PT019
max_validation_depth=15,
)
plugin.execute(inputs=(), context=TestExecutionContext())

result = Graph().parse(data=get(VALIDATION_GRAPH_URI).text)
result.remove((None, PROV.generatedAtTime, None))
test = Graph().parse(Path(__path__[0]) / "test_pyshacl.ttl", format="turtle")

assert isomorphic(result, test)
res = get(VALIDATION_GRAPH_URI)
if res.status_code != 200: # noqa: PLR2004
raise ValueError(f"Response {res.status_code}: {res.url}")
11 changes: 0 additions & 11 deletions tests/test_pyshacl.ttl

This file was deleted.

0 comments on commit 2afe298

Please sign in to comment.