66 lines
1.9 KiB
Diff
66 lines
1.9 KiB
Diff
From 20b4b1c0d1564ab4ef44b7d27d5b650735e28be3 Mon Sep 17 00:00:00 2001
|
|
From: Armin Ronacher <armin.ronacher@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
|
|
|