This project uses GitLab CI/CD for automated testing. To run the tests successfully, you need to configure certain variables.
If you want to test the CI pipeline locally before pushing:
./run-gitlab-ci-local.shThis script automatically:
- ✓ Loads credentials from
.env - ✓ Verifies credentials are set
- ✓ Passes them to GitLab CI pipeline using
--variableflags - ✓ Runs pipeline jobs in Docker containers (if Docker available)
- ✓ Shows real-time logs and test outputs
Note: The script uses --variable flag because gitlab-ci-local runs jobs in Docker, and environment variables set in the host shell won't automatically pass to the container.
# Load .env and export
set -a
source .env
set +a
# Run with --variable flags
gitlab-ci-local \
--file ./.gitlab-ci.yml \
--variable "DBC_USERNAME=$DBC_TEST_USERNAME" \
--variable "DBC_PASSWORD=$DBC_TEST_PASSWORD"# If you prefer to set variables differently
export DBC_USERNAME=your_username
export DBC_PASSWORD=your_password
gitlab-ci-local --file ./.gitlab-ci.ymlNote: Option 3 may not work reliably with Docker since environment variables from the host shell may not reach the container. Use Option 1 or 2 instead.
The following variables must be configured in your GitLab project:
Your DeathByCaptcha account username for running integration tests.
Your DeathByCaptcha account password for running integration tests.
- Go to your GitLab project
- Navigate to Settings → CI/CD → Variables
- Click Add variable
- For each variable:
- Key:
DBC_USERNAME(orDBC_PASSWORD) - Value: Your credentials
- Type: Variable
- Scope: All (or specific branch)
- Protect variable: ✓ (Recommended for security)
- Mask variable: ✓ (Hides value in CI/CD logs)
- Key:
The .gitlab-ci.yml file automatically passes these variables to all test jobs:
variables:
DBC_TEST_USERNAME: ${DBC_USERNAME}
DBC_TEST_PASSWORD: ${DBC_PASSWORD}These are then used by the tests in tests/test_integration_balance.py:
username = os.getenv('DBC_TEST_USERNAME')
password = os.getenv('DBC_TEST_PASSWORD')The pipeline runs:
- test:python3.11 - Primary Python version
- test:python3.12 - LTS version
- test:python3.13 - Latest stable
- test:python3.14 - Beta version (allow failure)
- test:python3.15 - RC version (allow failure)
- unittest - Alternative test runner
- test:minimal_deps - Tests with minimal dependency versions
Each job:
- Runs the full test suite with coverage
- Uploads coverage reports (HTML, XML, Cobertura)
- Stores test artifacts for 30 days
For local testing, create a .env file:
cp .env.sample .env
# Edit .env with your credentials
python -m pytest tests/ -vThe .env file is in .gitignore and won't be committed.
- ✅ Use Protected variables to restrict to protected branches only
- ✅ Mask sensitive variables to hide them in logs
- ✅ Use test accounts with minimal balance
- ✅ Rotate credentials regularly
- ✅ Review CI/CD logs carefully before sharing
This means DBC_USERNAME and DBC_PASSWORD environment variables are not set. Check:
- Variables are configured in Settings → CI/CD → Variables
- Variable scope includes the current branch
- Pipeline was run after variables were configured (may need to re-run)
This is expected if you checked Mask variable. This is the secure behavior.
Check that:
.envfile exists locally (not committed to git)- Same credentials are configured in GitLab CI/CD variables
- Credentials are valid and have sufficient balance
- Integration tests that require credentials are in
tests/test_integration_balance.py - Other unit tests don't require credentials and always run
- GitLab CI runs all tests; failures are reported but don't block the pipeline if marked
allow_failure: true