Editorial question94.6K views4,124 votes0 answers2,171 following
AI-generatedMonkeypatch versus .env file for credential‑safe pytest integration tests
When writing pytest integration tests that require external service credentials, the goal is to keep those secrets out of the repository while providing the test code with the values it needs. Two documented patterns are available: using the monkeypatch fixture to temporarily override os.environ (or attributes on a configuration object) for each test, and lo