Skip to content

Commit 05cba57

Browse files
author
rllin
authored
[BACKEND-961] readme for testing (#59)
* readme for testing * Makefile
1 parent aedae1b commit 05cba57

File tree

4 files changed

+44
-0
lines changed

4 files changed

+44
-0
lines changed

.github/workflows/python-package.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ jobs:
4545
run: |
4646
pip install tox==3.18.1 tox-gh-actions==1.3.0
4747
48+
# TODO: replace tox.ini with what the Makefile does
49+
# to make sure local testing is
50+
# identical to github actions which uses tox.ini
4851
- name: Test with tox
4952
env:
5053
# make sure to tell tox to use these environs in tox.ini

Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FROM python:3
2+
3+
COPY . /usr/src/labelbox
4+
WORKDIR /usr/src/labelbox
5+
6+
RUN pip install pytest
7+
RUN python setup.py install

Makefile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
build:
3+
docker build -t local/labelbox-python:test .
4+
5+
test-staging: build
6+
docker run -it -v ${PWD}:/usr/src -w /usr/src \
7+
-e LABELBOX_TEST_ENVIRON="staging" \
8+
-e LABELBOX_TEST_ENDPOINT="https://staging-api.labelbox.com/graphql" \
9+
-e LABELBOX_TEST_API_KEY="<REPLACE>" \
10+
local/labelbox-python:test pytest $(PATH_TO_TEST)
11+
12+
test-prod: build
13+
docker run -it -v ${PWD}:/usr/src -w /usr/src \
14+
-e LABELBOX_TEST_ENVIRON="prod" \
15+
-e LABELBOX_TEST_ENDPOINT="https://api.labelbox.com/graphql" \
16+
-e LABELBOX_TEST_API_KEY="<REPLACE>"
17+
local/labelbox-python:test pytest $(PATH_TO_TEST)

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,20 @@ client = Client()
3232

3333
## Repo Organization and Contribution
3434
Please consult `CONTRIB.md`
35+
36+
## Testing
37+
1. Update the `Makefile` with your `staging` or `prod` API key. Make sure the key is not from a free tier account.
38+
2. To test on `staging`:
39+
```
40+
make test-staging
41+
```
42+
43+
3. To test on `prod`:
44+
```
45+
make test-prod
46+
```
47+
48+
4. If you make any changes and need to rebuild the image used for testing, force a rebuild with the `-B` flag
49+
```
50+
make -B {build|test-staging|test_prod}
51+
```

0 commit comments

Comments
 (0)