Open m-burst opened 4 years ago
I don't agree on this one. Many people use fixture
s for custom complex asserts. I can even say that this is the best practice.
Examples:
@sobolevn These cases are not what I meant. If the fixture function returns a function which has some assertions in it, that is fine, since the function is called during test code execution and thus becomes part of the test code.
What I see as a violation is making assertions in the fixture function itself, i.e. during setup/teardown:
@pytest.fixture()
def my_thing():
thing = get_my_thing()
assert thing.some_attribute
return thing
In the above case, if the assertion on thing
needs to be made, it should be a separate test case.
Yes, this seems legit! 👍
Rule request
Description
The rule should check that there are no
assert
statements in fixtures.Rationale
no-expect-in-setup-teardown