Skip to content

Commit

Permalink
version bump for release, more integration test fixes
Browse files Browse the repository at this point in the history
also change the link to default location of the secrets.yaml
file in the readme to be consistent with other documentation

also run coveralls even on test failure since some modules succeed

in theory the ontology local repo should no longer be needed for test
but have not completely verified that
  • Loading branch information
tgbugs committed Feb 21, 2020
1 parent 65c9d22 commit 8bffaf2
Show file tree
Hide file tree
Showing 8 changed files with 88 additions and 27 deletions.
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,7 @@ script:

after_success:
- if [[ $HAS_COVERALLS && $TRAVIS_PYTHON_VERSION == 3.7 ]] ; then coveralls ; fi

after_failure:
# for now we want converage even if things fail
- if [[ $HAS_COVERALLS && $TRAVIS_PYTHON_VERSION == 3.7 ]] ; then coveralls ; fi
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ from your local copy of this repo.
1. [~/.config/pyontutils/config.yaml](${HOME}/.config/pyontutils/config.yaml).
This file can be used to augment the varibles defined in [auth-config.py](./pyontutils/auth-config.py).
For more details about the config see the [orthauth guide](https://github.com/tgbugs/orthauth/blob/master/docs/guide.org).
2. [secrets.yaml](${HOME}/.config/pyontutils/secrets.yaml) that you can put wherever
2. [secrets.yaml](${HOME}/.config/orthauth/secrets.yaml) that you can put wherever
you want by editing the `auth-stores: secrets: path:` entry in [config.yaml](${HOME}/.config/pyontutils/config.yaml).
The file mode needs to be set to `0600` so that only you can read and write it.
It is also advisable to place it inside a folder with a mode set to `0700` since
Expand Down
2 changes: 1 addition & 1 deletion pyontutils/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.1.19'
__version__ = '0.1.20'
13 changes: 7 additions & 6 deletions pyontutils/make_catalog.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
#!/usr/bin/env python3
from pyontutils.config import auth
__doc__ = f"""Generate ttl/catalog-*.xml
Usage:
ont-catalog [options]
ont-catalog [options] <file> ...
Options:
-b --big when creating catalog also import big files
reccomend running this option with pypy3
-j --jobs=NJOBS number of parallel jobs to run [default: 9]
-d --debug break at the end
-b --big when creating catalog also import big files
reccomend running this option with pypy3
-j --jobs=NJOBS number of parallel jobs to run [default: 9]
-d --debug break at the end
-l --ontology-local-repo=OLR path to ontology [default: {auth.get_path('ontology-local-repo')}]
"""
import os
Expand All @@ -19,7 +21,6 @@
from git import Repo
from pyontutils.utils import anyMembers
from pyontutils.core import displayTriples
from pyontutils.config import auth
from pyontutils.ontload import local_imports
try:
breakpoint
Expand All @@ -32,7 +33,7 @@ def main():
args = docopt(__doc__, version='ont-catalog 0.0.1')
dobig = args['--big']
remote_base = 'http://ontology.neuinfo.org/NIF/ttl/'
olr = auth.get_path('ontology-local-repo')
olr = Path(args['--ontology-local-repo'])
local_base = (olr / 'ttl').as_posix() + '/'

#list of all nif ontologies
Expand Down
7 changes: 4 additions & 3 deletions pyontutils/ontutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,10 +323,11 @@ def version_iri(filename, epoch):


def make_version_iri_from_iri(iri, epoch):
pp = PurePath(iri)
head, tail = iri.split('/', 1)
pp = PurePath(tail)
vp = (pp.with_suffix('') / 'version' / str(epoch) / pp.stem).with_suffix(pp.suffix)
versionIRI = rdflib.URIRef(str(vp))
print(versionIRI)
viri = head + str(vp)
versionIRI = rdflib.URIRef(viri)
return rdflib.URIRef(versionIRI)


Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def find_version(filename):
tests_require=tests_require,
install_requires=[
'appdirs',
'augpathlib>=0.0.10',
'augpathlib>=0.0.11',
'colorlog',
'docopt',
'gitpython',
Expand Down
7 changes: 7 additions & 0 deletions test/owl-test.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@prefix : <file:///ERROR/EMPTY/PREFIX/BANNED/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .

<http://ontology.neuinfo.org/NIF/ttl/nif.ttl> a owl:Ontology ;
:asdf <http://example.org/404> .

### Serialized using the ttlser deterministic serializer v1.2.0
78 changes: 63 additions & 15 deletions test/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from pathlib import Path
from importlib import import_module
import pytest
import augpathlib as aug
import pyontutils
from pyontutils.utils import get_working_dir
from pyontutils.config import auth
Expand All @@ -30,6 +31,12 @@ def test_query(self):
class TestScripts(Folders, _TestScriptsBase):
""" woo ! """

def setUp(self):
super().setUp()
_temp_git.init()
_test_ttl.copy_outto(_temp_git)
_test_owl.copy_outto(_temp_git)


TestScripts.temp_path = temp_path

Expand Down Expand Up @@ -61,32 +68,73 @@ class TestScripts(Folders, _TestScriptsBase):
import inspect
sf = inspect.getsourcefile(pyontutils)
working_dir = Path(sf).parent.parent
#working_dir = Path(__file__).parent.parent
else:
class RP(aug.RepoPath):
""" can't just change RepoPath._repo_class due to
fail in the no commit case """
_repo_class = Repo

RP._bind_flavours()
working_dir = RP(working_dir)

glb = auth.get_path('git-local-base')
olr = auth.get_path('ontology-local-repo')
if olr.exists():
ont_repo = Repo(olr)
post_load = lambda : (ont_repo.remove_diff_untracked(), ont_repo.checkout_diff_tracked())
post_main = lambda : (ont_repo.remove_diff_untracked(), ont_repo.checkout_diff_tracked())
do_mains = True
if isinstance(working_dir, aug.RepoPath):
this_repo = working_dir.repo
post_load = lambda : (ont_repo.remove_diff_untracked(),
ont_repo.checkout_diff_tracked(),
this_repo.remove_diff_untracked(),
this_repo.checkout_diff_tracked(),)
post_main = lambda : (ont_repo.remove_diff_untracked(),
ont_repo.checkout_diff_tracked(),
this_repo.remove_diff_untracked(),
this_repo.checkout_diff_tracked(),)
else:
post_load = lambda : (ont_repo.remove_diff_untracked(),
ont_repo.checkout_diff_tracked())
post_main = lambda : (ont_repo.remove_diff_untracked(),
ont_repo.checkout_diff_tracked())
else:
post_load = lambda : None
post_main = lambda : None
do_mains = True
if isinstance(working_dir, aug.RepoPath):
this_repo = working_dir.repo
post_load = lambda : (this_repo.remove_diff_untracked(),
this_repo.checkout_diff_tracked(),)
post_main = lambda : (this_repo.remove_diff_untracked(),
this_repo.checkout_diff_tracked(),)

### build mains
else:
post_load = lambda : None
post_main = lambda : None


do_mains = True


default_dir = aug.AugmentedPath(__file__).parent

_test_ttl = (default_dir / 'graphload-test.ttl')
test_ttl = _test_ttl.as_posix()
_test_owl = (default_dir / 'owl-test.ttl')
test_owl = _test_owl.as_posix()
_temp_git = aug.RepoPath(temp_path) / 'git-test'
temp_git = _temp_git.as_posix()

test_ttl = (Path(__file__).parent / 'graphload-test.ttl').as_posix()
nifttl = (olr / 'ttl/nif.ttl').as_posix()
nsmethodsobo = (glb / 'methodsOntology/source-material/ns_methods.obo').as_posix()


### build mains

mains = {'scigraph':None,
'combinators':None,
'hierarchies':None,
'googapis': None,
'closed_namespaces':None,
#'docs':['ont-docs'], # can't seem to get this to work correctly on travis so leaving it out for now
'make_catalog':['ont-catalog', '--jobs', '1'], # hits the network
'make_catalog':['ont-catalog',
'-l', temp_git,
'--jobs', '1'], # hits the network
'graphml_to_ttl':['graphml-to-ttl', 'development/methods/methods_isa.graphml'],
#['ilxcli', '--help'],
'obo_io':['obo-io', '--ttl', nsmethodsobo], # this should also fail, but doesn't ?
Expand All @@ -99,18 +147,18 @@ class TestScripts(Folders, _TestScriptsBase):
],
'necromancy':['necromancy', '-l', temp_path_ap, '--mkdir', test_ttl],
'ontload':[['ontload', '--help'],
['ontload', 'chain', 'NIF-Ontology', 'NIF', nifttl,
['ontload', 'chain', 'NIF-Ontology', 'NIF', test_owl,
'--zip-location', temp_path_ap], # this hits the network, so why doesn't it fail in sandbox?
['ontload', 'config', 'NIF-Ontology', 'NIF',
'--zip-location', temp_path_ap,],
['ontload', 'graph', 'NIF-Ontology', 'NIF',
'--zip-location', temp_path_ap,
'--git-local', temp_path_ap,
'--graphload-ontologies', (Path(__file__).parent / 'ontologies-test.yaml').resolve().as_posix()], # FIXME cleanup
'--graphload-ontologies', (default_dir / 'ontologies-test.yaml').resolve().as_posix()], # FIXME cleanup
['ontload', 'imports', 'NIF-Ontology', 'NIF', test_ttl]],
'ontutils':[['ontutils', '--help'],
['ontutils', 'deadlinks', nifttl],
['ontutils', 'version-iri', nifttl],
['ontutils', 'deadlinks', test_owl],
['ontutils', 'version-iri', test_owl],
#['ontutils', 'spell', test_ttl], # FIXME skipping for now due to huspell dependency
#['ontutils', 'diff', 'test/diff-before.ttl', 'test/diff-after.ttl', 'definition:', 'skos:definition'],
],
Expand Down

0 comments on commit 8bffaf2

Please sign in to comment.