A pytest plugin for ensuring tests within a class are run in source order.
The plugin is also available in Fedora repositories as
python3-pytest-sourceorder
.
When installed, test classes marked @pytest_sourceorder.ordered
will
have tests tun in the order of their definition.
Methods are ordered by line nuber of their definition, so spreading them between multiple files or otherwise defining them outside of their class might cause the plugin to order them wrong.
When inheriting from an ordered test class, the superclass' methods will be
run first (even if overridden), followed by the ones from subclasses.
You generally do not want to apply an additional @ordered
decorator
to the subclasses – doing so will reset the inheritance-based ordering.
The project is happy to accept patches! Please file any patches as Pull Requests on the project's Pagure repo. Any development discussion should be in Pagure Pull Requests and Issues.
- Bug tracker: https://pagure.io/python-pytest-sourceorder/issues
- Code browser: https://pagure.io/python-pytest-sourceorder/tree/master
- git clone https://pagure.io/python-pytest-sourceorder.git
- Unstable packages for Fedora: https://copr.fedoraproject.org/coprs/pviktori/pytest-plugins/