I observed a very strange behavior of the nets when using the @ mock.patch.object function:
When I run several tests at the same time, I get different results than when I run them separately. In particular, it happens that overriding with @ mock.patch.object does not seem to have an effect, in some cases, when I run several media networks together. When I apply a patch with with , this problem does not occur.
@patch.object(ObjectToOverride,....) def test_mytest()
When using the with method to apply a patch, subsequent tests do not affect previous tests.
def test_mytest() with patch.object(ObjectToOverride,....):
Any suggestions that may cause this behavior are appreciated.
When I run some tests, ObjectToOverride will be loaded and used by previous tests. But I donβt understand why using with or a decorator matters if this object can still be fixed after that.
In both cases, I can observe some interference between the tests. How can this be avoided in nosetest?
source share