From 25c397affecb4d2c8cc7d1f62da3e3b89930ba26 Mon Sep 17 00:00:00 2001 From: rllin Date: Wed, 2 Sep 2020 16:57:47 -0700 Subject: [PATCH 1/2] readme for testing --- .github/workflows/python-package.yml | 3 +++ Dockerfile | 7 +++++++ README.md | 17 +++++++++++++++++ 3 files changed, 27 insertions(+) create mode 100644 Dockerfile diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 60492f635..9b7da90fb 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -45,6 +45,9 @@ jobs: run: | pip install tox==3.18.1 tox-gh-actions==1.3.0 + # TODO: replace tox.ini with what the Makefile does + # to make sure local testing is + # identical to github actions which uses tox.ini - name: Test with tox env: # make sure to tell tox to use these environs in tox.ini diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..d825f76ab --- /dev/null +++ b/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3 + +COPY . /usr/src/labelbox +WORKDIR /usr/src/labelbox + +RUN pip install pytest +RUN python setup.py install diff --git a/README.md b/README.md index 5f8e16f58..4f2cf6801 100644 --- a/README.md +++ b/README.md @@ -32,3 +32,20 @@ client = Client() ## Repo Organization and Contribution Please consult `CONTRIB.md` + +## Testing +1. Update the `Makefile` with your `staging` or `prod` API key. Make sure the key is not from a free tier account. +2. To test on `staging`: +``` +make test-staging +``` + +3. To test on `prod`: +``` +make test-prod +``` + +4. If you make any changes and need to rebuild the image used for testing, force a rebuild with the `-B` flag +``` +make -B {build|test-staging|test_prod} +``` From f13cc69c43bc41b8c7d810824c71ad2abd977a3c Mon Sep 17 00:00:00 2001 From: rllin Date: Wed, 2 Sep 2020 16:59:23 -0700 Subject: [PATCH 2/2] Makefile --- Makefile | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 000000000..0fa7f9cde --- /dev/null +++ b/Makefile @@ -0,0 +1,17 @@ + +build: + docker build -t local/labelbox-python:test . + +test-staging: build + docker run -it -v ${PWD}:/usr/src -w /usr/src \ + -e LABELBOX_TEST_ENVIRON="staging" \ + -e LABELBOX_TEST_ENDPOINT="https://staging-api.labelbox.com/graphql" \ + -e LABELBOX_TEST_API_KEY="" \ + local/labelbox-python:test pytest $(PATH_TO_TEST) + +test-prod: build + docker run -it -v ${PWD}:/usr/src -w /usr/src \ + -e LABELBOX_TEST_ENVIRON="prod" \ + -e LABELBOX_TEST_ENDPOINT="https://api.labelbox.com/graphql" \ + -e LABELBOX_TEST_API_KEY="" + local/labelbox-python:test pytest $(PATH_TO_TEST)