pytest-sourceorder-0.5/0000775000175000017500000000000012651661356017015 5ustar pviktoripviktori00000000000000pytest-sourceorder-0.5/setup.py0000664000175000017500000000231712651657457020541 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", description = "Test-ordering plugin for pytest", long_description = readme_contents, url = "https://fedorahosted.org/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', '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/pytest_sourceorder.py0000664000175000017500000000503512651657144023336 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/setup.cfg0000664000175000017500000000012212651661356020631 0ustar pviktoripviktori00000000000000[wheel] universal = 1 [egg_info] tag_build = tag_date = 0 tag_svn_revision = 0 pytest-sourceorder-0.5/README.rst0000664000175000017500000000410012651652236020474 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 Fedora Hosted: https://fedorahosted.org/released/python-pytest-sourceorder/ The goal is to include this project in Fedora repositories. Until that happens, you can use testing builds from COPR – see "Developer links" below. You can also install using pip: https://pypi.python.org/pypi/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 format your contribution using the FreeIPA `patch guidelines`_, and send it to . Any development discussion is welcome there. Someday the project might get its own list, but that seems premature now. Developer links --------------- * Bug tracker: https://fedorahosted.org/python-pytest-sourceorder/report/3 * Code browser: https://git.fedorahosted.org/cgit/python-pytest-sourceorder * git clone https://git.fedorahosted.org/git/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. .. _patch guidelines: http://www.freeipa.org/page/Contribute/Patch_Format pytest-sourceorder-0.5/PKG-INFO0000664000175000017500000000627712651661356020126 0ustar pviktoripviktori00000000000000Metadata-Version: 1.1 Name: pytest-sourceorder Version: 0.5 Summary: Test-ordering plugin for pytest Home-page: https://fedorahosted.org/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 Fedora Hosted: https://fedorahosted.org/released/python-pytest-sourceorder/ The goal is to include this project in Fedora repositories. Until that happens, you can use testing builds from COPR – see "Developer links" below. You can also install using pip: https://pypi.python.org/pypi/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 format your contribution using the FreeIPA `patch guidelines`_, and send it to . Any development discussion is welcome there. Someday the project might get its own list, but that seems premature now. Developer links --------------- * Bug tracker: https://fedorahosted.org/python-pytest-sourceorder/report/3 * Code browser: https://git.fedorahosted.org/cgit/python-pytest-sourceorder * git clone https://git.fedorahosted.org/git/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. .. _patch guidelines: http://www.freeipa.org/page/Contribute/Patch_Format Platform: UNKNOWN Classifier: Development Status :: 4 - Beta Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+) Classifier: Operating System :: POSIX 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/pytest_sourceorder.egg-info/0000775000175000017500000000000012651661356024453 5ustar pviktoripviktori00000000000000pytest-sourceorder-0.5/pytest_sourceorder.egg-info/entry_points.txt0000664000175000017500000000005512651661356027751 0ustar pviktoripviktori00000000000000[pytest11] sourceorder = pytest_sourceorder pytest-sourceorder-0.5/pytest_sourceorder.egg-info/dependency_links.txt0000664000175000017500000000000112651661356030521 0ustar pviktoripviktori00000000000000 pytest-sourceorder-0.5/pytest_sourceorder.egg-info/top_level.txt0000664000175000017500000000002312651661356027200 0ustar pviktoripviktori00000000000000pytest_sourceorder pytest-sourceorder-0.5/pytest_sourceorder.egg-info/SOURCES.txt0000664000175000017500000000046112651661356026340 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/pytest_sourceorder.egg-info/requires.txt0000664000175000017500000000000712651661356027050 0ustar pviktoripviktori00000000000000pytest pytest-sourceorder-0.5/pytest_sourceorder.egg-info/PKG-INFO0000664000175000017500000000627712651661356025564 0ustar pviktoripviktori00000000000000Metadata-Version: 1.1 Name: pytest-sourceorder Version: 0.5 Summary: Test-ordering plugin for pytest Home-page: https://fedorahosted.org/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 Fedora Hosted: https://fedorahosted.org/released/python-pytest-sourceorder/ The goal is to include this project in Fedora repositories. Until that happens, you can use testing builds from COPR – see "Developer links" below. You can also install using pip: https://pypi.python.org/pypi/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 format your contribution using the FreeIPA `patch guidelines`_, and send it to . Any development discussion is welcome there. Someday the project might get its own list, but that seems premature now. Developer links --------------- * Bug tracker: https://fedorahosted.org/python-pytest-sourceorder/report/3 * Code browser: https://git.fedorahosted.org/cgit/python-pytest-sourceorder * git clone https://git.fedorahosted.org/git/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. .. _patch guidelines: http://www.freeipa.org/page/Contribute/Patch_Format Platform: UNKNOWN Classifier: Development Status :: 4 - Beta Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+) Classifier: Operating System :: POSIX 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