Blame update-tests-to-work-with-newer-pytest-versions.patch

4e7f3d
From 20b4b1c0d1564ab4ef44b7d27d5b650735e28be3 Mon Sep 17 00:00:00 2001
4e7f3d
From: Armin Ronacher <armin.ronacher@active-4.com>
4e7f3d
Date: Sat, 23 Dec 2017 09:27:57 +0100
4e7f3d
Subject: [PATCH] Updated tests to work with newer pytest versions
4e7f3d
4e7f3d
---
4e7f3d
 tests/test_basic.py   | 2 +-
4e7f3d
 tests/test_compat.py  | 9 +++++----
4e7f3d
 tests/test_options.py | 2 +-
4e7f3d
 3 files changed, 7 insertions(+), 6 deletions(-)
4e7f3d
4e7f3d
diff --git a/tests/test_basic.py b/tests/test_basic.py
4e7f3d
index 045f6085..960cd327 100644
4e7f3d
--- a/tests/test_basic.py
4e7f3d
+++ b/tests/test_basic.py
4e7f3d
@@ -357,7 +357,7 @@ def cli(foo):
4e7f3d
 def test_evaluation_order(runner):
4e7f3d
     called = []
4e7f3d
 
4e7f3d
-    def memo(ctx, value):
4e7f3d
+    def memo(ctx, param, value):
4e7f3d
         called.append(value)
4e7f3d
         return value
4e7f3d
 
4e7f3d
diff --git a/tests/test_compat.py b/tests/test_compat.py
4e7f3d
index e4ecdc81..9dacc21d 100644
4e7f3d
--- a/tests/test_compat.py
4e7f3d
+++ b/tests/test_compat.py
4e7f3d
@@ -1,4 +1,5 @@
4e7f3d
 import click
4e7f3d
+import pytest
4e7f3d
 
4e7f3d
 
4e7f3d
 if click.__version__ >= '3.0':
4e7f3d
@@ -11,10 +12,10 @@ def legacy_callback(ctx, value):
4e7f3d
         def cli(foo):
4e7f3d
             click.echo(foo)
4e7f3d
 
4e7f3d
-        result = runner.invoke(cli, ['--foo', 'wat'])
4e7f3d
-        assert result.exit_code == 0
4e7f3d
-        assert 'WAT' in result.output
4e7f3d
-        assert 'Invoked legacy parameter callback' in result.output
4e7f3d
+        with pytest.warns(Warning, match='Invoked legacy parameter callback'):
4e7f3d
+            result = runner.invoke(cli, ['--foo', 'wat'])
4e7f3d
+            assert result.exit_code == 0
4e7f3d
+            assert 'WAT' in result.output
4e7f3d
 
4e7f3d
 
4e7f3d
 def test_bash_func_name():
4e7f3d
diff --git a/tests/test_options.py b/tests/test_options.py
4e7f3d
index 9dd8cdff..8bdda1f1 100644
4e7f3d
--- a/tests/test_options.py
4e7f3d
+++ b/tests/test_options.py
4e7f3d
@@ -199,7 +199,7 @@ def cmd(arg):
4e7f3d
 
4e7f3d
 
4e7f3d
 def test_custom_validation(runner):
4e7f3d
-    def validate_pos_int(ctx, value):
4e7f3d
+    def validate_pos_int(ctx, param, value):
4e7f3d
         if value < 0:
4e7f3d
             raise click.BadParameter('Value needs to be positive')
4e7f3d
         return value