This document explains how to set up a local development environment to run tests in this repo, including E2E tests.
- Windows, macOS, or Linux
- Python 3.9+
- Access to the MSAL lab secrets (Key Vault) for E2E tests
- A registered lab app credential: i.e. certificate
.pfxfile path
From repo root:
python -m venv .venv
.\.venv\Scripts\Activate.ps1
python -m pip install --upgrade pip
python -m pip install -r requirements.txtCreate a local .env file in repo root (same folder as setup.py):
LAB_APP_CLIENT_ID=<your-lab-app-client-id>
LAB_APP_CLIENT_CERT_PFX_PATH=C:/path/to/your/cert.pfx
Notes:
tests/test_e2e.pyloads.envautomatically whenpython-dotenvis installed.- For certificate auth,
LAB_APP_CLIENT_CERT_PFX_PATHshould be an absolute path.
Run all non-E2E tests quickly:
python -m pytest -q tests -k "not e2e"Run full E2E unattended suite:
python -m pytest -q tests/test_e2e.pyManual tests (interactive browser/device-flow/POP manual scenarios) are separated into:
tests/test_e2e_manual.py
By default they are skipped. To enable:
$env:RUN_MANUAL_E2E = "1"
python -m pytest -q tests/test_e2e_manual.pyTo disable again in the current shell:
Remove-Item Env:RUN_MANUAL_E2EIf you see errors indicating SNI/x5c is required, your app registration may only accept certificate auth with x5c chain. In this repo, that path is covered by SNI-oriented cert tests.
Verify:
LAB_APP_CLIENT_IDis correctLAB_APP_CLIENT_CERT_PFX_PATHpoints to a valid.pfxfile- Your principal has access to:
https://msidlabs.vault.azure.nethttps://id4skeyvault.vault.azure.net
Interactive/manual tests are intentionally gated. Set RUN_MANUAL_E2E=1 and run tests/test_e2e_manual.py.