commit:     b267275c6ee8b262b695f4a07a555b815869767a
Author:     Virgil Dupras <vdupras <AT> gentoo <DOT> org>
AuthorDate: Mon Aug 13 11:59:14 2018 +0000
Commit:     Virgil Dupras <vdupras <AT> gentoo <DOT> org>
CommitDate: Mon Aug 13 12:01:23 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b267275c

dev-python/click: fix broken tests

Closes: https://bugs.gentoo.org/635806
Package-Manager: Portage-2.3.46, Repoman-2.3.10

 dev-python/click/click-6.7.ebuild                |  5 ++
 dev-python/click/files/click-6.7-fix-tests.patch | 65 ++++++++++++++++++++++++
 2 files changed, 70 insertions(+)

diff --git a/dev-python/click/click-6.7.ebuild 
b/dev-python/click/click-6.7.ebuild
index a594f6dc817..74c2f3587ec 100644
--- a/dev-python/click/click-6.7.ebuild
+++ b/dev-python/click/click-6.7.ebuild
@@ -23,6 +23,11 @@ DEPEND="
        test? ( dev-python/pytest[${PYTHON_USEDEP}] )
        doc? ( dev-python/sphinx[${PYTHON_USEDEP}] )"
 
+PATCHES=(
+       # From upstream, can be removed in next release.
+       "${FILESDIR}/${PN}-6.7-fix-tests.patch"
+)
+
 pkg_setup() {
        use doc && DISTUTILS_ALL_SUBPHASE_IMPLS=( 'python2*' )
 }

diff --git a/dev-python/click/files/click-6.7-fix-tests.patch 
b/dev-python/click/files/click-6.7-fix-tests.patch
new file mode 100644
index 00000000000..8a305e3665d
--- /dev/null
+++ b/dev-python/click/files/click-6.7-fix-tests.patch
@@ -0,0 +1,65 @@
+From 20b4b1c0d1564ab4ef44b7d27d5b650735e28be3 Mon Sep 17 00:00:00 2001
+From: Armin Ronacher <armin.ronac...@active-4.com>
+Date: Sat, 23 Dec 2017 09:27:57 +0100
+Subject: [PATCH] Updated tests to work with newer pytest versions
+
+---
+ tests/test_basic.py   | 2 +-
+ tests/test_compat.py  | 9 +++++----
+ tests/test_options.py | 2 +-
+ 3 files changed, 7 insertions(+), 6 deletions(-)
+
+diff --git a/tests/test_basic.py b/tests/test_basic.py
+index 045f608..960cd32 100644
+--- a/tests/test_basic.py
++++ b/tests/test_basic.py
+@@ -357,7 +357,7 @@ def test_required_option(runner):
+ def test_evaluation_order(runner):
+     called = []
+ 
+-    def memo(ctx, value):
++    def memo(ctx, param, value):
+         called.append(value)
+         return value
+ 
+diff --git a/tests/test_compat.py b/tests/test_compat.py
+index e4ecdc8..9dacc21 100644
+--- a/tests/test_compat.py
++++ b/tests/test_compat.py
+@@ -1,4 +1,5 @@
+ import click
++import pytest
+ 
+ 
+ if click.__version__ >= '3.0':
+@@ -11,10 +12,10 @@ if click.__version__ >= '3.0':
+         def cli(foo):
+             click.echo(foo)
+ 
+-        result = runner.invoke(cli, ['--foo', 'wat'])
+-        assert result.exit_code == 0
+-        assert 'WAT' in result.output
+-        assert 'Invoked legacy parameter callback' in result.output
++        with pytest.warns(Warning, match='Invoked legacy parameter callback'):
++            result = runner.invoke(cli, ['--foo', 'wat'])
++            assert result.exit_code == 0
++            assert 'WAT' in result.output
+ 
+ 
+ def test_bash_func_name():
+diff --git a/tests/test_options.py b/tests/test_options.py
+index 9dd8cdf..8bdda1f 100644
+--- a/tests/test_options.py
++++ b/tests/test_options.py
+@@ -199,7 +199,7 @@ def test_nargs_envvar(runner):
+ 
+ 
+ def test_custom_validation(runner):
+-    def validate_pos_int(ctx, value):
++    def validate_pos_int(ctx, param, value):
+         if value < 0:
+             raise click.BadParameter('Value needs to be positive')
+         return value
+-- 
+2.16.4
+

Reply via email to