pytest-sourceorder-0.5.1/0000775000175000017500000000000013073171776017155 5ustar pviktoripviktori00000000000000pytest-sourceorder-0.5.1/setup.py0000664000175000017500000000235013073171106020652 0ustar pviktoripviktori00000000000000#!/usr/bin/python2 # # Copyright (C) 2014 pytest-sourceorder contributors. See COPYING for license # from setuptools import setup import io with io.open('README.rst', 'rt', encoding='utf-8') as f: readme_contents = f.read() setup_args = dict( name = "pytest-sourceorder", version = "0.5.1", description = "Test-ordering plugin for pytest", long_description = readme_contents, url = "https://pagure.io/python-pytest-sourceorder", license = "GPL", author = "Petr Viktorin", author_email = "pviktori@redhat.com", py_modules = ["pytest_sourceorder"], classifiers=[ 'Development Status :: 4 - Beta', 'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)', 'Operating System :: POSIX', 'Framework :: Pytest', 'Programming Language :: Python', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.4', 'Topic :: Software Development :: Quality Assurance', ], install_requires=['pytest'], entry_points = { 'pytest11': [ 'sourceorder = pytest_sourceorder', ], }, ) if __name__ == '__main__': setup(**setup_args) pytest-sourceorder-0.5.1/pytest_sourceorder.py0000664000175000017500000000503512651657144023475 0ustar pviktoripviktori00000000000000# # Copyright (C) 2014 pytest-sourceorder contributors. See COPYING for license # """Pytest plugin for running tests in source order Adds support for the @pytest.mark.source_order decorator which, when applied to a class, runs the test methods in source order. See test_ordering for an example. """ import unittest import pytest def ordered(cls): """Decorator that marks a test class as ordered Methods within the marked class will be executed in definition order (or more strictly, in ordered by the line number where they're defined). Subclasses of unittest.TestCase can not be ordered. Generator methods will not be ordered by this plugin. """ cls._order_plugin__ordered = True assert not isinstance(cls, unittest.TestCase), ( "A unittest.TestCase may not be ordered.") cls = pytest.mark.source_order(cls) return cls def decorate_items(items): node_indexes = {} for index, item in enumerate(items): try: func = item.function except AttributeError: yield (index, ), item continue key = (index, ) for node in reversed(item.listchain()): # Find the corresponding class if isinstance(node, pytest.Class): cls = node.cls else: continue if getattr(cls, '_order_plugin__ordered', False): node_index = node_indexes.setdefault(node, index) # Find first occurence of the method in class hierarchy for i, parent_class in enumerate(reversed(cls.mro())): if getattr(parent_class, '_order_plugin__ordered', False): method = getattr(parent_class, func.__name__, None) if method: # Sort methods as tuples (position of the class # in the inheritance chain, position of the method # within that class) key = (node_index, 0, i, method.__code__.co_firstlineno, index) break else: # Weird case fallback # Method name not in any of the classes in MRO, run it last key = (node_index, 1, func.__code__.co_firstlineno, index) break yield key, item def pytest_collection_modifyitems(session, config, items): items[:] = [item for i, item in sorted(decorate_items(items))] pytest-sourceorder-0.5.1/setup.cfg0000664000175000017500000000012213073171776020771 0ustar pviktoripviktori00000000000000[wheel] universal = 1 [egg_info] tag_build = tag_date = 0 tag_svn_revision = 0 pytest-sourceorder-0.5.1/README.rst0000664000175000017500000000357413015571615020645 0ustar pviktoripviktori00000000000000A pytest plugin for ensuring tests within a class are run in source order. Downloading ----------- Release tarballs will be made available for download from Pagure Releases: https://pagure.io/releases/python-pytest-sourceorder/ You can also install using pip: https://pypi.python.org/pypi/pytest-sourceorder The plugin is also available in Fedora repositories as ``python3-pytest-sourceorder``. Usage ----- 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. Contributing ------------ 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. Developer links --------------- * 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/ To release, update version in setup.py, add a Git tag like "v0.3", and run `make tarball`. Running `make upload` will put the tarball to Fedora Hosted and PyPI, and a SRPM on Fedorapeople, if you have the rights. Running `make release` will upload and fire a COPR build. .. _Pagure repo: https://pagure.io/python-pytest-sourceorder pytest-sourceorder-0.5.1/PKG-INFO0000664000175000017500000000577513073171776020270 0ustar pviktoripviktori00000000000000Metadata-Version: 1.1 Name: pytest-sourceorder Version: 0.5.1 Summary: Test-ordering plugin for pytest Home-page: https://pagure.io/python-pytest-sourceorder Author: Petr Viktorin Author-email: pviktori@redhat.com License: GPL Description: A pytest plugin for ensuring tests within a class are run in source order. Downloading ----------- Release tarballs will be made available for download from Pagure Releases: https://pagure.io/releases/python-pytest-sourceorder/ You can also install using pip: https://pypi.python.org/pypi/pytest-sourceorder The plugin is also available in Fedora repositories as ``python3-pytest-sourceorder``. Usage ----- 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. Contributing ------------ 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. Developer links --------------- * 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/ To release, update version in setup.py, add a Git tag like "v0.3", and run `make tarball`. Running `make upload` will put the tarball to Fedora Hosted and PyPI, and a SRPM on Fedorapeople, if you have the rights. Running `make release` will upload and fire a COPR build. .. _Pagure repo: https://pagure.io/python-pytest-sourceorder Platform: UNKNOWN Classifier: Development Status :: 4 - Beta Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+) Classifier: Operating System :: POSIX Classifier: Framework :: Pytest Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.4 Classifier: Topic :: Software Development :: Quality Assurance pytest-sourceorder-0.5.1/pytest_sourceorder.egg-info/0000775000175000017500000000000013073171776024613 5ustar pviktoripviktori00000000000000pytest-sourceorder-0.5.1/pytest_sourceorder.egg-info/entry_points.txt0000664000175000017500000000005513073171776030111 0ustar pviktoripviktori00000000000000[pytest11] sourceorder = pytest_sourceorder pytest-sourceorder-0.5.1/pytest_sourceorder.egg-info/dependency_links.txt0000664000175000017500000000000113073171776030661 0ustar pviktoripviktori00000000000000 pytest-sourceorder-0.5.1/pytest_sourceorder.egg-info/top_level.txt0000664000175000017500000000002313073171776027340 0ustar pviktoripviktori00000000000000pytest_sourceorder pytest-sourceorder-0.5.1/pytest_sourceorder.egg-info/SOURCES.txt0000664000175000017500000000046113073171776026500 0ustar pviktoripviktori00000000000000README.rst pytest_sourceorder.py setup.cfg setup.py pytest_sourceorder.egg-info/PKG-INFO pytest_sourceorder.egg-info/SOURCES.txt pytest_sourceorder.egg-info/dependency_links.txt pytest_sourceorder.egg-info/entry_points.txt pytest_sourceorder.egg-info/requires.txt pytest_sourceorder.egg-info/top_level.txtpytest-sourceorder-0.5.1/pytest_sourceorder.egg-info/requires.txt0000664000175000017500000000000713073171776027210 0ustar pviktoripviktori00000000000000pytest pytest-sourceorder-0.5.1/pytest_sourceorder.egg-info/PKG-INFO0000664000175000017500000000577513073171776025726 0ustar pviktoripviktori00000000000000Metadata-Version: 1.1 Name: pytest-sourceorder Version: 0.5.1 Summary: Test-ordering plugin for pytest Home-page: https://pagure.io/python-pytest-sourceorder Author: Petr Viktorin Author-email: pviktori@redhat.com License: GPL Description: A pytest plugin for ensuring tests within a class are run in source order. Downloading ----------- Release tarballs will be made available for download from Pagure Releases: https://pagure.io/releases/python-pytest-sourceorder/ You can also install using pip: https://pypi.python.org/pypi/pytest-sourceorder The plugin is also available in Fedora repositories as ``python3-pytest-sourceorder``. Usage ----- 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. Contributing ------------ 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. Developer links --------------- * 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/ To release, update version in setup.py, add a Git tag like "v0.3", and run `make tarball`. Running `make upload` will put the tarball to Fedora Hosted and PyPI, and a SRPM on Fedorapeople, if you have the rights. Running `make release` will upload and fire a COPR build. .. _Pagure repo: https://pagure.io/python-pytest-sourceorder Platform: UNKNOWN Classifier: Development Status :: 4 - Beta Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+) Classifier: Operating System :: POSIX Classifier: Framework :: Pytest Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.4 Classifier: Topic :: Software Development :: Quality Assurance