Skip to content

Commit

Permalink
Merge pull request #31 from kbase/dev-fix-tests
Browse files Browse the repository at this point in the history
Make tests pass
  • Loading branch information
scanon committed Jul 7, 2022
2 parents b1c3eb1 + 2babcc2 commit ef88c9e
Show file tree
Hide file tree
Showing 16 changed files with 283 additions and 161 deletions.
11 changes: 7 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
sudo: required
language: python
python: "3.7"
python: "3.7.5"

env:
# TODO add more arango versions when they exist
# TODO could split tests so non-arango tests aren't run for every version
- ARANGODB_VER=3.5.0 ARANGODB_V=35

install:
- python --version
- which python
- export ARANGO_FILE=arangodb3-linux-$ARANGODB_VER.tar.gz
- wget https://download.arangodb.com/arangodb$ARANGODB_V/Community/Linux/$ARANGO_FILE
- tar xfz $ARANGO_FILE
- export ARANGO=`pwd`/arangodb3-$ARANGODB_VER/bin/arangodb
- export ARANGOD=`pwd`/arangodb3-$ARANGODB_VER/usr/sbin/arangod

- pip install pipenv coverage pytest-cov python-coveralls flake8
# TODO move everything except pipenv to Pipfile dev section and change to make test
- pip install pipenv coverage pytest-cov coveralls flake8
- pipenv install

script:
# TODO FLAKE8 lots of errors. Need to be fixed, but later
# - flake8 src
# TODO change to make test
- flake8 .
- mkdir arangodata
- $ARANGO start --server.arangod=$ARANGOD --starter.mode single --starter.data-dir ./arangodata
- export PYTHONPATH=$(pwd):$(pwd)/src; pytest --verbose --cov=. .
Expand Down
1 change: 1 addition & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]
flake8 = "*"

[packages]
requests = "==2.22.0"
Expand Down
205 changes: 138 additions & 67 deletions Pipfile.lock

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

6 changes: 3 additions & 3 deletions relation_engine/batchload/time_travelling_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ def register_load_start(

try:
self._database.aql.execute(
f'INSERT @d in @@col',
'INSERT @d in @@col',
bind_vars={'d': doc, '@col': self._registry_collection.name}
)
except _AQLQueryExecuteError as e:
Expand All @@ -273,7 +273,7 @@ def register_load_complete(self, load_namespace, load_version, current_time):

try:
self._database.aql.execute(
f'UPDATE @d in @@col',
'UPDATE @d in @@col',
bind_vars={'d': doc, '@col': self._registry_collection.name}
)
except _AQLQueryExecuteError as e:
Expand All @@ -294,7 +294,7 @@ def register_load_rollback(self, load_namespace, load_version):

try:
self._database.aql.execute(
f'UPDATE @d in @@col',
'UPDATE @d in @@col',
bind_vars={'d': doc, '@col': self._registry_collection.name}
)
# could combine some of this code with the above method... meh
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ def main():

root = requests.get(GO_RELEASES_URL).text
# hacky hacky hacky, could be much less fragile, but who cares
for l in root.split('\n'):
if GO_RELEASES_URL in l and INDEX_HTML in l:
date = l.split(GO_RELEASES_URL)[-1].split('/' + INDEX_HTML)[0]
for line in root.split('\n'):
if GO_RELEASES_URL in line and INDEX_HTML in line:
date = line.split(GO_RELEASES_URL)[-1].split('/' + INDEX_HTML)[0]
download_obograph(a.dir, date)


Expand Down
8 changes: 4 additions & 4 deletions relation_engine/taxa/gtdb/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ def __iter__(self):
for line in self._fh:
accession, lineage = line.strip().split('\t')
lineage = _get_lineage(lineage)
for l in lineage:
l_id = _taxon_to_id(l)
for lin in lineage:
l_id = _taxon_to_id(lin)
if l_id not in seen_taxa:
yield {
'id': l_id,
'rank': _TAXA_TYPES[l['abbrev']],
'name': l['name']
'rank': _TAXA_TYPES[lin['abbrev']],
'name': lin['name']
}
seen_taxa.add(l_id)
yield {
Expand Down
Loading

0 comments on commit ef88c9e

Please sign in to comment.