Skip to content

Commit

Permalink
add minimal testing
Browse files Browse the repository at this point in the history
  • Loading branch information
abretaud committed Oct 28, 2019
1 parent c70b459 commit 0f9e114
Show file tree
Hide file tree
Showing 29 changed files with 3,492 additions and 20 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,5 @@ docs/_build

# test harness
test_harness.py

apollo_shared_dir
50 changes: 34 additions & 16 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,39 @@
language: python
os: linux

python:
- '2.7'
- '3.5'
script:
- pip install -U pip setuptools
- pip install -U flake8
- flake8 apollo --ignore=E501,W503 --exclude=arrow/commands/,scripts/
- python setup.py install
deploy:
provider: pypi
user: erasche
password:
secure: odHEB/SR+BddRI0qFJU3d57w0J3OjIHLLmoxv5rH46/R6WDBJ1Dqp85rbIEfjTsLEG6bd04kdNSUh/kFB1O8TAOjthixHYNij5qgAfIXYpCTCfoFd/+sqtLl2UddlkO/d895+QV3nEDWSSZuAbys3kBvzVBqlcZ1fpcBr7dyynUJ2hzjD/rq2F475ClKNAA6ICarYZErSu6RHprLieQpUYWKfielXjhMBtWwrJcrwYsdi2bIhdirGpddB5Qi8MZ8BtSpDojpSWBu5O59LLpJhO9JLktO/TfdOSRzZwCAthqbxGvGgpp9x4D5IpTL19uiY5D2jF13nvhYs5Vf2i75FoAGplJ9snOkYE52JJ3/XtqOv22no9P7wSIUJkA/P3DabzqfxlcTdjLtS2v53YehNHL/1ZtrI95y3d37aw9UUKv9KZzz3ostGoAoCIV9YMzK9NrOPeBRRYFzqsrZcOy2yugAawuH/78w9dproeoO/9gFakoLzbObq1gLX10cdnHW4K1qLBE+tasTrXjE5OCa+svBhIMgvk8c+vX/ISvci/pvc1St+prek40vxZi7dIfoqK+iyoACn9RsrdwjSm4Woe058L99wd0FnLaMiLrQNe3h/AHZDQJ5EXGXI0l5egAlJHX/CfxcFekEZS66merlvFUtqsuetd+XIWmAroZq9g0=
on:
tags: true
distributions: sdist bdist_wheel
repo: galaxy-genome-annotation/python-apollo
- '2.7'
- '3.6'

jobs:
include:
- stage: lint
install:
- pip install -U pip setuptools
- pip install -U flake8
script:
- flake8 apollo --ignore=E501,W503 --exclude=arrow/commands/,scripts/

- stage: test
install:
- pip install -U pip nose
script:
- python setup.py install
- export ARROW_GLOBAL_CONFIG_PATH=`pwd`/test-data/arrow.yml
- ./bootstrap_apollo.sh
- python setup.py nosetests

- stage: deploy
deploy:
provider: pypi
username: erasche
password:
secure: odHEB/SR+BddRI0qFJU3d57w0J3OjIHLLmoxv5rH46/R6WDBJ1Dqp85rbIEfjTsLEG6bd04kdNSUh/kFB1O8TAOjthixHYNij5qgAfIXYpCTCfoFd/+sqtLl2UddlkO/d895+QV3nEDWSSZuAbys3kBvzVBqlcZ1fpcBr7dyynUJ2hzjD/rq2F475ClKNAA6ICarYZErSu6RHprLieQpUYWKfielXjhMBtWwrJcrwYsdi2bIhdirGpddB5Qi8MZ8BtSpDojpSWBu5O59LLpJhO9JLktO/TfdOSRzZwCAthqbxGvGgpp9x4D5IpTL19uiY5D2jF13nvhYs5Vf2i75FoAGplJ9snOkYE52JJ3/XtqOv22no9P7wSIUJkA/P3DabzqfxlcTdjLtS2v53YehNHL/1ZtrI95y3d37aw9UUKv9KZzz3ostGoAoCIV9YMzK9NrOPeBRRYFzqsrZcOy2yugAawuH/78w9dproeoO/9gFakoLzbObq1gLX10cdnHW4K1qLBE+tasTrXjE5OCa+svBhIMgvk8c+vX/ISvci/pvc1St+prek40vxZi7dIfoqK+iyoACn9RsrdwjSm4Woe058L99wd0FnLaMiLrQNe3h/AHZDQJ5EXGXI0l5egAlJHX/CfxcFekEZS66merlvFUtqsuetd+XIWmAroZq9g0=
on:
tags: true
distributions: "sdist bdist_wheel"
repo: galaxy-genome-annotation/python-apollo

