pytest-tricks
pytest-tricks copied to clipboard
:smirk: Tips and Tricks for the Python Testing Tool
Hi, great project! 👍 Thanks for all the efforts! I would suggest to add another tip to your great site: how to correctly use `patch` and `pytest.mark.parametrize` at the same...
I would like to be able to construct a test as: ``` @pytest.mark.parametrize("method", ["trigger","activate"]) @mock.patch.object(ClassUnderTest, method) def test_verify_method_called_by_run(method_): uut = ClassUnderTest() uut.run() method_.assert_was_called() ``` But this results in `E NameError:...
Hi @nicoddemus! 👋🏻 It's been a while since we've added a new article to this blog and I don't think I have the bandwidth to maintain it anymore. What do...
## Problem I've noticed in some of the example, that `py.test` as a command is used. If I remember correctly, this is declared as deprecated. It could potentially be removed...
I can see this question coming up a lot :wink: Possible solutions include: - Returning a helper object/function from the fixture - Adding a marker on the test and reading...
- module fixtures - package conftest.py - ... - project conftest.py