* feat: generate custom coverage config to omit legacy and external components * lint * fix components config * also remove deactivated componenets * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
1.4 KiB
1.4 KiB
Dynamic Coverage Configuration
This script generates a custom .coveragerc file for backend testing that excludes:
- Bundled components - Components listed in
SIDEBAR_BUNDLESfromsrc/frontend/src/utils/styleUtils.ts - Legacy components - Python files containing
legacy = True
How it works
- Reads frontend config: Parses
styleUtils.tsto extract bundled component names - Scans backend files: Finds all
.pyfiles insrc/backend/base/langflow/components/withlegacy = True - Generates .coveragerc: Creates exclusion patterns for pytest-cov
Usage
Local development
# Generate config and run tests
python3 scripts/generate_coverage_config.py
cd src/backend && python -m pytest --cov=src/backend/base/langflow --cov-config=.coveragerc
CI Integration
The script runs automatically in CI before backend tests via .github/workflows/python_test.yml.
Files affected
- Input:
src/frontend/src/utils/styleUtils.ts(SIDEBAR_BUNDLES) - Input:
src/backend/base/langflow/components/**/*.py(legacy components) - Output:
src/backend/.coveragerc(auto-generated, in .gitignore)
Benefits
- Accurate coverage: Focuses on actively maintained core code
- Dynamic updates: Automatically adapts when bundles/legacy components change
- Codecov compatible: Generated config works with both local testing and Codecov reporting