Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
3a85409
First attempt to use ols4 and repair the build with new Docker repo m…
marcoooo Sep 12, 2023
9474891
ols4 breaking a search.
marcoooo Sep 12, 2023
3c2db0d
Removed submodule
marcoooo Nov 13, 2023
870cea1
Test Travis with new docker container.
marcoooo Dec 1, 2023
4c98749
Silent docker compose to reduce amount of logs in travis.
marcoooo Dec 1, 2023
0f7ae3b
Attempt to run directly from repo.
marcoooo Dec 1, 2023
5b23f47
Added 3.8
marcoooo Dec 1, 2023
34a5c7f
Another attempt
marcoooo Dec 1, 2023
203f072
Get docker-compose
marcoooo Dec 1, 2023
2d8078b
Get docker-compose
marcoooo Dec 1, 2023
6ea82ae
quiet-pull
marcoooo Dec 1, 2023
32116eb
Removed Submodule
marcoooo Dec 6, 2023
f956d55
Use ensembl-ols4 fork.
marcoooo Dec 6, 2023
a066d70
Remove `no-build`
marcoooo Dec 6, 2023
b3731f2
Silence totally docker-compose output
marcoooo Jan 8, 2024
ef0d06a
Trace the last 300 lines to get a hint of failure.
marcoooo Jan 8, 2024
445d210
Re-added `-d` to compose command
marcoooo Jan 8, 2024
e54807e
Debug Docker compose in travis
marcoooo Jan 8, 2024
2d79487
Debug Docker compose in travis
marcoooo Jan 8, 2024
ac87dbc
Debug Docker compose in travis
marcoooo Jan 8, 2024
cb346b2
New attempt to remove unwanted logs
marcoooo Jan 8, 2024
bc5763e
New attempt to remove unwanted logs...
marcoooo Jan 8, 2024
fecc386
Removed submodule - will use our container now
marcoooo Jan 16, 2024
a73c1a3
Updated travis to use the latest new image
marcoooo Jan 17, 2024
09b0181
First pass on fixing tests against reduced set of Ontologies.
marcoooo Jan 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .gitmodules

This file was deleted.

17 changes: 10 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
language: python
python:
- "3.6"
- "3.7"
- "3.8"
services:
- docker
before_install:
- git submodule sync
- git submodule update --init --recursive --remote
- docker build -t ols tests/ols-docker
- docker run -d -p 127.0.0.1:8080:8080 -t ols
- docker ps -a
- docker run -it -d -v /var/run/docker.sock:/var/run/docker.sock ensemblorg/ensembl-ols-docker:latest
install:
- pip install -e .
- pip install -r requirements-test.txt
script:
- |
# Wait for the ols4-backend to be up
until [ "$(curl -s -o /dev/null -w ''%{http_code}'' http://localhost:8080/api)" -eq "200" ]; do
echo 'Waiting for the service to be available...'
sleep 30
done
- nosetests tests.test_basic --verbose --with-coverage --cover-package=ebi.ols
after_success:
- coveralls
after_script:
- docker stop $(docker ps -q)
notifications:
email:
on_success: change
Expand Down
1 change: 1 addition & 0 deletions ebi/ols/api/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,7 @@ def pages(self):
return self._get_pages()

def _get_data(self, path, document):
logger.debug(f"Getting data {path} {document}")
return document.data[path]['docs']

@property
Expand Down
3 changes: 2 additions & 1 deletion ebi/ols/api/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,8 @@ class OntologyConfig(OLSHelper):
skos = None

def __init__(self, **kwargs):
annotations = OntologyAnnotation(**kwargs.pop("annotations", {}))
kwargs.pop("annotations", {})
annotations = OntologyAnnotation(**kwargs)
super().__init__(annotations=annotations, **kwargs)

def __repr__(self):
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ inflection~=0.3.1
coreapi~=2.3.3
hal_codec~=1.0.2
requests~=2.22
urllib3==1.26.6
1 change: 0 additions & 1 deletion tests/ols-docker
Submodule ols-docker deleted from 5f3350
80 changes: 39 additions & 41 deletions tests/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def test_ontology_terms(self):
ontology = self.client.ontology("aero")
terms = ontology.terms()
self.assertEqual(terms.index, 0)
self.assertGreaterEqual(len(terms), ontology.number_of_terms)
self.assertGreaterEqual(ontology.number_of_terms, len(terms))
self._checkTerms(terms)