notifications:
webhooks:
urls:
Expand Down
3 changes: 2 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,10 @@ Or with the Arrow client:
History
-------

- 3.2
- 4.0
- Added support for remote creation/update/deletion of organisms/tracks
- Added support for adding GFF3 in the annotation track
- Added tests
- 3.1
- Added user activate/inactivate
- Added get_creator for user, group and organisms
Expand Down
2 changes: 1 addition & 1 deletion arrow/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '3.1'
__version__ = '4.0'
54 changes: 54 additions & 0 deletions bootstrap_apollo.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/bin/bash

export GALAXY_SHARED_DIR=`pwd`/apollo_shared_dir
mkdir -p "$GALAXY_SHARED_DIR"

docker run -d -it -p 8888:8080 -v `pwd`/apollo_shared_dir/:`pwd`/apollo_shared_dir/ quay.io/gmod/apollo:2.4.1

echo "[BOOTSTRAP] Waiting while Apollo starts up..."
# Wait for apollo to be online
for ((i=0;i<30;i++))
do
APOLLO_UP=$(arrow users get_users 2> /dev/null | head -1 | grep '^\[$' -q; echo "$?")
if [[ $APOLLO_UP -eq 0 ]]; then
break
fi
sleep 10
done

if ! [[ $APOLLO_UP -eq 0 ]]; then
echo "Cannot connect to apollo for bootstrapping"
arrow users get_users
exit "${APOLLO_UP}"
fi

echo "[BOOTSTRAP] Apollo is up, bootstrapping for tests"

# Create some groups
arrow groups create_group one_group
arrow groups create_group another_group

# Create a user
arrow users create_user "[email protected]" Junior Galaxy password

# Add some organisms
cp -r test-data/dataset_1_files/data/ "${GALAXY_SHARED_DIR}/org1"
cp -r test-data/dataset_1_files/data/ "${GALAXY_SHARED_DIR}/org2"
cp -r test-data/dataset_1_files/data/ "${GALAXY_SHARED_DIR}/org3"
cp -r test-data/dataset_1_files/data/ "${GALAXY_SHARED_DIR}/org4"
arrow organisms add_organism --genus Testus --species organus test_organism $GALAXY_SHARED_DIR/org1
arrow organisms add_organism --genus Foo --species barus alt_org $GALAXY_SHARED_DIR/org2
arrow organisms add_organism --genus Foo3 --species barus org3 $GALAXY_SHARED_DIR/org3
arrow organisms add_organism --genus Foo4 --species barus org4 $GALAXY_SHARED_DIR/org4

# Give access to organisms for test user
arrow users update_organism_permissions --write --read --export "[email protected]" test_organism
arrow users update_organism_permissions --write --read --export "[email protected]" alt_org
arrow users update_organism_permissions --write --read --export "[email protected]" org3
arrow users update_organism_permissions --write --read --export "[email protected]" org4

# Load some annotations
arrow annotations load_gff3 test_organism test-data/merlin.gff
arrow annotations load_gff3 alt_org test-data/merlin.gff
arrow annotations load_gff3 org3 test-data/merlin.gff
arrow annotations load_gff3 org4 test-data/merlin.gff
7 changes: 5 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@
except ImportError:
from distutils.core import setup

with open('requirements.txt') as f:
requires = f.read().splitlines()

readme = open('README.rst').read()
subpackages = [x.replace('/', '.') for x in glob.glob('arrow/commands/*') if not x.endswith('.py') and not x.endswith('.pyc')] + \
[x.replace('/', '.') for x in glob.glob('apollo/*') if not x.endswith('.py') and not x.endswith('.pyc')] + ['arrow.commands']

