Hello community, here is the log from the commit of package python-pytest-sugar for openSUSE:Factory checked in at 2019-02-24 17:04:37 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-pytest-sugar (Old) and /work/SRC/openSUSE:Factory/.python-pytest-sugar.new.28833 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pytest-sugar" Sun Feb 24 17:04:37 2019 rev:4 rq:674169 version:0.9.2 Changes: -------- --- /work/SRC/openSUSE:Factory/python-pytest-sugar/python-pytest-sugar.changes 2018-02-19 13:03:31.212554298 +0100 +++ /work/SRC/openSUSE:Factory/.python-pytest-sugar.new.28833/python-pytest-sugar.changes 2019-02-24 17:04:38.552644872 +0100 @@ -1,0 +2,11 @@ +Tue Feb 12 15:52:25 UTC 2019 - Tomáš Chvátal <tchva...@suse.com> + +- Update to 0.9.2: + * Fix incompatibility with pytest 3.10 (thanks @Natim) + * Double colons for verbose output (thanks @albertodonato) + * Fix "Wrong count with items modified in pytest_collection_modifyitems" (thanks @blueyed) + * Defer registration of xdist hook (thanks @blueyed) +- Add patch from upstream to fix build with pytest 4.2+: + * pytest4.patch + +------------------------------------------------------------------- Old: ---- pytest-sugar-0.9.1.tar.gz New: ---- pytest-sugar-0.9.2.tar.gz pytest4.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-pytest-sugar.spec ++++++ --- /var/tmp/diff_new_pack.jwAfBr/_old 2019-02-24 17:04:38.964644676 +0100 +++ /var/tmp/diff_new_pack.jwAfBr/_new 2019-02-24 17:04:38.968644674 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-pytest-sugar # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -12,26 +12,28 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-pytest-sugar -Version: 0.9.1 +Version: 0.9.2 Release: 0 Summary: Pretty printer for pytest progress License: BSD-3-Clause Group: Development/Languages/Python -Url: http://pivotfinland.com/pytest-sugar/ +URL: http://pivotfinland.com/pytest-sugar/ Source: https://files.pythonhosted.org/packages/source/p/pytest-sugar/pytest-sugar-%{version}.tar.gz +Patch0: pytest4.patch +BuildRequires: %{python_module pytest} BuildRequires: %{python_module setuptools} +BuildRequires: %{python_module termcolor} BuildRequires: fdupes BuildRequires: python-rpm-macros Requires: python-pytest Requires: python-termcolor BuildArch: noarch - %python_subpackages %description @@ -39,6 +41,7 @@ %prep %setup -q -n pytest-sugar-%{version} +%patch0 -p1 %build %python_build @@ -47,9 +50,12 @@ %python_install %python_expand %fdupes %{buildroot}%{$python_sitelib} +%check +%python_expand PYTHONPATH=%{buildroot}%{$python_sitelib} py.test-%{$python_bin_suffix} + %files %{python_files} -%defattr(-,root,root,-) -%doc LICENSE README.md +%license LICENSE +%doc README.md %{python_sitelib}/* %changelog ++++++ pytest-sugar-0.9.1.tar.gz -> pytest-sugar-0.9.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-sugar-0.9.1/CHANGES.rst new/pytest-sugar-0.9.2/CHANGES.rst --- old/pytest-sugar-0.9.1/CHANGES.rst 2018-02-06 14:31:18.000000000 +0100 +++ new/pytest-sugar-0.9.2/CHANGES.rst 2018-11-08 21:52:48.000000000 +0100 @@ -3,6 +3,14 @@ A list of changes between each release. +0.9.2 (2018-11-8) +^^^^^^^^^^^^^^^^^^^ + +- Fix incompatibility with pytest 3.10 (thanks @Natim) +- Double colons for verbose output (thanks @albertodonato) +- Fix "Wrong count with items modified in pytest_collection_modifyitems" (thanks @blueyed) +- Defer registration of xdist hook (thanks @blueyed) + 0.9.1 (2017-8-4) ^^^^^^^^^^^^^^^^^^^ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-sugar-0.9.1/PKG-INFO new/pytest-sugar-0.9.2/PKG-INFO --- old/pytest-sugar-0.9.1/PKG-INFO 2018-02-06 14:32:15.000000000 +0100 +++ new/pytest-sugar-0.9.2/PKG-INFO 2018-11-08 22:06:11.000000000 +0100 @@ -1,12 +1,11 @@ -Metadata-Version: 1.1 +Metadata-Version: 2.1 Name: pytest-sugar -Version: 0.9.1 -Summary: py.test is a plugin for py.test that changes the default look and feel of py.test (e.g. progressbar, show tests that fail instantly). +Version: 0.9.2 +Summary: pytest-sugar is a plugin for pytest that changes the default look and feel of pytest (e.g. progressbar, show tests that fail instantly). Home-page: http://pivotfinland.com/pytest-sugar/ Author: Teemu, Janne Vanhala and others Author-email: orkkiole...@gmail.com, janne.vanh...@gmail.com License: BSD -Description-Content-Type: UNKNOWN Description: # pytest-sugar [![](https://travis-ci.org/Frozenball/pytest-sugar.svg?branch=master)](https://travis-ci.org/Frozenball/pytest-sugar) ![](https://img.shields.io/pypi/v/pytest-sugar.svg) @@ -63,4 +62,6 @@ Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: Implementation :: PyPy +Description-Content-Type: text/markdown diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-sugar-0.9.1/pytest_sugar.egg-info/PKG-INFO new/pytest-sugar-0.9.2/pytest_sugar.egg-info/PKG-INFO --- old/pytest-sugar-0.9.1/pytest_sugar.egg-info/PKG-INFO 2018-02-06 14:32:15.000000000 +0100 +++ new/pytest-sugar-0.9.2/pytest_sugar.egg-info/PKG-INFO 2018-11-08 22:06:11.000000000 +0100 @@ -1,12 +1,11 @@ -Metadata-Version: 1.1 +Metadata-Version: 2.1 Name: pytest-sugar -Version: 0.9.1 -Summary: py.test is a plugin for py.test that changes the default look and feel of py.test (e.g. progressbar, show tests that fail instantly). +Version: 0.9.2 +Summary: pytest-sugar is a plugin for pytest that changes the default look and feel of pytest (e.g. progressbar, show tests that fail instantly). Home-page: http://pivotfinland.com/pytest-sugar/ Author: Teemu, Janne Vanhala and others Author-email: orkkiole...@gmail.com, janne.vanh...@gmail.com License: BSD -Description-Content-Type: UNKNOWN Description: # pytest-sugar [![](https://travis-ci.org/Frozenball/pytest-sugar.svg?branch=master)](https://travis-ci.org/Frozenball/pytest-sugar) ![](https://img.shields.io/pypi/v/pytest-sugar.svg) @@ -63,4 +62,6 @@ Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: Implementation :: PyPy +Description-Content-Type: text/markdown diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-sugar-0.9.1/pytest_sugar.egg-info/requires.txt new/pytest-sugar-0.9.2/pytest_sugar.egg-info/requires.txt --- old/pytest-sugar-0.9.1/pytest_sugar.egg-info/requires.txt 2018-02-06 14:32:15.000000000 +0100 +++ new/pytest-sugar-0.9.2/pytest_sugar.egg-info/requires.txt 2018-11-08 22:06:11.000000000 +0100 @@ -1,2 +1,3 @@ pytest>=2.9 termcolor>=1.1.0 +packaging>=14.1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-sugar-0.9.1/pytest_sugar.py new/pytest-sugar-0.9.2/pytest_sugar.py --- old/pytest-sugar-0.9.1/pytest_sugar.py 2018-02-06 14:31:18.000000000 +0100 +++ new/pytest-sugar-0.9.2/pytest_sugar.py 2018-11-08 21:56:59.000000000 +0100 @@ -14,6 +14,7 @@ import os import re import sys +from packaging.version import parse try: from configparser import ConfigParser @@ -27,7 +28,7 @@ from _pytest.terminal import TerminalReporter -__version__ = '0.9.1' +__version__ = '0.9.2' LEN_RIGHT_MARGIN = 0 LEN_PROGRESS_PERCENTAGE = 5 @@ -72,26 +73,19 @@ yield x -def pytest_collection_modifyitems(session, config, items): - terminal_reporter = config.pluginmanager.getplugin('terminalreporter') - if terminal_reporter: - terminal_reporter.tests_count = len(items) +def pytest_runtestloop(session): + reporter = session.config.pluginmanager.getplugin('terminalreporter') + if reporter: + reporter.tests_count = len(session.items) -try: - import xdist -except ImportError: - pass -else: - from distutils.version import LooseVersion - xdist_version = LooseVersion(xdist.__version__) - if xdist_version >= LooseVersion("1.14"): - def pytest_xdist_node_collection_finished(node, ids): - terminal_reporter = node.config.pluginmanager.getplugin( - 'terminalreporter' - ) - if terminal_reporter: - terminal_reporter.tests_count = len(ids) +class DeferredXdistPlugin(object): + def pytest_xdist_node_collection_finished(self, node, ids): + terminal_reporter = node.config.pluginmanager.getplugin( + 'terminalreporter' + ) + if terminal_reporter: + terminal_reporter.tests_count = len(ids) def pytest_deselected(items): @@ -165,6 +159,17 @@ if sys.stdout.isatty() or config.getvalue('force_sugar'): IS_SUGAR_ENABLED = True + if config.pluginmanager.hasplugin('xdist'): + try: + import xdist + except ImportError: + pass + else: + from distutils.version import LooseVersion + xdist_version = LooseVersion(xdist.__version__) + if xdist_version >= LooseVersion('1.14'): + config.pluginmanager.register(DeferredXdistPlugin()) + if IS_SUGAR_ENABLED and not getattr(config, 'slaveinput', None): # Get the standard terminal reporter plugin and replace it with our standard_reporter = config.pluginmanager.getplugin('terminalreporter') @@ -361,13 +366,19 @@ else: fspath = report.fspath basename = os.path.basename(fspath) - if self.showlongtestinfo: - test_location = report.location[0] - test_name = report.location[2] - else: - test_location = fspath[0:-len(basename)] - test_name = fspath[-len(basename):] if print_filename: + if self.showlongtestinfo: + test_location = report.location[0] + test_name = report.location[2] + else: + test_location = fspath[0:-len(basename)] + test_name = fspath[-len(basename):] + if test_location: + pass + # only replace if test_location is not empty, if it is, + # test_name contains the filename + # FIXME: This doesn't work. + # test_name = test_name.replace('.', '::') self.current_lines[path] = ( " " + colored(test_location, THEME['path']) + @@ -390,12 +401,10 @@ # show the module_name & in verbose mode the test name. pass - if pytest.__version__ >= '3.4': - - def pytest_runtest_logfinish(self): - # prevent the default implementation to try to show - # pytest's default progress - pass + def pytest_runtest_logfinish(self): + # prevent the default implementation to try to show + # pytest's default progress + pass def report_key(self, report): """Returns a key to identify which line the report should write to.""" @@ -588,12 +597,12 @@ def summary_failures(self): # Prevent failure summary from being shown since we already - # show the failure instantly after failure has occured. + # show the failure instantly after failure has occurred. pass def summary_errors(self): # Prevent error summary from being shown since we already - # show the error instantly after error has occured. + # show the error instantly after error has occurred. pass def print_failure(self, report): @@ -617,3 +626,8 @@ self.write_sep("―", msg) self._outrep_summary(report) self.reset_tracked_lines() + + +# On older version of Pytest, allow default progress +if parse(pytest.__version__) <= parse('3.4'): # pragma: no cover + del SugarTerminalReporter.pytest_runtest_logfinish diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-sugar-0.9.1/setup.py new/pytest-sugar-0.9.2/setup.py --- old/pytest-sugar-0.9.1/setup.py 2017-08-14 18:17:44.000000000 +0200 +++ new/pytest-sugar-0.9.2/setup.py 2018-11-08 21:49:48.000000000 +0100 @@ -22,11 +22,12 @@ setup( name='pytest-sugar', description=( - 'py.test is a plugin for py.test that changes the default look' - ' and feel of py.test (e.g. progressbar, show tests that fail' - ' instantly).' + 'pytest-sugar is a plugin for pytest that changes the default' + ' look and feel of pytest (e.g. progressbar, show tests that' + ' fail instantly).' ), long_description=codecs.open("README.md", encoding='utf-8').read(), + long_description_content_type='text/markdown', version=get_version('pytest_sugar.py'), url='http://pivotfinland.com/pytest-sugar/', license='BSD', @@ -37,7 +38,7 @@ zip_safe=False, include_package_data=True, platforms='any', - install_requires=['pytest>=2.9', 'termcolor>=1.1.0'], + install_requires=['pytest>=2.9', 'termcolor>=1.1.0', 'packaging>=14.1'], classifiers=[ 'Development Status :: 3 - Alpha', 'Intended Audience :: Developers', @@ -54,6 +55,7 @@ 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: Implementation :: PyPy', ] ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-sugar-0.9.1/test_sugar.py new/pytest-sugar-0.9.2/test_sugar.py --- old/pytest-sugar-0.9.1/test_sugar.py 2017-08-15 09:37:17.000000000 +0200 +++ new/pytest-sugar-0.9.2/test_sugar.py 2018-11-08 22:04:26.000000000 +0100 @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- import pytest import re +from distutils.version import LooseVersion from pytest_sugar import strip_colors pytest_plugins = "pytester" @@ -10,7 +11,7 @@ output = strip_colors(stdout) def _get(x): - m = re.search('\d %s' % x, output) + m = re.search(r'\d %s' % x, output) if m: return m.group()[0] else: @@ -248,6 +249,33 @@ ) assert_count(testdir) + def test_item_count_after_pytest_collection_modifyitems(self, testdir): + testdir.makeconftest( + """ + import pytest + + @pytest.hookimpl(hookwrapper=True, tryfirst=True) + def pytest_collection_modifyitems(config, items): + yield + items[:] = [x for x in items if x.name == 'test_one'] + """ + ) + testdir.makepyfile( + """ + def test_one(): + print('test_one_passed') + + def test_ignored(): + assert 0 + """ + ) + result = testdir.runpytest('-p no:sugar', '-s') + result.stdout.fnmatch_lines([ + '*test_one_passed*', + '*100%*', + ]) + assert result.ret == 0 + def test_fail(self, testdir): testdir.makepyfile( """ @@ -434,8 +462,6 @@ def test_verbose_has_double_colon(self, testdir): testdir.makepyfile( """ - import pytest - def test_true(): assert True """ @@ -447,6 +473,39 @@ output ) + # def test_verbose_has_double_colon_with_class(self, testdir): + # testdir.makepyfile( + # """ + # class TestTrue: + + # def test_true(self): + # assert True + # """ + # ) + # output = testdir.runpytest( + # '--force-sugar', '--verbose' + # ).stdout.str() + + # test_name = ( + # 'test_verbose_has_double_colon_with_class.py::TestTrue::test_true') + # assert test_name in strip_colors(output) + + # def test_not_verbose_no_double_colon_filename(self, testdir): + # testdir.makepyfile( + # """ + # class TestTrue: + + # def test_true(self): + # assert True + # """ + # ) + # output = testdir.runpytest( + # '--force-sugar' + # ).stdout.str() + + # test_name = 'test_not_verbose_no_double_colon_filename.py' + # assert test_name in strip_colors(output) + def test_xdist(self, testdir): pytest.importorskip("xdist") testdir.makepyfile( @@ -492,6 +551,10 @@ assert result.ret == 1, result.stderr.str() + @pytest.mark.skipif( + LooseVersion(pytest.__version__) >= LooseVersion('3.5'), + reason='Temporarily skipping until #134' + ) def test_doctest_lineno(self, testdir): """ Test location reported for doctest-modules """ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-sugar-0.9.1/tox.ini new/pytest-sugar-0.9.2/tox.ini --- old/pytest-sugar-0.9.1/tox.ini 2018-02-06 14:31:18.000000000 +0100 +++ new/pytest-sugar-0.9.2/tox.ini 2018-11-08 21:49:48.000000000 +0100 @@ -8,6 +8,7 @@ py{27,35}-pytest30-unsupported-xdist, py{27,34,py}-pytest31-supported-xdist py{27,34,py}-pytest34-supported-xdist + qa [testenv] passenv = CI TRAVIS_BUILD_ID TRAVIS TRAVIS_BRANCH TRAVIS_JOB_NUMBER TRAVIS_PULL_REQUEST TRAVIS_JOB_ID TRAVIS_REPO_SLUG TRAVIS_COMMIT @@ -17,12 +18,19 @@ pytest30: pytest>=3.0,<3.1 pytest31: pytest>=3.1,<3.2 pytest34: pytest>=3.4,<3.5 + pytest37: pytest>=3.7,<3.8 + pytest39: pytest>=3.9,<3.10 + pytest310: pytest>=3.10,<3.11 termcolor>=1.1.0 supported-xdist: pytest-xdist>=1.14 unsupported-xdist: pytest-xdist<1.14 - pytest-rerunfailures - flake8 + rerunfailures: pytest-rerunfailures commands = - py.test --cov=./ {posargs:test_sugar.py} - flake8 --exclude faketests,.tox + py.test --cov --cov-config=.coveragerc {posargs:test_sugar.py} codecov -e TOXENV + +[testenv:qa] +deps = + flake8 +commands = + flake8 {posargs:conftest.py pytest_sugar.py setup.py test_sugar.py} ++++++ pytest4.patch ++++++ >From 681461f488260eb8c4c9db4530b9572af058477e Mon Sep 17 00:00:00 2001 From: Daniel Hahler <g...@thequod.de> Date: Mon, 11 Feb 2019 22:08:41 +0100 Subject: [PATCH] Fix print_failure for pytest 4.2 Fixes https://github.com/Frozenball/pytest-sugar/issues/170. --- pytest_sugar.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pytest_sugar.py b/pytest_sugar.py index 6dbe70f..c479dab 100644 --- a/pytest_sugar.py +++ b/pytest_sugar.py @@ -616,11 +616,13 @@ def print_failure(self, report): self.write_line(line) else: msg = self._getfailureheadline(report) - if not hasattr(report, 'when'): + # "when" was unset before pytest 4.2 for collection errors. + when = getattr(report, "when", "collect") + if when == "collect": msg = "ERROR collecting " + msg - elif report.when == "setup": + elif when == "setup": msg = "ERROR at setup of " + msg - elif report.when == "teardown": + elif when == "teardown": msg = "ERROR at teardown of " + msg self.write_line('') self.write_sep("―", msg)