def test_ontology_individuals(self):
Expand All @@ -128,7 +128,7 @@ def test_ontology_individuals(self):
def test_ontology_properties(self):
ontology = self.client.ontology("aero")
properties = ontology.properties()
self.assertGreaterEqual(len(properties), ontology.number_of_properties)
self.assertGreaterEqual(ontology.number_of_properties, len(properties))
self._checkProperties(properties)

def test_list_range(self):
Expand Down Expand Up @@ -157,35 +157,37 @@ def test_list_filters(self):
Test ontology terms api filtering options
:return:
"""
filters = {'short_form': 'DUO_0000024'}
ontology = self.client.ontology('duo')
ontologies = self.client.ontologies(filters={'fake_filter': 'fake_value'})
filters = {'short_form': 'BFO_0000030"'}
ontology = self.client.ontology('bfo')

terms = ontology.terms(filters=filters)
for term in terms:
self.assertEqual(term.short_form, 'DUO_0000024')
filters = {'obo_id': 'DUO:0000024'}
self.assertEqual(term.short_form, 'BFO_0000030')
filters = {'obo_id': 'BFO:0000030'}
terms = ontology.terms(filters=filters)
for term in terms:
self.assertEqual(term.obo_id, 'DUO:0000024')
self.assertEqual(term.obo_id, 'BFO:0000030')

filters = {'iri': 'http://purl.obolibrary.org/obo/DUO_0000017'}
filters = {'iri': 'http://purl.obolibrary.org/obo/BFO_0000034'}
terms = ontology.terms(filters=filters)
for term in terms:
self.assertEqual(term.short_form, 'DUO_0000017')
self.assertEqual(term.obo_id, 'DUO:0000017')
self.assertEqual(term.iri, 'http://purl.obolibrary.org/obo/DUO_0000017')
self.assertEqual(term.short_form, 'BFO_0000034')
self.assertEqual(term.obo_id, 'BFO:0000034')
self.assertEqual(term.iri, 'http://purl.obolibrary.org/obo/BFO_0000034')

def test_terms(self):
"""
Test direct calls to terms entry point.
Should warn that test may be long according to the nnumber of terms involved
:return:
"""
term_1 = helpers.Term(ontology_name='duo', iri='http://purl.obolibrary.org/obo/DUO_0000026')
term_1 = helpers.Term(ontology_name='bfo', iri='http://purl.obolibrary.org/obo/BFO_0000028')
ancestors = term_1.load_relation('ancestors')
ancestors_obo_ids = []
for ancestor in ancestors:
ancestors_obo_ids.append(ancestors.obo_id)
self._checkTerm(ancestor)
self.assertTrue('BFO:0000004' in ancestors_obo_ids)
self._checkTerm(term_1)

def test_dynamic_links(self):
Expand Down Expand Up @@ -231,7 +233,7 @@ def test_search_filters(self):

def test_childrenOf_is_valid_response_filter(self):
# Given
filters = {'childrenOf':'A'}
filters = {'childrenOf': 'A'}
expected_filters = filters.copy()
# When
actual_filters = self.client.search.filters_response(filters)
Expand All @@ -240,7 +242,7 @@ def test_childrenOf_is_valid_response_filter(self):

def test_childrenOf_value_can_be_set(self):
# Given
filters = {'childrenOf':{'A','B'}}
filters = {'childrenOf': {'A', 'B'}}
expected_filters = filters.copy()
# When
actual_filters = self.client.search.filters_response(filters)
Expand All @@ -257,24 +259,24 @@ def test_childrenOf_value_cannot_be_list(self):
def test_single_childrenOf_filters_search_results(self):
# Given
query = 'chemical'
ontology = 'phi'
ontology = 'bfo'
filters = {
'fieldList': {'iri'},
'childrenOf': 'http://purl.obolibrary.org/obo/PHI_1000000'
}
'childrenOf': 'http://purl.obolibrary.org/obo/BFO_123456'
}
# When
actual_terms = self.client.search(
query=query,
query=query,
ontology=ontology,
filters=filters)
actual_iris = { term.iri for term in actual_terms }
actual_iris = {term.iri for term in actual_terms}
# Then
expected_iris = {
'http://purl.obolibrary.org/obo/PHI_1000003',
'http://purl.obolibrary.org/obo/PHI_1000002'
'http://purl.obolibrary.org/obo/PHI_1000003',
'http://purl.obolibrary.org/obo/PHI_1000002'
}
self.assertEqual(actual_iris, expected_iris)

def test_multiple_childrenOf_filters_search_results(self):
# Given
query = 'chemical'
Expand All @@ -288,15 +290,15 @@ def test_multiple_childrenOf_filters_search_results(self):
}
# When
actual_terms = self.client.search(
query=query,
query=query,
ontology=ontology,
filters=filters)
actual_iris = { term.iri for term in actual_terms }
actual_iris = {term.iri for term in actual_terms}
# Then
expected_iris = {
'http://purl.obolibrary.org/obo/PHI_1000003',
'http://purl.obolibrary.org/obo/PHI_1000002',
'http://purl.obolibrary.org/obo/PHI_2000004'
'http://purl.obolibrary.org/obo/PHI_1000003',
'http://purl.obolibrary.org/obo/PHI_1000002',
'http://purl.obolibrary.org/obo/PHI_2000004'
}
self.assertEqual(actual_iris, expected_iris)

Expand All @@ -310,10 +312,10 @@ def test_childrenOf_non_existant_parent_yields_no_search_results(self):
}
# When
actual_terms = self.client.search(
query=query,
query=query,
ontology=ontology,
filters=filters)
actual_iris = { term.iri for term in actual_terms }
actual_iris = {term.iri for term in actual_terms}
# Then
expected_iris = set()
self.assertEqual(actual_iris, expected_iris)
Expand All @@ -322,7 +324,7 @@ def test_search_kwargs(self):
"""
Test Search feature : - kwargs passed
"""
mixed = self.client.search(query='go', type='property')
mixed = self.client.search(query='bfo', type='property')
self.assertGreaterEqual(len(mixed), 15)

clazz = []
Expand Down Expand Up @@ -439,31 +441,27 @@ def test_namespace(self):
self.assertEqual(h_term.namespace, 'aero')

# retrieved from obo_name_space annotation
h_term = helpers.Term(ontology_name='duo', iri='http://purl.obolibrary.org/obo/DUO_0000017')
h_term = helpers.Term(ontology_name='bfo', iri='http://purl.obolibrary.org/obo/BFO_0000034')
self.client.detail(h_term)
self.assertEqual(h_term.namespace, 'duo')
self.assertEqual(h_term.namespace, 'bfo')

def test_term_description(self):
h_term = self.client.detail(iri="http://www.w3.org/2002/07/owl#Thing",
ontology_name='duo', type=helpers.Term)
ontology_name='aero', type=helpers.Term)
self.assertEqual('', h_term.description)

def test_properties_retrieval(self):
subsets = "is quality measurement of"

s_subsets = self.client.search(query=subsets, ontology='aero', type='property',
exact='true')
seen = set()
self.assertEqual(len(s_subsets), 1)
subset = s_subsets[0]
s_subsets = self.client.search(query=subsets, ontology='aero', type='property', exact='true')
self.assertEqual(len(s_subsets), 2)
subset = s_subsets[1]
d_subset = self.client.property(identifier=subset.iri)
self.assertEqual(d_subset.definition, subset.definition)
self.assertEqual(d_subset.accession, 'IAO:0000221')

def test_term_definition(self):
o_term = self.client.detail(iri="http://purl.obolibrary.org/obo/BFO_0000015",
ontology_name='bfo', type=helpers.Term)
self.assertEqual(o_term.description, o_term.obo_definition_citation[0]['definition'])
self.assertEqual(o_term.description, 'p is a process = Def. p is an occurrent that has temporal proper parts '
'and for some time t, p s-depends_on some material entity at t. (axiom '
'label in BFO2 Reference: [083-003])')
Expand Down