Posts Tagged: ci-cd
-
Converting poetry.lock to requirements.txt for Legacy CI/CD Pipelines
Step-by-step guide to convert Poetry's poetry.lock to pip-compatible requirements.txt for legacy CI/CD pipelines like Jenkins, Travis CI, or GitLab that lack Poetry support. Ensure reproducible Python dependency installs without version drift.
-
How to Pin Transitive Dependencies in requirements.txt to Pass Security Audits
Pin direct + transitive (indirect) dependencies in requirements.txt using pip-tools or uv pip-compile. Pass pip-audit, Safety CLI, Snyk scans with exact versions/hashes. Reproducible, secure Python builds without version drift.
-
Python Testing: pytest vs unittest vs tox + coverage.py – Complete Beginner Guide 2026
Python testing guide: pytest vs unittest benchmarks (pytest 3x faster), tox multi-env, coverage.py reports. Code examples, fixtures, parametrize, pyproject.toml setup. When to use each: unittest legacy, pytest modern, tox CI, coverage TDD. Keywords: 'python pytest tutorial', 'pytest vs unittest', 'tox python', 'coverage.py', 'python unit testing best practices'.
-
How to Fix Flaky pytest Tests Caused by Random Order Execution with pytest-randomly
pytest flaky tests random order fix: pytest-randomly shuffles execution order + seeds random, exposes hidden deps. Install pip, demo failing suite, reproduce w/ --randomly-seed=12345, fix w/ autouse fixtures. CI: --randomly-seed=last. Benchmarks detect 80% hidden flakiness. Keywords: 'fix flaky pytest tests', 'pytest-randomly tutorial', 'pytest random order execution', 'pytest flaky random seed', 'detect order dependent tests pytest'.
-
Reducing pytest Suite Runtime from 45 Minutes to 6 Minutes with pytest-xdist Parallelization
pytest-xdist parallel testing: Speed up pytest suite 45min→6min (7.5x) on multi-core CPUs. pytest -n auto detects cores, -n 8 manual. Markers for serial tests, pytest.ini config. Benchmarks Python 3.12, 1000+ tests. Handles DB fixtures.
-
tox.ini Configuration for Testing Python Packages Across 3.10, 3.11, 3.12, 3.13
tox.ini example: Test Python packages py3.10-3.13 multi-env. pytest coverage mypy ruff integration. pyproject.toml modern setup. Benchmarks: py310 2m→py313 1.5m. Skip missing pythons. CI GitHub Actions. Keywords: 'tox.ini py3.10 py3.11 py3.12 py3.13', 'tox multiple python versions', 'python package testing tox config', 'tox pytest coverage', 'multi python tox tutorial'.