Skip to content

improve test

improve test #73

GitHub Actions / JUnit Test Report failed Sep 25, 2024 in 0s

3 tests run, 2 passed, 0 skipped, 1 failed.

Annotations

Check failure on line 73 in .mypy_cache/3.11/tests/test_pyshacl.data.json

See this annotation in the file changed.

@github-actions github-actions / JUnit Test Report

test_pyshacl.test_workflow_execution

FileNotFoundError: [Errno 2] No such file or directory: '/home/runner/work/cmem-plugin-pyshacl/cmem-plugin-pyshacl/tests/test_pyshacl.ttl'
Raw output
_setup = None

    @needs_cmem
    def test_workflow_execution(_setup: None) -> None:  # noqa: PT019
        """Test plugin execution"""
        plugin = ShaclValidation(
            data_graph_uri="https://vocab.eccenca.com/shacl/",
            shacl_graph_uri=SHACL_GRAPH_URI,
            validation_graph_uri=VALIDATION_GRAPH_URI,
            ontology_graph_uri="",
            generate_graph=True,
            output_entities=True,
            clear_validation_graph=True,
            owl_imports=True,
            skolemize=True,
            add_labels=True,
            include_graphs_labels=True,
            add_shui_conforms=True,
            meta_shacl=False,
            inference="both",
            advanced=True,
            remove_dataset_graph_type=True,
            remove_thesaurus_graph_type=True,
            remove_shape_catalog_graph_type=True,
            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")

tests/test_pyshacl.py:73: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
.venv/lib/python3.11/site-packages/rdflib/graph.py:1470: in parse
    source = create_input_source(
.venv/lib/python3.11/site-packages/rdflib/parser.py:416: in create_input_source
    ) = _create_input_source_from_location(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

file = None, format = 'turtle', input_source = None
location = '/home/runner/work/cmem-plugin-pyshacl/cmem-plugin-pyshacl/tests/test_pyshacl.ttl'

    def _create_input_source_from_location(
        file: Optional[Union[BinaryIO, TextIO]],
        format: Optional[str],
        input_source: Optional[InputSource],
        location: str,
    ) -> Tuple[URIRef, bool, Optional[Union[BinaryIO, TextIO]], Optional[InputSource]]:
        # Fix for Windows problem https://github.com/RDFLib/rdflib/issues/145 and
        # https://github.com/RDFLib/rdflib/issues/1430
        # NOTE: using pathlib.Path.exists on a URL fails on windows as it is not a
        # valid path. However os.path.exists() returns false for a URL on windows
        # which is why it is being used instead.
        if os.path.exists(location):
            location = pathlib.Path(location).absolute().as_uri()
    
        base = pathlib.Path.cwd().as_uri()
    
        absolute_location = URIRef(rdflib.util._iri2uri(location), base=base)
    
        if absolute_location.startswith("file:///"):
            filename = url2pathname(absolute_location.replace("file:///", "/"))
>           file = open(filename, "rb")
E           FileNotFoundError: [Errno 2] No such file or directory: '/home/runner/work/cmem-plugin-pyshacl/cmem-plugin-pyshacl/tests/test_pyshacl.ttl'

.venv/lib/python3.11/site-packages/rdflib/parser.py:476: FileNotFoundError