Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,11 @@ test-onprem: build
-e LABELBOX_TEST_API_KEY_ONPREM=${LABELBOX_TEST_API_KEY_ONPREM} \
-e LABELBOX_TEST_ONPREM_HOSTNAME=${LABELBOX_TEST_ONPREM_HOSTNAME} \
local/labelbox-python:test pytest $(PATH_TO_TEST)

test-custom: build
docker run -it -v ${PWD}:/usr/src -w /usr/src \
-e LABELBOX_TEST_ENVIRON="custom" \
-e DA_GCP_LABELBOX_API_KEY=${DA_GCP_LABELBOX_API_KEY} \
-e LABELBOX_TEST_API_KEY_CUSTOM=${LABELBOX_TEST_API_KEY_CUSTOM} \
-e LABELBOX_TEST_GRAPHQL_API_ENDPOINT=${LABELBOX_TEST_GRAPHQL_API_ENDPOINT} \
local/labelbox-python:test pytest $(PATH_TO_TEST)
9 changes: 9 additions & 0 deletions tests/integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class Environ(Enum):
PROD = 'prod'
STAGING = 'staging'
ONPREM = 'onprem'
CUSTOM = 'custom'


@pytest.fixture(scope="session")
Expand Down Expand Up @@ -52,6 +53,12 @@ def graphql_url(environ: str) -> str:
if hostname is None:
raise Exception(f"Missing LABELBOX_TEST_ONPREM_INSTANCE")
return f"{hostname}/api/_gql"
elif environ == Environ.CUSTOM:
graphql_api_endpoint = os.environ.get(
'LABELBOX_TEST_GRAPHQL_API_ENDPOINT')
if graphql_api_endpoint is None:
raise Exception(f"Missing LABELBOX_TEST_GRAPHQL_API_ENDPOINT")
return graphql_api_endpoint
return 'http://host.docker.internal:8080/graphql'


Expand All @@ -62,6 +69,8 @@ def testing_api_key(environ: str) -> str:
return os.environ["LABELBOX_TEST_API_KEY_STAGING"]
elif environ == Environ.ONPREM:
return os.environ["LABELBOX_TEST_API_KEY_ONPREM"]
elif environ == Environ.CUSTOM:
return os.environ["LABELBOX_TEST_API_KEY_CUSTOM"]
return os.environ["LABELBOX_TEST_API_KEY_LOCAL"]


Expand Down
11 changes: 10 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,14 @@ deps =
pytest < 7.0.0
pytest-cases
pytest-rerunfailures
passenv = LABELBOX_TEST_API_KEY_PROD LABELBOX_TEST_API_KEY_STAGING LABELBOX_TEST_ENVIRON DA_GCP_LABELBOX_API_KEY
passenv =
LABELBOX_TEST_ENVIRON
LABELBOX_TEST_API_KEY_PROD
LABELBOX_TEST_API_KEY_STAGING
LABELBOX_TEST_API_KEY_LOCAL
LABELBOX_TEST_API_KEY_ONPREM
LABELBOX_TEST_API_KEY_CUSTOM
LABELBOX_TEST_GRAPHQL_API_ENDPOINT
DA_GCP_LABELBOX_API_KEY

commands = pytest {posargs}