Miloslav Pojman
Miloslav is an experienced software engineer with focus on data processing and web applications.
He is using Python since the version 2.4. EuroPython 2024 will be his third one in the speaker role.
Session
07-12
11:55
30min
Pytest Design Patterns
Miloslav Pojman
Proper testing of your Python application doesn't require a rewrite into hexagonal architecture (whatever it means 🤷). In this session, we'll explore battle-tested techniques to enhance the maintainability of your test suite.
- Embracing Well-Known Patterns: The test client or transaction-bound tests are well-established patterns originating from Django. We will explore how to extend these foundational practices within pytest.
- Employing Fixture Factories: How to ensure that our test data clearly cover the intended scenarios? Unpack the utility of fixture factories, streamlining the setup process.
- Mocking without Monkey Patching: Learn effective mocking, steering clear of the problematic practice of monkey patching. We'll explore strategies to achieve accurate testing using favorite frameworks and libraries.
- Covering More with Parametrized Fixtures: Many developers are familiar with pytest fixtures and parametrized tests, but may not be aware of the power of their combination: parametrized fixtures. Discover how to easily build more comprehensive tests.
- Rethinking Test Categorization: The traditional division into unit and integration tests often falls short in practical application. We'll check an alternative approach that can better align with real-world scenarios.
The goal is not merely to report higher coverage but to have tests that can be trusted. By incorporating established patterns, you'll be empowered to focus on what truly matters.
Testing and QA
North Hall