Skip to content

Testing and required checks

Q-agent tests shared infrastructure, the graph subsystem, repository hygiene, the project scaffold, and selected LEAN data transformations. A cloud backtest remains the authoritative integration test for QuantConnect-specific strategy behavior.

Local test suite

Configuration lives in pyproject.toml; development dependencies live in requirements-dev.txt.

python -m venv venv
source venv/bin/activate  # Windows PowerShell: venv\Scripts\Activate.ps1
python -m pip install -r requirements-dev.txt

# Same Python suite used in CI
pytest -m "not integration"

# Repository-wide file, syntax, data-size, and project-structure policy
python scripts/check_repository_policy.py --all

# Explicitly include tests that need live tools or services
pytest -m ""

The default suite currently covers:

  • tests/agent_graph_system/: graph ontology, context, provenance, ingestion, walk-forward analysis, and deployment gates;
  • tests/hygiene/: ignored credential paths, coarse secret detection, repository policy, and scaffold rendering;
  • tests/lean_format/: selected LEAN-compatible transformations;
  • tests/qc_integration/: integration-marked LEAN CLI smoke tests;
  • tests/template/: template structure and Python syntax expectations.

Do not assume every pipeline or student strategy is comprehensively tested. New shared behavior needs focused unit tests. New strategy PRs must at minimum pass syntax and structure checks and should include pure-Python tests for signal, constraint, and sizing logic.

Pull-request checks

Every PR reports stable gate names used by the main ruleset:

Required check What it protects
Tests pytest on Python 3.11 and 3.12
Docs strict MkDocs build and internal/external link check
Security Gitleaks and personal-path scanning
Repository policy forbidden files, Python syntax, new-project structure, and data-size limits
Docker image build and smoke tests when image inputs change; otherwise an explicit pass
CodeQL Python static security analysis
Dependency review newly introduced high-severity dependency vulnerabilities

Required checks must pass on a branch that is current with main. A new push cancels obsolete runs and starts a new review cycle.

Repository policy limits

The policy checker rejects:

  • credential-bearing files such as .env, lean.json, and project config.json;
  • private-key formats and generated backtest artifacts;
  • individual files larger than 6 MiB;
  • CSV or TSV fixtures with more than 50,000 rows;
  • Python syntax errors outside the unrendered source template;
  • newly added strategy projects missing main.py, README.md, AGENTS.md, domain/, or models/.

Larger public datasets should be generated by a documented script and stored in an instructor-approved external location. Commit only a small test fixture.

Documentation checks

python -m pip install -r docs/requirements-docs.txt
mkdocs build --strict

GitHub additionally runs Lychee over root and docs/ Markdown. A successful link check proves that links resolve, not that the surrounding instructions are factually current; update documentation whenever behavior changes.

Docker checks

PRs rebuild the image only when the Dockerfile, Docker ignore rules, requirements, or Docker workflow change. Pushes to main build and publish the development image after smoke tests. Release tags publish a separate immutable version tag.