New issue 484: Order of class fixtures https://bitbucket.org/hpk42/pytest/issue/484/order-of-class-fixtures
javex: I have two fixtures on on a class, like this: class TestMyThing(object): @pytest.fixture(autouse=True) def _fixture_0(self): self.data = ... @pytest.fixture(autouse=True) def _fixture_1(self): data = self.data ... The problem here is that `_fixture_1` needs `_fixture_0` to be run before `_fixture_1` as it needs `self.data` to be set. I'd really like to split these two up instead of using a single fixture as they are fairly complex. They are also only used on this particular class, so I'd prefer to not have it outside of my class for organizational purposes. However, if I name the fixtures in such a way that lexicographic ordering is the other way around, they will not be called in the right order. I guess that pytest orders fixtures somehow internally (or maybe it is internal ordering of python?). Anyways, I'd like some deterministic way of fixture ordering to be documented or configurable. One way I could imagine would be to just document that the will always be lexicographically ordered, thus you can be sure that my above naming would always be in the correct order. Another way would be some kind of mechanism by which I can require another class fixture, since I would order other fixtures this way by declaring one requires the other. Do you think such a feature would be possible? Or do you think it is a very special application that doesn't deserve it? _______________________________________________ pytest-commit mailing list pytest-commit@python.org https://mail.python.org/mailman/listinfo/pytest-commit