Skip to content

Commit 89ad89e

Browse files
committed
✅ add travist test logic
1 parent 4e84df6 commit 89ad89e

File tree

4 files changed

+35
-6
lines changed

4 files changed

+35
-6
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -118,3 +118,6 @@ settings.yml
118118

119119
# ipython
120120
Untitled.ipynb
121+
122+
# ignore API cloned for testing
123+
api/

.travis.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,18 @@ install:
1010
- pip install -U codecov
1111

1212
script:
13-
- bash test-container.sh
13+
- bash tests/test-with-compose.sh
1414

1515
after_success:
1616
- codecov
1717

1818
deploy:
1919
provider: pypi
2020
distributions: sdist bdist_wheel
21-
user: isabl_cli-io
21+
user: isabl-io
2222
password: <TO REPLACE THIS RUN `travis encrypt --add deploy.password`>
2323
on:
24-
tags: true
25-
repo: isabl_cli-io/isabl_cli
24+
tags: false
25+
repo: isabl-io/isabl_cli
2626
python: 3.6
2727
branch: master

tests/test-with-compose.sh

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# get path to demo directory
2+
if [ "$SHELL" = "zsh" ]; then
3+
TEST_DIR="$( cd "$(dirname ${(%):-%N})" ; pwd -P )"
4+
else
5+
TEST_DIR="$( cd "$(dirname "$BASH_SOURCE")" ; pwd -P )";
6+
fi
7+
8+
# set directories
9+
CLI_DIR=${TEST_DIR}/..
10+
API_DIR=${CLI_DIR}/api
11+
echo "API directory set to: $API_DIR"
12+
echo "CLI directory set to: $CLI_DIR"
13+
14+
# clone api from github
15+
[ ! -d $API_DIR ] && git clone [email protected]:isabl-io/api.git $API_DIR
16+
17+
# build container
18+
cd $API_DIR && docker-compose build && docker-compose up -d
19+
20+
# create superuser
21+
docker-compose run --rm django python manage.py shell -c "from django.contrib.auth.models import User; User.objects.create_superuser('admin', '[email protected]', 'admin')"
22+
23+
# test Isabl CLI
24+
cd $CLI_DIR && pytest -v tests/

tests/test_signals.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,12 @@
1717
from isabl_cli.settings import get_application_settings
1818
from isabl_cli.settings import system_settings
1919

20+
_FAILED_SIGNAL_MESSAGE = "\n\nNo worries!! This error is part of signals testing...\n\n"
21+
2022

2123
def besuhof_signal(instance):
2224
if "please fail" in instance.notes:
23-
raise Exception("I was told to fail...")
25+
raise Exception(_FAILED_SIGNAL_MESSAGE)
2426
elif "fail with different msg" in instance.notes:
2527
raise Exception("I was told to fail, but with a different msg...")
2628

@@ -40,7 +42,7 @@ def test_failed_signal():
4042
api._run_signals("analyses", analysis, [besuhof_signal])
4143
instances = api.get_instances(**get_kwargs)
4244
assert len(instances) == 1
43-
assert "I was told to fail..." in instances[0].data["failure_traceback"]
45+
assert _FAILED_SIGNAL_MESSAGE in instances[0].data["failure_traceback"]
4446

4547
# assert that error traceback is updated
4648
runner = CliRunner()

0 commit comments

Comments
 (0)