#pytest

[ follow ]
fromLoopwerk
1 day ago

Django's test runner is underrated

Readable failures. When something breaks, I want to understand why in seconds, not minutes. Predictable setup. I want to know exactly what state my tests are running against. Minimal magic. The less indirection between my test code and what's actually happening, the better. Easy onboarding. New team members should be able to write tests on day one without learning a new paradigm.
Web frameworks
fromNedbatchelder
6 days ago

Testing: exceptions and caches

Kacper Borucki blogged about parameterizing exception testing, and linked to pytest docs and a StackOverflow answer with similar approaches. The common way to test exceptions is to use pytest.raises as a context manager, and have separate tests for the cases that succeed and those that fail. Instead, this approach lets you unify them. I tweaked it to this, which I think reads nicely: One parameterized test that covers both good and bad outcomes. Nice.
#python
fromPythontest
5 months ago

pytest fixtures nuts and bolts - revisited | PythonTest

The new series on pytest fixtures splits the original content into individual concepts, ensuring each is clear and focused, which improves understanding and usability.
#testing
[ Load more ]