3 ms·
Nice concept but does it work with real-world application. I failed to understand how will it work with methods like `authenticate_user(user)` or `load_permissi
by kburman 7y ago
Nice concept but does it work with real-world application.
I failed to understand how will it work with methods like `authenticate_user(user)` or `load_permissions_from_db(user, db)`.
- timothycrosley 7y agoHi @kburman, For cases like that it would be best combined with a mock: @auto_pytest() def test_add(test_case, mocker): mocker.patch('db.call') test_case() Note that this example utilizes the following pytest extension: https://github.com/pytest-dev/pytest-mock https://github.com/pytest-dev/pytest-mock However, I would also note, that just because you have some methods that have potentially dangerous side effects, in most large code-bases, not all functions do. Which is why it operates at a function by function basis. You can use this for new pure functions, while continuing to write other tests in the same fashion by hand.