Skip to content

Commit 13117a0

Browse files
Add local tests notes.
1 parent 7ce0a6e commit 13117a0

File tree

4 files changed

+48
-8
lines changed

4 files changed

+48
-8
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ main: &main
1616
dist: xenial # precise, trusty, xenial, bionic
1717
language: shell
1818
script:
19-
- docker-compose -f LNX-docker-compose.yml up --build --exit-code-from dj
19+
- docker-compose -f LNX-docker-compose.yml up --build --exit-code-from app
2020
jobs:
2121
include:
2222
- <<: *main

LNX-docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ x-net: &net
33
networks:
44
- main
55
services:
6-
dj:
6+
app:
77
<<: *net
88
image: datajoint/pydev:${PY_VER}-alpine${ALPINE_VER}
99
depends_on:

README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,43 @@ A number of labs are currently adopting DataJoint and we are quickly getting the
9898
* https://docs.datajoint.io -- up-to-date documentation
9999
* https://tutorials.datajoint.io -- step-by-step tutorials
100100
* https://catalog.datajoint.io -- catalog of example pipelines
101+
102+
## Running Tests Locally
103+
104+
105+
* Create an `.env` with desired development environment values e.g.
106+
``` sh
107+
PY_VER=3.7
108+
ALPINE_VER=3.10
109+
MYSQL_VER=5.7
110+
MINIO_VER=RELEASE.2019-09-26T19-42-35Z
111+
UID=1000
112+
GID=1000
113+
```
114+
* `cp local-docker-compose.yml docker-compose.yml`
115+
* `docker-compose up -d` (Note configured `JUPYTER_PASSWORD`)
116+
* Select a means of running Tests e.g. Docker Terminal, or Local Terminal (see bottom)
117+
* Run desired tests. Some examples are as follows:
118+
119+
| Use Case | Shell Code |
120+
| ---------------------------- | ------------------------------------------------------------------------------ |
121+
| Run all tests | `nosetests -vsw tests --with-coverage --cover-package=datajoint` |
122+
| Run one class of tests | `nosetests -vs --tests=tests.test_fetch:TestFetch.test_getattribute_for_fetch1` |
123+
| Run one specific test | `nosetests -vs --tests=tests.test_external_class:test_insert_and_fetch` |
124+
125+
126+
### Launch Docker Terminal
127+
* Shell into `datajoint-python_app_1` i.e. `docker exec -it datajoint-python_app_1 sh`
128+
129+
130+
### Launch Local Terminal
131+
* See `datajoint-python_app` environment variables in `local-docker-compose.yml`
132+
* Launch local terminal
133+
* `export` environment variables in shell
134+
* Add entry in `/etc/hosts` for `127.0.0.1 fakeminio.datajoint.io`
135+
136+
137+
### Launch Jupyter Notebook for Interactive Use
138+
* Navigate to `localhost:8888`
139+
* Input Jupyter password
140+
* Launch a notebook i.e. `New > Python 3`

local-docker-compose.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ x-net: &net
33
networks:
44
- main
55
services:
6-
dj:
6+
app:
77
<<: *net
88
image: datajoint/pydev:${PY_VER}-alpine${ALPINE_VER}
99
depends_on:
@@ -32,7 +32,7 @@ services:
3232
"
3333
pip install --user nose nose-cov coveralls ptvsd .;
3434
pip freeze | grep datajoint;
35-
## You may run the below tests once sh'ed into container i.e. docker exec -it datajoint-python_dj_1 sh
35+
## You may run the below tests once sh'ed into container i.e. docker exec -it datajoint-python_app_1 sh
3636
# nosetests -vsw tests --with-coverage --cover-package=datajoint; #run all tests
3737
# nosetests -vs --tests=tests.test_external_class:test_insert_and_fetch; #run specific basic test
3838
# nosetests -vs --tests=tests.test_fetch:TestFetch.test_getattribute_for_fetch1; #run specific Class test
@@ -45,22 +45,22 @@ services:
4545
done;
4646
"
4747
ports:
48-
- "8889:8888"
48+
- "8888:8888"
4949
- "5678:5678"
5050
user: ${UID}:${GID}
5151
volumes:
5252
- .:/src
5353
- /tmp/.X11-unix:/tmp/.X11-unix:rw
5454
# Additional mounted notebooks may go here
55-
- ./notebook:/home/dja/notebooks
56-
- ../dj-python-101/ch1:/home/dja/tutorials
55+
# - ./notebook:/home/dja/notebooks
56+
# - ../dj-python-101/ch1:/home/dja/tutorials
5757
db:
5858
<<: *net
5959
image: datajoint/mysql:$MYSQL_VER
6060
environment:
6161
- MYSQL_ROOT_PASSWORD=simple
6262
ports:
63-
- "3307:3306"
63+
- "3306:3306"
6464
# To persist MySQL data
6565
# volumes:
6666
# - ./mysql/data:/var/lib/mysql

0 commit comments

Comments
 (0)