pytest Support
GitAuto runs pytest for Python projects as part of the quality verification pipeline. When a repository contains Python test files, generated tests are executed with pytest before being committed, ensuring the tests actually pass.
Package Manager Detection
Python projects use different package managers. GitAuto detects which one a project uses by checking for lock files: poetry.lock for Poetry, Pipfile.lock for Pipenv, and falls back to pip when no lock file is found. Dependencies are installed in an isolated virtual environment and cached on S3 so subsequent runs skip the install step.
How It Works
GitAuto detects pytest by looking for the binary in the project's virtual environment ( venv/bin/pytest or .venv/bin/pytest), falling back to the system pytest. It runs only the test files modified in the PR, parses the output for failures, and feeds errors back to the model for correction.
Python test files are identified by the test_ prefix convention (e.g., test_utils.py), which differs from the suffix convention used by JavaScript test files.
Dependency Caching
When GitAuto first processes a Python repository, it uploads the dependency manifest files to S3 and triggers a CodeBuild job that creates a virtual environment, installs packages, and tarballs the result. On subsequent runs, GitAuto compares the manifest hash and skips the install if dependencies have not changed. The cached virtual environment is downloaded and extracted into the clone directory before tests run.
Related Features
- Test Execution - runs tests before committing to verify they pass
- PHPUnit Support - equivalent test runner support for PHP projects
- Coverage Enforcement - enforces coverage targets using data from test runs
Need Help?
Have questions or suggestions? We're here to help you get the most out of GitAuto.
Contact us with your questions or feedback!