You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This might not be a bug, and it might have just been a workaround, that has been properly fixed. If it has, please let me know how to migrate to a proper write of the test.
At our work, we wrote many tests like this ever since fixtures were introduced:
Strange that fixture runs, but whatever variables it sets, pytest doesn't seem to care.
Looking at the submitted changelog, nothing seems to stick out.
removing scope='class' and @classmethod allows us to use the fixture on the newer versions, but it'll run for every single function in the class, which is not the behavior we want.
So two questions:
Is this style of writing tests unwanted? Is it invalid?
If it's invalid, what is the proper right way to write these kinds of tests? Ideally would like an solution that would require minimal work.
The text was updated successfully, but these errors were encountered:
xNinjaKittyx
changed the title
Pytest fixtures with scope='class' inside a class no longer work
Pytest classmethod fixtures with scope='class' no longer save class variables.
Mar 18, 2019
This might not be a bug, and it might have just been a workaround, that has been properly fixed. If it has, please let me know how to migrate to a proper write of the test.
At our work, we wrote many tests like this ever since fixtures were introduced:
In this scenario, we want the fixture to only run once per class, but we also want to keep a context of the class.
however, starting from Pytest > 3.7.0 (and all 4 versions), this no longer works. The context is completely removed:
Strange that fixture runs, but whatever variables it sets, pytest doesn't seem to care.
Looking at the submitted changelog, nothing seems to stick out.
removing
scope='class'
and@classmethod
allows us to use the fixture on the newer versions, but it'll run for every single function in the class, which is not the behavior we want.So two questions:
pip list:
The text was updated successfully, but these errors were encountered: