commit python3-pytest-cov for openSUSE:Factory
Hello community, here is the log from the commit of package python3-pytest-cov for openSUSE:Factory checked in at 2014-07-31 21:50:38 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python3-pytest-cov (Old) and /work/SRC/openSUSE:Factory/.python3-pytest-cov.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "python3-pytest-cov" Changes: -------- --- /work/SRC/openSUSE:Factory/python3-pytest-cov/python3-pytest-cov.changes 2014-02-12 07:08:02.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.python3-pytest-cov.new/python3-pytest-cov.changes 2014-07-31 21:51:00.000000000 +0200 @@ -1,0 +2,6 @@ +Wed Jul 30 07:27:46 UTC 2014 - toddrme2178@gmail.com + +- Update to 1.7.0 + * No upstream changelog + +------------------------------------------------------------------- Old: ---- pytest-cov-1.6.tar.gz New: ---- pytest-cov-1.7.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python3-pytest-cov.spec ++++++ --- /var/tmp/diff_new_pack.BNWwDG/_old 2014-07-31 21:51:01.000000000 +0200 +++ /var/tmp/diff_new_pack.BNWwDG/_new 2014-07-31 21:51:01.000000000 +0200 @@ -16,7 +16,7 @@ Name: python3-pytest-cov -Version: 1.6 +Version: 1.7.0 Release: 0 License: MIT Summary: Pytest plugin for coverage reporting @@ -25,9 +25,13 @@ Source: https://pypi.python.org/packages/source/p/pytest-cov/pytest-cov-%{version}.tar.gz BuildRequires: python3-devel BuildRequires: python3-setuptools +BuildRequires: python3-cov-core >= 1.12 +BuildRequires: python3-pytest >= 2.2.3 # Test requirements: BuildRequires: python3-py +BuildRequires: python3-virtualenv Requires: python3-pytest >= 2.2.3 +Requires: python3-cov-core >= 1.12 BuildArch: noarch %description @@ -51,7 +55,7 @@ %files %defattr(-,root,root,-) -%doc LICENSE.txt README.txt +%doc LICENSE.txt README.rst %{python3_sitelib}/* %changelog ++++++ pytest-cov-1.6.tar.gz -> pytest-cov-1.7.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-cov-1.6/MANIFEST.in new/pytest-cov-1.7.0/MANIFEST.in --- old/pytest-cov-1.6/MANIFEST.in 2010-08-02 15:27:37.000000000 +0200 +++ new/pytest-cov-1.7.0/MANIFEST.in 2014-04-24 21:56:06.000000000 +0200 @@ -1,4 +1,4 @@ -include README.txt +include README.rst include LICENSE.txt include setup.py include pytest_cov.py diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-cov-1.6/PKG-INFO new/pytest-cov-1.7.0/PKG-INFO --- old/pytest-cov-1.6/PKG-INFO 2012-05-12 02:03:20.000000000 +0200 +++ new/pytest-cov-1.7.0/PKG-INFO 2014-06-12 20:24:03.000000000 +0200 @@ -1,14 +1,30 @@ -Metadata-Version: 1.0 +Metadata-Version: 1.1 Name: pytest-cov -Version: 1.6 +Version: 1.7.0 Summary: py.test plugin for coverage reporting with support for both centralised and distributed testing, including subprocesses and multiprocessing -Home-page: http://bitbucket.org/memedough/pytest-cov/overview -Author: Meme Dough -Author-email: memedough@gmail.com +Home-page: https://github.com/schlamar/pytest-cov +Author: Marc Schlaich +Author-email: marc.schlaich@gmail.com License: MIT License Description: pytest-cov ========== + .. image:: https://travis-ci.org/schlamar/pytest-cov.svg?branch=master + :target: https://travis-ci.org/schlamar/pytest-cov + :alt: Build status + + .. image:: https://pypip.in/download/pytest-cov/badge.png + :target: https://pypi.python.org/pypi//pytest-cov/ + :alt: Downloads + + .. image:: https://pypip.in/version/pytest-cov/badge.png + :target: https://pypi.python.org/pypi/pytest-cov/ + :alt: Latest Version + + .. image:: https://pypip.in/license/pytest-cov/badge.png + :target: https://pypi.python.org/pypi/pytest-cov/ + :alt: License + This plugin produces coverage reports. It supports centralised testing and distributed testing in both load and each modes. It also supports coverage of subprocesses. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-cov-1.6/README.rst new/pytest-cov-1.7.0/README.rst --- old/pytest-cov-1.6/README.rst 1970-01-01 01:00:00.000000000 +0100 +++ new/pytest-cov-1.7.0/README.rst 2014-06-12 19:58:28.000000000 +0200 @@ -0,0 +1,266 @@ +pytest-cov +========== + +.. image:: https://travis-ci.org/schlamar/pytest-cov.svg?branch=master + :target: https://travis-ci.org/schlamar/pytest-cov + :alt: Build status + +.. image:: https://pypip.in/download/pytest-cov/badge.png + :target: https://pypi.python.org/pypi//pytest-cov/ + :alt: Downloads + +.. image:: https://pypip.in/version/pytest-cov/badge.png + :target: https://pypi.python.org/pypi/pytest-cov/ + :alt: Latest Version + +.. image:: https://pypip.in/license/pytest-cov/badge.png + :target: https://pypi.python.org/pypi/pytest-cov/ + :alt: License + +This plugin produces coverage reports. It supports centralised testing and distributed testing in +both load and each modes. It also supports coverage of subprocesses. + +All features offered by the coverage package should be available, either through pytest-cov or +through coverage's config file. + + +Installation +------------ + +Install with pip:: + + pip install pytest-cov + +For distributed testing support install pytest-xdist:: + + pip install pytest-xdist + +.. NOTE:: + + Ensure you use pip instead of easy_install as the latter does not correctly install the + init_cov_core.pth file needed for subprocess measurement. + + +Uninstallation +-------------- + +Uninstall with pip:: + + pip uninstall pytest-cov + pip uninstall cov-core + +.. NOTE:: + + Ensure that you manually delete the init_cov_core.pth file in your site-packages directory. + + This file starts coverage collection of subprocesses if appropriate during site initialisation + at python startup. + + +Usage +----- + +Centralised Testing +~~~~~~~~~~~~~~~~~~~ + +Centralised testing will report on the combined coverage of the main process and all of it's +subprocesses. + +Running centralised testing:: + + py.test --cov myproj tests/ + +Shows a terminal report:: + + -------------------- coverage: platform linux2, python 2.6.4-final-0 --------------------- + Name Stmts Miss Cover + ---------------------------------------- + myproj/__init__ 2 0 100% + myproj/myproj 257 13 94% + myproj/feature4286 94 7 92% + ---------------------------------------- + TOTAL 353 20 94% + + +Distributed Testing: Load +~~~~~~~~~~~~~~~~~~~~~~~~~ + +Distributed testing with dist mode set to load will report on the combined coverage of all slaves. +The slaves may be spread out over any number of hosts and each slave may be located anywhere on the +file system. Each slave will have it's subprocesses measured. + +Running distributed testing with dist mode set to load:: + + py.test --cov myproj -n 2 tests/ + +Shows a terminal report:: + + -------------------- coverage: platform linux2, python 2.6.4-final-0 --------------------- + Name Stmts Miss Cover + ---------------------------------------- + myproj/__init__ 2 0 100% + myproj/myproj 257 13 94% + myproj/feature4286 94 7 92% + ---------------------------------------- + TOTAL 353 20 94% + + +Again but spread over different hosts and different directories:: + + py.test --cov myproj --dist load + --tx ssh=memedough@host1//chdir=testenv1 + --tx ssh=memedough@host2//chdir=/tmp/testenv2//python=/tmp/env1/bin/python + --rsyncdir myproj --rsyncdir tests --rsync examples + tests/ + +Shows a terminal report:: + + -------------------- coverage: platform linux2, python 2.6.4-final-0 --------------------- + Name Stmts Miss Cover + ---------------------------------------- + myproj/__init__ 2 0 100% + myproj/myproj 257 13 94% + myproj/feature4286 94 7 92% + ---------------------------------------- + TOTAL 353 20 94% + + +Distributed Testing: Each +~~~~~~~~~~~~~~~~~~~~~~~~~ + +Distributed testing with dist mode set to each will report on the combined coverage of all slaves. +Since each slave is running all tests this allows generating a combined coverage report for multiple +environments. + +Running distributed testing with dist mode set to each:: + + py.test --cov myproj --dist each + --tx popen//chdir=/tmp/testenv3//python=/usr/local/python27/bin/python + --tx ssh=memedough@host2//chdir=/tmp/testenv4//python=/tmp/env2/bin/python + --rsyncdir myproj --rsyncdir tests --rsync examples + tests/ + +Shows a terminal report:: + + ---------------------------------------- coverage ---------------------------------------- + platform linux2, python 2.6.5-final-0 + platform linux2, python 2.7.0-final-0 + Name Stmts Miss Cover + ---------------------------------------- + myproj/__init__ 2 0 100% + myproj/myproj 257 13 94% + myproj/feature4286 94 7 92% + ---------------------------------------- + TOTAL 353 20 94% + + +Reporting +--------- + +It is possible to generate any combination of the reports for a single test run. + +The available reports are terminal (with or without missing line numbers shown), HTML, XML and +annotated source code. + +The terminal report without line numbers (default):: + + py.test --cov-report term --cov myproj tests/ + + -------------------- coverage: platform linux2, python 2.6.4-final-0 --------------------- + Name Stmts Miss Cover + ---------------------------------------- + myproj/__init__ 2 0 100% + myproj/myproj 257 13 94% + myproj/feature4286 94 7 92% + ---------------------------------------- + TOTAL 353 20 94% + + +The terminal report with line numbers:: + + py.test --cov-report term-missing --cov myproj tests/ + + -------------------- coverage: platform linux2, python 2.6.4-final-0 --------------------- + Name Stmts Miss Cover Missing + -------------------------------------------------- + myproj/__init__ 2 0 100% + myproj/myproj 257 13 94% 24-26, 99, 149, 233-236, 297-298, 369-370 + myproj/feature4286 94 7 92% 183-188, 197 + -------------------------------------------------- + TOTAL 353 20 94% + + +The remaining three reports output to files without showing anything on the terminal (useful for +when the output is going to a continuous integration server):: + + py.test --cov-report html + --cov-report xml + --cov-report annotate + --cov myproj tests/ + + +Coverage Data File +------------------ + +The data file is erased at the beginning of testing to ensure clean data for each test run. + +The data file is left at the end of testing so that it is possible to use normal coverage tools to +examine it. + + +Coverage Config File +-------------------- + +This plugin provides a clean minimal set of command line options that are added to pytest. For +further control of coverage use a coverage config file. + +For example if tests are contained within the directory tree being measured the tests may be +excluded if desired by using a .coveragerc file with the omit option set:: + + py.test --cov-config .coveragerc + --cov myproj + myproj/tests/ + +Where the .coveragerc file contains file globs:: + + [run] + omit = tests/* + +For full details refer to the `coverage config file`_ documentation. + +.. _`coverage config file`: http://nedbatchelder.com/code/coverage/config.html + +Note that this plugin controls some options and setting the option in the config file will have no +effect. These include specifying source to be measured (source option) and all data file handling +(data_file and parallel options). + + +Limitations +----------- + +For distributed testing the slaves must have the pytest-cov package installed. This is needed since +the plugin must be registered through setuptools / distribute for pytest to start the plugin on the +slave. + +For subprocess measurement environment variables must make it from the main process to the +subprocess. The python used by the subprocess must have pytest-cov installed. The subprocess must +do normal site initialisation so that the environment variables can be detected and coverage +started. + + +Acknowledgements +---------------- + +Whilst this plugin has been built fresh from the ground up it has been influenced by the work done +on pytest-coverage (Ross Lawley, James Mills, Holger Krekel) and nose-cover (Jason Pellerin) which are +other coverage plugins. + +Ned Batchelder for coverage and its ability to combine the coverage results of parallel runs. + +Holger Krekel for pytest with its distributed testing support. + +Jason Pellerin for nose. + +Michael Foord for unittest2. + +No doubt others have contributed to these tools as well. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-cov-1.6/README.txt new/pytest-cov-1.7.0/README.txt --- old/pytest-cov-1.6/README.txt 2012-05-12 01:54:33.000000000 +0200 +++ new/pytest-cov-1.7.0/README.txt 1970-01-01 01:00:00.000000000 +0100 @@ -1,250 +0,0 @@ -pytest-cov -========== - -This plugin produces coverage reports. It supports centralised testing and distributed testing in -both load and each modes. It also supports coverage of subprocesses. - -All features offered by the coverage package should be available, either through pytest-cov or -through coverage's config file. - - -Installation ------------- - -Install with pip:: - - pip install pytest-cov - -For distributed testing support install pytest-xdist:: - - pip install pytest-xdist - -.. NOTE:: - - Ensure you use pip instead of easy_install as the latter does not correctly install the - init_cov_core.pth file needed for subprocess measurement. - - -Uninstallation --------------- - -Uninstall with pip:: - - pip uninstall pytest-cov - pip uninstall cov-core - -.. NOTE:: - - Ensure that you manually delete the init_cov_core.pth file in your site-packages directory. - - This file starts coverage collection of subprocesses if appropriate during site initialisation - at python startup. - - -Usage ------ - -Centralised Testing -~~~~~~~~~~~~~~~~~~~ - -Centralised testing will report on the combined coverage of the main process and all of it's -subprocesses. - -Running centralised testing:: - - py.test --cov myproj tests/ - -Shows a terminal report:: - - -------------------- coverage: platform linux2, python 2.6.4-final-0 --------------------- - Name Stmts Miss Cover - ---------------------------------------- - myproj/__init__ 2 0 100% - myproj/myproj 257 13 94% - myproj/feature4286 94 7 92% - ---------------------------------------- - TOTAL 353 20 94% - - -Distributed Testing: Load -~~~~~~~~~~~~~~~~~~~~~~~~~ - -Distributed testing with dist mode set to load will report on the combined coverage of all slaves. -The slaves may be spread out over any number of hosts and each slave may be located anywhere on the -file system. Each slave will have it's subprocesses measured. - -Running distributed testing with dist mode set to load:: - - py.test --cov myproj -n 2 tests/ - -Shows a terminal report:: - - -------------------- coverage: platform linux2, python 2.6.4-final-0 --------------------- - Name Stmts Miss Cover - ---------------------------------------- - myproj/__init__ 2 0 100% - myproj/myproj 257 13 94% - myproj/feature4286 94 7 92% - ---------------------------------------- - TOTAL 353 20 94% - - -Again but spread over different hosts and different directories:: - - py.test --cov myproj --dist load - --tx ssh=memedough@host1//chdir=testenv1 - --tx ssh=memedough@host2//chdir=/tmp/testenv2//python=/tmp/env1/bin/python - --rsyncdir myproj --rsyncdir tests --rsync examples - tests/ - -Shows a terminal report:: - - -------------------- coverage: platform linux2, python 2.6.4-final-0 --------------------- - Name Stmts Miss Cover - ---------------------------------------- - myproj/__init__ 2 0 100% - myproj/myproj 257 13 94% - myproj/feature4286 94 7 92% - ---------------------------------------- - TOTAL 353 20 94% - - -Distributed Testing: Each -~~~~~~~~~~~~~~~~~~~~~~~~~ - -Distributed testing with dist mode set to each will report on the combined coverage of all slaves. -Since each slave is running all tests this allows generating a combined coverage report for multiple -environments. - -Running distributed testing with dist mode set to each:: - - py.test --cov myproj --dist each - --tx popen//chdir=/tmp/testenv3//python=/usr/local/python27/bin/python - --tx ssh=memedough@host2//chdir=/tmp/testenv4//python=/tmp/env2/bin/python - --rsyncdir myproj --rsyncdir tests --rsync examples - tests/ - -Shows a terminal report:: - - ---------------------------------------- coverage ---------------------------------------- - platform linux2, python 2.6.5-final-0 - platform linux2, python 2.7.0-final-0 - Name Stmts Miss Cover - ---------------------------------------- - myproj/__init__ 2 0 100% - myproj/myproj 257 13 94% - myproj/feature4286 94 7 92% - ---------------------------------------- - TOTAL 353 20 94% - - -Reporting ---------- - -It is possible to generate any combination of the reports for a single test run. - -The available reports are terminal (with or without missing line numbers shown), HTML, XML and -annotated source code. - -The terminal report without line numbers (default):: - - py.test --cov-report term --cov myproj tests/ - - -------------------- coverage: platform linux2, python 2.6.4-final-0 --------------------- - Name Stmts Miss Cover - ---------------------------------------- - myproj/__init__ 2 0 100% - myproj/myproj 257 13 94% - myproj/feature4286 94 7 92% - ---------------------------------------- - TOTAL 353 20 94% - - -The terminal report with line numbers:: - - py.test --cov-report term-missing --cov myproj tests/ - - -------------------- coverage: platform linux2, python 2.6.4-final-0 --------------------- - Name Stmts Miss Cover Missing - -------------------------------------------------- - myproj/__init__ 2 0 100% - myproj/myproj 257 13 94% 24-26, 99, 149, 233-236, 297-298, 369-370 - myproj/feature4286 94 7 92% 183-188, 197 - -------------------------------------------------- - TOTAL 353 20 94% - - -The remaining three reports output to files without showing anything on the terminal (useful for -when the output is going to a continuous integration server):: - - py.test --cov-report html - --cov-report xml - --cov-report annotate - --cov myproj tests/ - - -Coverage Data File ------------------- - -The data file is erased at the beginning of testing to ensure clean data for each test run. - -The data file is left at the end of testing so that it is possible to use normal coverage tools to -examine it. - - -Coverage Config File --------------------- - -This plugin provides a clean minimal set of command line options that are added to pytest. For -further control of coverage use a coverage config file. - -For example if tests are contained within the directory tree being measured the tests may be -excluded if desired by using a .coveragerc file with the omit option set:: - - py.test --cov-config .coveragerc - --cov myproj - myproj/tests/ - -Where the .coveragerc file contains file globs:: - - [run] - omit = tests/* - -For full details refer to the `coverage config file`_ documentation. - -.. _`coverage config file`: http://nedbatchelder.com/code/coverage/config.html - -Note that this plugin controls some options and setting the option in the config file will have no -effect. These include specifying source to be measured (source option) and all data file handling -(data_file and parallel options). - - -Limitations ------------ - -For distributed testing the slaves must have the pytest-cov package installed. This is needed since -the plugin must be registered through setuptools / distribute for pytest to start the plugin on the -slave. - -For subprocess measurement environment variables must make it from the main process to the -subprocess. The python used by the subprocess must have pytest-cov installed. The subprocess must -do normal site initialisation so that the environment variables can be detected and coverage -started. - - -Acknowledgements ----------------- - -Whilst this plugin has been built fresh from the ground up it has been influenced by the work done -on pytest-coverage (Ross Lawley, James Mills, Holger Krekel) and nose-cover (Jason Pellerin) which are -other coverage plugins. - -Ned Batchelder for coverage and its ability to combine the coverage results of parallel runs. - -Holger Krekel for pytest with its distributed testing support. - -Jason Pellerin for nose. - -Michael Foord for unittest2. - -No doubt others have contributed to these tools as well. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-cov-1.6/pytest_cov.egg-info/PKG-INFO new/pytest-cov-1.7.0/pytest_cov.egg-info/PKG-INFO --- old/pytest-cov-1.6/pytest_cov.egg-info/PKG-INFO 2012-05-12 02:03:20.000000000 +0200 +++ new/pytest-cov-1.7.0/pytest_cov.egg-info/PKG-INFO 2014-06-12 20:24:03.000000000 +0200 @@ -1,14 +1,30 @@ -Metadata-Version: 1.0 +Metadata-Version: 1.1 Name: pytest-cov -Version: 1.6 +Version: 1.7.0 Summary: py.test plugin for coverage reporting with support for both centralised and distributed testing, including subprocesses and multiprocessing -Home-page: http://bitbucket.org/memedough/pytest-cov/overview -Author: Meme Dough -Author-email: memedough@gmail.com +Home-page: https://github.com/schlamar/pytest-cov +Author: Marc Schlaich +Author-email: marc.schlaich@gmail.com License: MIT License Description: pytest-cov ========== + .. image:: https://travis-ci.org/schlamar/pytest-cov.svg?branch=master + :target: https://travis-ci.org/schlamar/pytest-cov + :alt: Build status + + .. image:: https://pypip.in/download/pytest-cov/badge.png + :target: https://pypi.python.org/pypi//pytest-cov/ + :alt: Downloads + + .. image:: https://pypip.in/version/pytest-cov/badge.png + :target: https://pypi.python.org/pypi/pytest-cov/ + :alt: Latest Version + + .. image:: https://pypip.in/license/pytest-cov/badge.png + :target: https://pypi.python.org/pypi/pytest-cov/ + :alt: License + This plugin produces coverage reports. It supports centralised testing and distributed testing in both load and each modes. It also supports coverage of subprocesses. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-cov-1.6/pytest_cov.egg-info/SOURCES.txt new/pytest-cov-1.7.0/pytest_cov.egg-info/SOURCES.txt --- old/pytest-cov-1.6/pytest_cov.egg-info/SOURCES.txt 2012-05-12 02:03:20.000000000 +0200 +++ new/pytest-cov-1.7.0/pytest_cov.egg-info/SOURCES.txt 2014-06-12 20:24:03.000000000 +0200 @@ -1,6 +1,6 @@ LICENSE.txt MANIFEST.in -README.txt +README.rst pytest_cov.py setup.py test_pytest_cov.py diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-cov-1.6/pytest_cov.egg-info/requires.txt new/pytest-cov-1.7.0/pytest_cov.egg-info/requires.txt --- old/pytest-cov-1.6/pytest_cov.egg-info/requires.txt 2012-05-12 02:03:20.000000000 +0200 +++ new/pytest-cov-1.7.0/pytest_cov.egg-info/requires.txt 2014-06-12 20:24:03.000000000 +0200 @@ -1,2 +1,2 @@ -pytest>=2.2.3 -cov-core>=1.6 \ No newline at end of file +pytest>=2.5.2 +cov-core>=1.12 \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-cov-1.6/pytest_cov.py new/pytest-cov-1.7.0/pytest_cov.py --- old/pytest-cov-1.6/pytest_cov.py 2011-07-25 11:12:24.000000000 +0200 +++ new/pytest-cov-1.7.0/pytest_cov.py 2014-04-26 17:27:42.000000000 +0200 @@ -1,26 +1,50 @@ """Coverage plugin for pytest.""" + +import pytest + +import cov_core + + def pytest_addoption(parser): """Add options to control coverage.""" - group = parser.getgroup('coverage reporting with distributed testing support') + group = parser.getgroup('coverage reporting with distributed testing ' + 'support') group.addoption('--cov', action='append', default=[], metavar='path', dest='cov_source', - help='measure coverage for filesystem path (multi-allowed)') - group.addoption('--cov-report', action='append', default=[], metavar='type', - choices=['term', 'term-missing', 'annotate', 'html', 'xml'], - dest='cov_report', - help='type of report to generate: term, term-missing, annotate, html, xml (multi-allowed)') - group.addoption('--cov-config', action='store', default='.coveragerc', metavar='path', - dest='cov_config', + help='measure coverage for filesystem path ' + '(multi-allowed)') + group.addoption('--cov-report', action='append', default=[], + metavar='type', dest='cov_report', + choices=['term', 'term-missing', 'annotate', 'html', + 'xml'], + help='type of report to generate: term, term-missing, ' + 'annotate, html, xml (multi-allowed)') + group.addoption('--cov-config', action='store', default='.coveragerc', + metavar='path', dest='cov_config', help='config file for coverage, default: .coveragerc') + group.addoption('--no-cov-on-fail', action='store_true', default=False, + dest='no_cov_on_fail', + help='do not report coverage if test run fails, ' + 'default: False') + + +@pytest.mark.try_last +def pytest_load_initial_conftests(early_config, parser, args): + ns = parser.parse_known_args(args) + if ns.cov_source: + plugin = CovPlugin(ns, early_config.pluginmanager) + early_config.pluginmanager.register(plugin, '_cov') def pytest_configure(config): """Activate coverage plugin if appropriate.""" - if config.getvalue('cov_source'): - config.pluginmanager.register(CovPlugin(), '_cov') + if not config.pluginmanager.hasplugin('_cov'): + plugin = CovPlugin(config.option, config.pluginmanager, + start=False) + config.pluginmanager.register(plugin, '_cov') class CovPlugin(object): @@ -31,7 +55,7 @@ distributed slave. """ - def __init__(self): + def __init__(self, options, pluginmanager, start=True): """Creates a coverage pytest plugin. We read the rc file that coverage uses to get the data file @@ -41,45 +65,49 @@ # Our implementation is unknown at this time. self.cov_controller = None + self.failed = False + self.options = options + + is_dist = (getattr(options, 'numprocesses', False) or + getattr(options, 'distload', False) or + getattr(options, 'dist', 'no') != 'no') + if is_dist and start: + self.start(cov_core.DistMaster) + elif start: + self.start(cov_core.Central) + + # slave is started in pytest hook + + def start(self, controller_cls, config=None, nodeid=None): + if config is None: + # fake config option for cov_core + class Config(object): + option = self.options + + config = Config() + + self.cov_controller = controller_cls( + self.options.cov_source, + self.options.cov_report or ['term'], + self.options.cov_config, + config, + nodeid + ) + self.cov_controller.start() def pytest_sessionstart(self, session): """At session start determine our implementation and delegate to it.""" - - import cov_core - - cov_source = session.config.getvalue('cov_source') - cov_report = session.config.getvalue('cov_report') or ['term'] - cov_config = session.config.getvalue('cov_config') - - session_name = session.__class__.__name__ - is_master = (session.config.pluginmanager.hasplugin('dsession') or - session_name == 'DSession') - is_slave = (hasattr(session.config, 'slaveinput') or - session_name == 'SlaveSession') - nodeid = None - - if is_master: - controller_cls = cov_core.DistMaster - elif is_slave: - controller_cls = cov_core.DistSlave - nodeid = session.config.slaveinput.get('slaveid', getattr(session, 'nodeid')) - else: - controller_cls = cov_core.Central - - self.cov_controller = controller_cls(cov_source, - cov_report, - cov_config, - session.config, - nodeid) - - self.cov_controller.start() + is_slave = hasattr(session.config, 'slaveinput') + if is_slave: + nodeid = session.config.slaveinput.get('slaveid', + getattr(session, 'nodeid')) + self.start(cov_core.DistSlave, session.config, nodeid) def pytest_configure_node(self, node): """Delegate to our implementation. Mark this hook as optional in case xdist is not installed. """ - self.cov_controller.configure_node(node) pytest_configure_node.optionalhook = True @@ -88,23 +116,24 @@ Mark this hook as optional in case xdist is not installed. """ - self.cov_controller.testnodedown(node, error) pytest_testnodedown.optionalhook = True def pytest_sessionfinish(self, session, exitstatus): """Delegate to our implementation.""" - + self.failed = exitstatus != 0 self.cov_controller.finish() def pytest_terminal_summary(self, terminalreporter): """Delegate to our implementation.""" - - self.cov_controller.summary(terminalreporter._tw) + if not (self.failed and self.options.no_cov_on_fail): + self.cov_controller.summary(terminalreporter._tw) def pytest_funcarg__cov(request): - """A pytest funcarg that provides access to the underlying coverage object.""" + """A pytest funcarg that provides access to the underlying coverage + object. + """ # Check with hasplugin to avoid getplugin exception in older pytest. if request.config.pluginmanager.hasplugin('_cov'): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-cov-1.6/setup.py new/pytest-cov-1.7.0/setup.py --- old/pytest-cov-1.6/setup.py 2012-05-12 01:28:20.000000000 +0200 +++ new/pytest-cov-1.7.0/setup.py 2014-06-12 20:21:48.000000000 +0200 @@ -1,15 +1,17 @@ import setuptools setuptools.setup(name='pytest-cov', - version='1.6', - description='py.test plugin for coverage reporting with support for both centralised and distributed testing, including subprocesses and multiprocessing', - long_description=open('README.txt').read().strip(), - author='Meme Dough', - author_email='memedough@gmail.com', - url='http://bitbucket.org/memedough/pytest-cov/overview', + version='1.7.0', + description='py.test plugin for coverage reporting with ' + 'support for both centralised and distributed testing, ' + 'including subprocesses and multiprocessing', + long_description=open('README.rst').read().strip(), + author='Marc Schlaich', + author_email='marc.schlaich@gmail.com', + url='https://github.com/schlamar/pytest-cov', py_modules=['pytest_cov'], - install_requires=['pytest>=2.2.3', - 'cov-core>=1.6'], + install_requires=['pytest>=2.5.2', + 'cov-core>=1.12'], entry_points={'pytest11': ['pytest_cov = pytest_cov']}, license='MIT License', zip_safe=False, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-cov-1.6/test_pytest_cov.py new/pytest-cov-1.7.0/test_pytest_cov.py --- old/pytest-cov-1.6/test_pytest_cov.py 2012-03-12 02:44:09.000000000 +0100 +++ new/pytest-cov-1.7.0/test_pytest_cov.py 2014-05-01 23:50:06.000000000 +0200 @@ -14,10 +14,14 @@ is fine with simple assignment statement. """ -import py import os import sys +import virtualenv + +import py + + pytest_plugins = 'pytester', 'cov' SCRIPT = ''' @@ -28,21 +32,9 @@ metafunc.addcall() def test_foo(): - version = sys.version_info[:2] - if version == (2, 4): - a = True - if version == (2, 5): - a = True - if version == (2, 6): - a = True - if version == (2, 7): - a = True - if version == (3, 0): - a = True - if version == (3, 1): - a = True - if version == (3, 2): - a = True + assert True + if sys.version_info[0] > 5: + assert False ''' SCRIPT_CHILD = ''' @@ -65,7 +57,14 @@ metafunc.addcall(funcargs=dict(idx=i)) def test_foo(idx): - out, err = subprocess.Popen([sys.executable, 'child_script.py', str(idx)], stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate() + out, err = subprocess.Popen( + [sys.executable, 'child_script.py', str(idx)], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE).communicate() + +# there is a issue in coverage.py with multiline statements at +# end of file: https://bitbucket.org/ned/coveragepy/issue/293 +pass ''' SCRIPT_FUNCARG = ''' @@ -94,6 +93,17 @@ ''' +SCRIPT_FAIL = ''' +def test_fail(): + assert False + +''' + +SCRIPT_RESULT = '8 * 88%' +CHILD_SCRIPT_RESULT = '6 * 100%' +PARENT_SCRIPT_RESULT = '8 * 100%' + + def test_central(testdir): script = testdir.makepyfile(SCRIPT) @@ -103,13 +113,26 @@ script) result.stdout.fnmatch_lines([ - '*- coverage: platform *, python * -*', - 'test_central * 20 * 70%*', - '*10 passed*' - ]) + '*- coverage: platform *, python * -*', + 'test_central * %s *' % SCRIPT_RESULT, + '*10 passed*' + ]) assert result.ret == 0 +def test_no_cov_on_fail(testdir): + script = testdir.makepyfile(SCRIPT_FAIL) + + result = testdir.runpytest('-v', + '--cov=%s' % script.dirpath(), + '--cov-report=term-missing', + '--no-cov-on-fail', + script) + + assert 'coverage: platform' not in result.stdout.str() + result.stdout.fnmatch_lines(['*1 failed*']) + + def test_dist_collocated(testdir): script = testdir.makepyfile(SCRIPT) @@ -121,10 +144,10 @@ script) result.stdout.fnmatch_lines([ - '*- coverage: platform *, python * -*', - 'test_dist_collocated * 20 * 70%*', - '*10 passed*' - ]) + '*- coverage: platform *, python * -*', + 'test_dist_collocated * %s *' % SCRIPT_RESULT, + '*10 passed*' + ]) assert result.ret == 0 @@ -143,15 +166,16 @@ script) result.stdout.fnmatch_lines([ - '*- coverage: platform *, python * -*', - 'test_dist_not_collocated * 20 * 70%*', - '*10 passed*' - ]) + '*- coverage: platform *, python * -*', + 'test_dist_not_collocated * %s *' % SCRIPT_RESULT, + '*10 passed*' + ]) assert result.ret == 0 def test_central_subprocess(testdir): - scripts = testdir.makepyfile(parent_script=SCRIPT_PARENT, child_script=SCRIPT_CHILD) + scripts = testdir.makepyfile(parent_script=SCRIPT_PARENT, + child_script=SCRIPT_CHILD) parent_script = scripts.dirpath().join('parent_script.py') result = testdir.runpytest('-v', @@ -160,15 +184,16 @@ parent_script) result.stdout.fnmatch_lines([ - '*- coverage: platform *, python * -*', - 'child_script * 6 * 100%*', - 'parent_script * 7 * 100%*', - ]) + '*- coverage: platform *, python * -*', + 'child_script * %s *' % CHILD_SCRIPT_RESULT, + 'parent_script * %s *' % PARENT_SCRIPT_RESULT, + ]) assert result.ret == 0 def test_dist_subprocess_collocated(testdir): - scripts = testdir.makepyfile(parent_script=SCRIPT_PARENT, child_script=SCRIPT_CHILD) + scripts = testdir.makepyfile(parent_script=SCRIPT_PARENT, + child_script=SCRIPT_CHILD) parent_script = scripts.dirpath().join('parent_script.py') result = testdir.runpytest('-v', @@ -179,15 +204,16 @@ parent_script) result.stdout.fnmatch_lines([ - '*- coverage: platform *, python * -*', - 'child_script * 6 * 100%*', - 'parent_script * 7 * 100%*', - ]) + '*- coverage: platform *, python * -*', + 'child_script * %s *' % CHILD_SCRIPT_RESULT, + 'parent_script * %s *' % PARENT_SCRIPT_RESULT, + ]) assert result.ret == 0 def test_dist_subprocess_not_collocated(testdir, tmpdir): - scripts = testdir.makepyfile(parent_script=SCRIPT_PARENT, child_script=SCRIPT_CHILD) + scripts = testdir.makepyfile(parent_script=SCRIPT_PARENT, + child_script=SCRIPT_CHILD) parent_script = scripts.dirpath().join('parent_script.py') child_script = scripts.dirpath().join('child_script.py') @@ -205,10 +231,10 @@ parent_script) result.stdout.fnmatch_lines([ - '*- coverage: platform *, python * -*', - 'child_script * 6 * 100%*', - 'parent_script * 7 * 100%*', - ]) + '*- coverage: platform *, python * -*', + 'child_script * %s *' % CHILD_SCRIPT_RESULT, + 'parent_script * %s *' % PARENT_SCRIPT_RESULT, + ]) assert result.ret == 0 @@ -221,31 +247,21 @@ script) result.stdout.fnmatch_lines([ - '*- coverage: platform *, python * -*', - '*10 passed*' - ]) + '*- coverage: platform *, python * -*', + '*10 passed*' + ]) assert result.ret == 0 matching_lines = [line for line in result.outlines if '%' in line] assert not matching_lines def test_dist_missing_data(testdir): - version = sys.version_info[:2] - if version == (2, 4): - exe = '/usr/local/py24/bin/python' - if version == (2, 5): - exe = '/usr/local/py25/bin/python' - if version == (2, 6): - exe = '/usr/local/py26/bin/python' - if version == (2, 7): - exe = '/usr/local/py27/bin/python' - if version == (3, 0): - exe = '/usr/local/py30/bin/python3.0' - if version == (3, 1): - exe = '/usr/local/py31/bin/python3.1' - if version == (3, 2): - exe = '/usr/local/py32/bin/python3.2' - + venv_path = os.path.join(str(testdir.tmpdir), 'venv') + virtualenv.create_environment(venv_path) + if sys.platform == 'win32': + exe = os.path.join(venv_path, 'Scripts', 'python.exe') + else: + exe = os.path.join(venv_path, 'bin', 'python') script = testdir.makepyfile(SCRIPT) result = testdir.runpytest('-v', @@ -256,8 +272,8 @@ script) result.stdout.fnmatch_lines([ - '*- coverage: failed slaves -*' - ]) + '*- coverage: failed slaves -*' + ]) assert result.ret == 0 @@ -270,10 +286,10 @@ script) result.stdout.fnmatch_lines([ - '*- coverage: platform *, python * -*', - 'test_funcarg * 3 * 100%*', - '*1 passed*' - ]) + '*- coverage: platform *, python * -*', + 'test_funcarg * 3 * 100%*', + '*1 passed*' + ]) assert result.ret == 0 @@ -284,8 +300,8 @@ script) result.stdout.fnmatch_lines([ - '*1 passed*' - ]) + '*1 passed*' + ]) assert result.ret == 0 @@ -300,8 +316,123 @@ script) result.stdout.fnmatch_lines([ - '*- coverage: platform *, python * -*', - 'test_multiprocessing_subprocess * 8 * 100%*', - '*1 passed*' - ]) + '*- coverage: platform *, python * -*', + 'test_multiprocessing_subprocess * 8 * 100%*', + '*1 passed*' + ]) + assert result.ret == 0 + + +MODULE = ''' +def func(): + return 1 + +''' + +CONFTEST = ''' + +import mod +mod.func() + +''' + +BASIC_TEST = ''' + +def test_basic(): + assert True + +''' + +CONF_RESULT = 'mod * 2 * 100% *' + + +def test_cover_conftest(testdir): + testdir.makepyfile(mod=MODULE) + testdir.makeconftest(CONFTEST) + script = testdir.makepyfile(BASIC_TEST) + result = testdir.runpytest('-v', + '--cov=%s' % script.dirpath(), + '--cov-report=term-missing', + script) + assert result.ret == 0 + result.stdout.fnmatch_lines([CONF_RESULT]) + + +def test_cover_conftest_dist(testdir): + testdir.makepyfile(mod=MODULE) + testdir.makeconftest(CONFTEST) + script = testdir.makepyfile(BASIC_TEST) + result = testdir.runpytest('-v', + '--cov=%s' % script.dirpath(), + '--cov-report=term-missing', + '--dist=load', + '--tx=2*popen', + script) + assert result.ret == 0 + result.stdout.fnmatch_lines([CONF_RESULT]) + + +COVERAGERC = ''' +[report] +# Regexes for lines to exclude from consideration +exclude_lines = + raise NotImplementedError + +''' + +EXCLUDED_TEST = ''' + +def func(): + raise NotImplementedError + +def test_basic(): + assert True + +''' + +EXCLUDED_RESULT = '3 * 100% *' + + +def test_coveragerc(testdir): + testdir.makefile('', coveragerc=COVERAGERC) + script = testdir.makepyfile(EXCLUDED_TEST) + result = testdir.runpytest('-v', + '--cov-config=coveragerc', + '--cov=%s' % script.dirpath(), + '--cov-report=term-missing', + script) + assert result.ret == 0 + result.stdout.fnmatch_lines(['test_coveragerc * %s' % EXCLUDED_RESULT]) + + +def test_coveragerc_dist(testdir): + testdir.makefile('', coveragerc=COVERAGERC) + script = testdir.makepyfile(EXCLUDED_TEST) + result = testdir.runpytest('-v', + '--cov-config=coveragerc', + '--cov=%s' % script.dirpath(), + '--cov-report=term-missing', + '-n', '2', + script) + assert result.ret == 0 + result.stdout.fnmatch_lines( + ['test_coveragerc_dist * %s' % EXCLUDED_RESULT]) + + +CLEAR_ENVIRON_TEST = ''' + +import os + +def test_basic(): + os.environ.clear() + +''' + + +def test_clear_environ(testdir): + script = testdir.makepyfile(CLEAR_ENVIRON_TEST) + result = testdir.runpytest('-v', + '--cov=%s' % script.dirpath(), + '--cov-report=term-missing', + script) assert result.ret == 0 -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org
participants (1)
-
root@hilbert.suse.de