Skip to content

Commit 947593e

Browse files
authored
Merge pull request #84 from hsolbrig/WIndows_bug
Windows bug
2 parents bebd05f + 494ae92 commit 947593e

File tree

20 files changed

+2201
-2172
lines changed

20 files changed

+2201
-2172
lines changed

.github/workflows/main.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ name: Build
22

33
on:
44
push:
5-
branches: [ master ]
65

76
jobs:
87
update-requirements:

.github/workflows/pr-test.yaml

Lines changed: 0 additions & 29 deletions
This file was deleted.

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
Alejandro González Hevia <[email protected]>
2+
Ben McAlister <[email protected]>
23
Egon Willighagen <[email protected]>
34
Harold Solbrig <[email protected]>
45
Harold Solbrig <[email protected]>

ChangeLog

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
CHANGES
22
=======
33

4+
* Replace '/' with '\'
5+
6+
v0.8.0
7+
------
8+
9+
* Point at the correct slurper version
10+
* Add extra test files (may not be necessary)
11+
* Fix call to deprecated \`add\_bindings\` method
12+
* Update to remove dependency on protected method in v 6.0
413
* Import the shim into the manifest tester
514
* Add miscellaneous testing updates
615
* Requirements match Pipenv

Pipfile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@ pbr = "*"
88

99
[packages]
1010
chardet = "*"
11-
rdflib = ">=5.0.0"
1211
rdflib-shim = "*"
1312
requests = ">=2.22.0"
1413
urllib3 = "*"
15-
ShExJSG = ">=0.8.1"
14+
ShExJSG = ">=0.8.2"
1615
CFGraph = ">=0.2.1"
17-
PyShExC = "==0.9.0"
16+
PyShExC = "==0.9.1"
1817
sparqlslurper = ">=0.5.1"
1918
sparqlwrapper = ">=1.8.5"

pyshex/utils/url_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ def generate_base(path: str) -> str:
99
:param path: file location or url
1010
:return: file location or url sans actual name
1111
"""
12-
if ':' in path:
12+
if '://' in path:
1313
parts = urlparse(path)
1414
parts_dict = parts._asdict()
1515
parts_dict['path'] = os.path.split(parts.path)[0] if '/' in parts.path else ''
1616
return urlunparse(ParseResult(**parts_dict)) + '/'
1717
else:
18-
return (os.path.split(path)[0] if '/' in path else '') + '/'
18+
return os.path.split(path)[0].replace('\\', '/') + '/'

requirements.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,10 @@
1212

1313
cfgraph>=0.2.1
1414
chardet
15-
pyshexc==0.9.0
15+
pyshexc==0.9.1
1616
rdflib-shim
17-
rdflib>=5.0.0
1817
requests>=2.22.0
19-
shexjsg>=0.8.1
18+
shexjsg>=0.8.2
2019
sparqlslurper>=0.5.1
2120
sparqlwrapper>=1.8.5
2221
urllib3

tests/data/earl_report.ttl

Lines changed: 2039 additions & 2039 deletions
Large diffs are not rendered by default.

tests/test_cli/test_evaluate.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from pyshex.user_agent import UserAgent
1111
from tests import datadir, SKIP_EXTERNAL_URLS, SKIP_EXTERNAL_URLS_MSG
1212
from tests.test_cli.clitests import CLITestCase, ArgParseExitException
13+
from tests.utils.web_server_utils import DRUGBANK_SPARQL_URL, is_up, is_down_reason
1314

1415
update_test_files: bool = False
1516

@@ -71,13 +72,12 @@ def test_start_predicate(self):
7172
failexpected=True)
7273
self.assertFalse(update_test_files, "Updating test files")
7374

74-
@unittest.skipIf(SKIP_EXTERNAL_URLS, SKIP_EXTERNAL_URLS_MSG)
75+
@unittest.skipIf(not is_up(DRUGBANK_SPARQL_URL), is_down_reason(DRUGBANK_SPARQL_URL))
7576
def test_sparql_query(self):
7677
""" Test a sample DrugBank sparql query """
7778
shex = os.path.join(datadir, 't1.shex')
7879
sparql = os.path.join(datadir, 't1.sparql')
79-
rdf = 'http://wifo5-04.informatik.uni-mannheim.de/drugbank/sparql'
80-
self.do_test([rdf, shex, '-sq', sparql], 't1', update_test_file=update_test_files)
80+
self.do_test([DRUGBANK_SPARQL_URL, shex, '-sq', sparql], 't1', update_test_file=update_test_files)
8181

8282

8383
if __name__ == '__main__':

tests/test_cli/test_sparql_options.py

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
from pyshex.shex_evaluator import evaluate_cli
77
from tests import datadir, SKIP_EXTERNAL_URLS, SKIP_EXTERNAL_URLS_MSG
88
from tests.test_cli.clitests import CLITestCase
9+
from tests.utils.web_server_utils import FHIRCAT_GRAPHDB_URL, is_up, is_down_reason, DRUGBANK_SPARQL_URL, \
10+
DUMONTIER_GRAPHDB_URL
911

1012

1113
def elapsed_filter(txt: str) -> str:
@@ -21,50 +23,51 @@ class SparqlQueryTestCase(CLITestCase):
2123
def prog_ep(self, argv: List[str]) -> bool:
2224
return bool(evaluate_cli(argv, prog=self.testprog))
2325

26+
@unittest.skipIf(not is_up(DRUGBANK_SPARQL_URL), is_down_reason(DRUGBANK_SPARQL_URL))
2427
def test_sparql_query(self):
2528
""" Test a sample DrugBank sparql query """
2629
shex = os.path.join(datadir, 't1.shex')
2730
sparql = os.path.join(datadir, 't1.sparql')
28-
rdf = 'http://wifo5-04.informatik.uni-mannheim.de/drugbank/sparql'
29-
self.do_test([rdf, shex, '-sq', sparql], 'dbsparql1')
31+
self.do_test([DRUGBANK_SPARQL_URL, shex, '-sq', sparql], 'dbsparql1')
3032

33+
@unittest.skipIf(not is_up(DRUGBANK_SPARQL_URL), is_down_reason(DRUGBANK_SPARQL_URL))
3134
def test_print_queries(self):
3235
""" Test a sample DrugBank sparql query printing queries"""
3336
shex = os.path.join(datadir, 't1.shex')
3437
sparql = os.path.join(datadir, 't1.sparql')
35-
rdf = 'http://wifo5-04.informatik.uni-mannheim.de/drugbank/sparql'
36-
self.do_test([rdf, shex, '-sq', sparql, '-ps'], 'dbsparql2', text_filter=elapsed_filter)
38+
self.do_test([DRUGBANK_SPARQL_URL, shex, '-sq', sparql, '-ps'], 'dbsparql2', text_filter=elapsed_filter)
3739

40+
@unittest.skipIf(not is_up(DRUGBANK_SPARQL_URL), is_down_reason(DRUGBANK_SPARQL_URL))
3841
def test_print_results(self):
3942
""" Test a sample DrugBank sparql query printing results"""
4043
shex = os.path.join(datadir, 't1.shex')
4144
sparql = os.path.join(datadir, 't1.sparql')
42-
rdf = 'http://wifo5-04.informatik.uni-mannheim.de/drugbank/sparql'
43-
self.do_test([rdf, shex, '-sq', sparql, '-pr', "--stopafter", "1"], 'dbsparql3', text_filter=elapsed_filter)
45+
self.do_test([DRUGBANK_SPARQL_URL, shex, '-sq', sparql, '-pr', "--stopafter", "1"], 'dbsparql3', text_filter=elapsed_filter)
4446

47+
@unittest.skipIf(not is_up(DRUGBANK_SPARQL_URL), is_down_reason(DRUGBANK_SPARQL_URL))
4548
def test_named_graph(self):
4649
""" Test a sample DrugBank using any named graph """
4750

4851
shex = os.path.join(datadir, 't1.shex')
4952
sparql = os.path.join(datadir, 't1.sparql')
50-
rdf = 'http://wifo5-04.informatik.uni-mannheim.de/drugbank/sparql'
5153
self.maxDiff = None
52-
self.do_test([rdf, shex, '-sq', sparql, '-ps', '-gn', "", "-pr"], 'dbsparql4', failexpected=True,
53-
text_filter=elapsed_filter)
54+
self.do_test([DRUGBANK_SPARQL_URL, shex, '-sq', sparql, '-ps', '-gn', "", "-pr"], 'dbsparql4',
55+
failexpected=True, text_filter=elapsed_filter)
5456

5557
graphid = "<http://identifiers.org/drugbank:>"
56-
self.do_test([rdf, shex, '-sq', sparql, '-ps', '-gn', graphid, "-pr"], 'dbsparql5', failexpected=True,
57-
text_filter=elapsed_filter)
58+
self.do_test([DRUGBANK_SPARQL_URL, shex, '-sq', sparql, '-ps', '-gn', graphid, "-pr"], 'dbsparql5',
59+
failexpected=True, text_filter=elapsed_filter)
5860

61+
@unittest.skipIf(not is_up(DUMONTIER_GRAPHDB_URL), is_down_reason(DUMONTIER_GRAPHDB_URL))
5962
def test_named_graph_types(self):
6063
""" Test a Drugbank query with named graph in the query """
6164
shex = os.path.join(datadir, 'schemas', 'biolink-modelnc.shex')
62-
rdf = 'http://graphdb.dumontierlab.com/repositories/ncats-red-kg'
6365
self.maxDiff = None
64-
self.do_test([rdf, shex, '-ss', '-gn', '', '-ps', '-pr', '-ut', '-sq',
66+
self.do_test([DUMONTIER_GRAPHDB_URL, shex, '-ss', '-gn', '', '-ps', '-pr', '-ut', '-sq',
6567
'select ?item where{?item a <http://w3id.org/biolink/vocab/Protein>} LIMIT 20'],
6668
'dbsparql6', failexpected=True, text_filter=elapsed_filter)
6769

70+
@unittest.skipIf(not is_up(FHIRCAT_GRAPHDB_URL), is_down_reason(FHIRCAT_GRAPHDB_URL))
6871
def test_infer_setting(self):
6972
""" Test setting infer to False """
7073

0 commit comments

Comments
 (0)