setup(
name="apollo",
version='3.1',
version='4.0',
description="Apollo API library",
long_description=readme,
author="Helena Rasche;Anthony Bretaudeau",
Expand All @@ -24,7 +27,7 @@
[console_scripts]
arrow=arrow.cli:arrow
''',
install_requires=['requests', 'biopython', 'cachetools', 'click>=6.7', 'wrapt', 'pyyaml', 'decorator', 'bcbio-gff'],
install_requires=requires,
license="MIT",
classifiers=[
"Development Status :: 4 - Beta",
Expand Down
5 changes: 5 additions & 0 deletions test-data/arrow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
__default: local
local:
url: "http://localhost:8888"
username: "[email protected]"
password: "password"
44 changes: 44 additions & 0 deletions test-data/dataset_1.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>JBrowse</title>

<link rel="apple-touch-icon" sizes="180x180" href="img/favicons/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="img/favicons/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="img/favicons/favicon-16x16.png">
<link rel="manifest" href="site.webmanifest">
<link rel="mask-icon" href="img/favicons/safari-pinned-tab.svg" color="#5bbad5">
<meta name="msapplication-TileColor" content="#2d89ef">
<meta name="theme-color" content="#ffffff">

<script type="text/javascript">
window.onerror=function(msg){
if( document.body )
document.body.setAttribute("JSError",msg);
}
if(window.process&&process.versions&&process.versions.electron) {
window.electronRequire = require;
delete window.require;
}
</script>
<style>
html, body, div.jbrowse {
margin: 0;
padding: 0;
height: 100%;
width: 100%;
}
</style>
<script type="text/javascript" src="dist/main.bundle.js" charset="utf-8"></script>
</head>

<body>
<div class="jbrowse" id="GenomeBrowser" data-config='"allowCrossOriginDataRoot": false, "cacheBuster": true'>
<div id="LoadingScreen" style="padding: 50px;">
<h1>Loading...</h1>
</div>
</div>
<div style="display: none">JBrowseDefaultMainPage</div>
</body>
</html>
10 changes: 10 additions & 0 deletions test-data/dataset_1_files/data/.htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This Apache .htaccess file is generated by JBrowse (GenomeDB) for
# allowing cross-origin requests as defined by the Cross-Origin
# Resource Sharing working draft from the W3C
# (http://www.w3.org/TR/cors/). In order for Apache to pay attention
# to this, it must have mod_headers enabled, and its AllowOverride
# configuration directive must allow FileInfo overrides.
<IfModule mod_headers.c>
Header onsuccess set Access-Control-Allow-Origin *
Header onsuccess set Access-Control-Allow-Headers X-Requested-With,Range
</IfModule>
1 change: 1 addition & 0 deletions test-data/dataset_1_files/data/names/02b/9.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"merli":{"exact":[],"prefix":["Merlin"]}}
1 change: 1 addition & 0 deletions test-data/dataset_1_files/data/names/0e9/3.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"mer":{"prefix":["Merlin"],"exact":[]}}
1 change: 1 addition & 0 deletions test-data/dataset_1_files/data/names/83f/8.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"merlin":{"prefix":[],"exact":[["Merlin",null,"Merlin",null,0,172788,null]]}}
1 change: 1 addition & 0 deletions test-data/dataset_1_files/data/names/92c/2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"me":{"prefix":["Merlin"],"exact":[]}}
1 change: 1 addition & 0 deletions test-data/dataset_1_files/data/names/cf0/e.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"merl":{"prefix":["Merlin"],"exact":[]}}
1 change: 1 addition & 0 deletions test-data/dataset_1_files/data/names/f26/8.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"m":{"exact":[],"prefix":["Merlin"]}}
1 change: 1 addition & 0 deletions test-data/dataset_1_files/data/names/meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"compress":0,"track_names":[],"format":"json","lowercase_keys":1,"hash_bits":16}
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit 0f9e114

Please sign in to comment.