Background: in a closed-source project I had the case that a mock established in a test interfered with a fixture teardown using the mocked method
Given a test (1) using pytest-mock and another fixture(2), if 1 mocks a method and 2 then wants to use it, I depend on the pytest fixture order whether the mocker teardown runs before or after 2 leading to issues.
Of course there are partly solutions like explicit fixture order by require them in a bundle fixture or by storing the method in a variable before the test starts but all of them are only partly solutions or are cumbersome.
It would be great if pytest-mock could give an guarantee that the mocks are removed right after the test function ran. Is there any option
Background: in a closed-source project I had the case that a mock established in a test interfered with a fixture teardown using the mocked method
Given a test (1) using pytest-mock and another fixture(2), if 1 mocks a method and 2 then wants to use it, I depend on the pytest fixture order whether the mocker teardown runs before or after 2 leading to issues.
Of course there are partly solutions like explicit fixture order by require them in a bundle fixture or by storing the method in a variable before the test starts but all of them are only partly solutions or are cumbersome.
It would be great if pytest-mock could give an guarantee that the mocks are removed right after the test function ran. Is there any option