Skip to content

Commit

Permalink
Fix JS tests in TOX runners
Browse files Browse the repository at this point in the history
  • Loading branch information
ashleysommer committed Oct 14, 2020
1 parent a28b4b0 commit 4190f04
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 14 deletions.
3 changes: 1 addition & 2 deletions MANIFEST.in
Expand Up @@ -6,6 +6,5 @@ include pyshacl/assets/*.pickle
include pyshacl/*.spec
include test/*.py
include test/issues/*.py
recursive-include test/resources *.ttl
recursive-include test/resources *.ttl *.js
recursive-include docs *.txt *.md

8 changes: 5 additions & 3 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions pyproject.toml
Expand Up @@ -47,17 +47,19 @@ python = "^3.6" # Compatible python versions must be declared here
rdflib = "^5.0.0"
rdflib-jsonld = "^0.5.0"
owlrl = "^5.2.1"
pyduktape2 = {version="^0.4.1", optional=true}
pyduktape2 = {version="^0.4.1", python=">=3.6", optional=true}

[tool.poetry.dev-dependencies]
coverage = "^4.5"
pytest = "^5.0"
pytest-cov = "^2.8.1"
flake8 = "^3.7"
pyduktape2 = {version="^0.4.1", python=">=3.6"}
isort = {version="^5.0.0", python=">=3.6"}
black = {version=">=18.9b0,<=19.10b0", python=">=3.6"}
mypy = {version="^0.770.0", python=">=3.6"}


[tool.poetry.extras]
js = ["pyduktape2"]
dev-lint = ["isort", "black", "flake8"]
Expand Down Expand Up @@ -125,7 +127,7 @@ deps =
py36: coveralls
passenv = TRAVIS TRAVIS_JOB_ID TRAVIS_BRANCH
skip_install = true
commands_pre = poetry install -vvv
commands_pre = poetry install -vvv --extras "js"
commands =
- poetry show
poetry run pytest --cov=pyshacl test/
Expand Down
1 change: 1 addition & 0 deletions pyshacl/extras/__init__.py
Expand Up @@ -10,6 +10,7 @@

dev_mode = False


@lru_cache()
def check_extra_installed(extra_name: str):
if dev_mode:
Expand Down
2 changes: 1 addition & 1 deletion test/test_js/test_js_constraint.py
Expand Up @@ -13,7 +13,7 @@
sh:js [
a sh:JSConstraint ;
sh:message "Values are literals with German language tag." ;
sh:jsLibrary [ sh:jsLibraryURL "file://resources/js/germanLabel.js" ] ;
sh:jsLibrary [ sh:jsLibraryURL "file://test/resources/js/germanLabel.js" ] ;
sh:jsFunctionName "validateGermanLabel" ;
] .
'''
Expand Down
2 changes: 1 addition & 1 deletion test/test_js/test_js_constraint_component.py
Expand Up @@ -23,7 +23,7 @@
Their string value is accessed via the .lex and .uri attributes.
The function returns true if no violation has been found.
""" ;
sh:jsLibrary [ sh:jsLibraryURL "file://resources/js/hasMaxLength.js"^^xsd:anyURI ] ;
sh:jsLibrary [ sh:jsLibraryURL "file://test/resources/js/hasMaxLength.js"^^xsd:anyURI ] ;
sh:jsFunctionName "hasMaxLength" .
ex:TestShape
Expand Down
2 changes: 1 addition & 1 deletion test/test_js/test_js_constraint_path_component.py
Expand Up @@ -18,7 +18,7 @@
ex:hasMaxCount
a sh:JSValidator ;
sh:message "Path has more than {$maxCount} values." ;
sh:jsLibrary [ sh:jsLibraryURL "file://resources/js/hasMaxCount.js"^^xsd:anyURI ] ;
sh:jsLibrary [ sh:jsLibraryURL "file://test/resources/js/hasMaxCount.js"^^xsd:anyURI ] ;
sh:jsFunctionName "hasMaxCount" .
ex:TestShape
Expand Down
2 changes: 1 addition & 1 deletion test/test_js/test_js_function.py
Expand Up @@ -69,7 +69,7 @@
sh:description "The second operand" ;
] ;
sh:returnType xsd:integer ;
sh:jsLibrary [ sh:jsLibraryURL "file://resources/js/multiply.js" ] ;
sh:jsLibrary [ sh:jsLibraryURL "file://test/resources/js/multiply.js" ] ;
sh:jsFunctionName "multiply" ;
.
'''
Expand Down
2 changes: 1 addition & 1 deletion test/test_js/test_js_rules.py
Expand Up @@ -13,7 +13,7 @@
sh:rule [
a sh:JSRule ; # This triple is optional
sh:jsFunctionName "computeArea" ;
sh:jsLibrary [ sh:jsLibraryURL "resources/js/rectangle.js"^^xsd:anyURI ] ;
sh:jsLibrary [ sh:jsLibraryURL "file://test/resources/js/rectangle.js"^^xsd:anyURI ] ;
] ;
sh:property [
sh:path ex:area ;
Expand Down
2 changes: 1 addition & 1 deletion test/test_js/test_js_target.py
Expand Up @@ -37,7 +37,7 @@
sh:target [
rdf:type sh:JSTarget ;
sh:jsFunctionName "findThings" ;
sh:jsLibrary [ sh:jsLibraryURL "resources/js/findThings.js"^^xsd:anyURI ] ;
sh:jsLibrary [ sh:jsLibraryURL "file://test/resources/js/findThings.js"^^xsd:anyURI ] ;
] ;
.
Expand Down
2 changes: 1 addition & 1 deletion test/test_js/test_js_target_type.py
Expand Up @@ -70,7 +70,7 @@
sh:nodeKind sh:IRI ;
] ;
sh:jsFunctionName "findBornIn" ;
sh:jsLibrary [ sh:jsLibraryURL "resources/js/findBornIn.js"^^xsd:anyURI ] ;
sh:jsLibrary [ sh:jsLibraryURL "file://test/resources/js/findBornIn.js"^^xsd:anyURI ] ;
.
ex:GermanCitizenShape
Expand Down

0 comments on commit 4190f04

Please sign in to comment.