Skip to content
Closed
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
16 changes: 14 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ ATHENA_NON_EXISTENT_AFFILIATE=non-existent-affiliate-id (default:
thisaffiliatedoesnotexist123) - this is used to test error handling.
ATHENA_NON_PERMITTED_AFFILIATE=non-permitted-affiliate-id (default:
thisaffiliatedoesnothaveathenaenabled) - this is used to test error handling.
ATHENA_E2E_TESTCASE_DIR=test-case-directory (default: integrator_sample) - this is the test case directory to use for the e2e tests.
See E2E Tests section below for more details.
```

Then run the functional tests with:
Expand All @@ -170,8 +172,18 @@ Then run the functional tests with:
pytest -m functional
```

To exclude the e2e tests, which require usage of the live classifier and
therefore are unsuitable for regular development runs, use:
#### E2E Tests

The e2e tests assert that the API returns some expected _scores_ rather than
exercising different API paths. As such, they are dependent on the classifier
that you are calling through the API. Right now, there are 2 types of
classifier, benign and live. By default, the tests will run the
`integrator_sample` test set, which uses the live classifier. If you wish to
use the benign classifier instead, you may set the `ATHENA_E2E_TESTCASE_DIR`
environment variable to `benign_model`.

Alternatively, you may disable these tests altogether, by excluding tests that
have the `e2e` marker, something like this:

```bash
pytest -m 'functional and not e2e'
Expand Down
4 changes: 2 additions & 2 deletions tests/functional/e2e/test_classify_single.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
from resolver_athena_client.client.models import ImageData
from tests.functional.e2e.testcases.parser import (
AthenaTestCase,
load_test_cases,
load_test_cases_by_env,
)

TEST_CASES = load_test_cases("integrator_sample")
TEST_CASES = load_test_cases_by_env()

FP_ERROR_TOLERANCE = 1e-4

Expand Down
10 changes: 10 additions & 0 deletions tests/functional/e2e/testcases/parser.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import json
import os
from pathlib import Path

from dotenv import load_dotenv

# Path to the shared testcases directory in athena-protobufs
_REPO_ROOT = Path(__file__).parent.parent.parent.parent.parent
TESTCASES_DIR = _REPO_ROOT / "athena-protobufs" / "testcases"
Expand All @@ -23,6 +26,13 @@ def __init__(
self.classification_labels: list[str] = classification_labels


def load_test_cases_by_env() -> list[AthenaTestCase]:
_ = load_dotenv()
return load_test_cases(
os.getenv("ATHENA_E2E_TESTCASE_DIR", "integrator_sample")
)


def load_test_cases(dirname: str = "benign_model") -> list[AthenaTestCase]:
with Path.open(
Path(TESTCASES_DIR / dirname / "expected_outputs.json"),
Expand Down