Merge and update

i9ce
MSVSphere Packaging Team 1 year ago
commit 09e682d16d

@ -1,24 +0,0 @@
From 4fa671b4afdde8e103a03b39dcdc66e1a10a16fa Mon Sep 17 00:00:00 2001
From: Adam Dangoor <adamdangoor@gmail.com>
Date: Mon, 31 Jul 2017 17:58:41 +0100
Subject: [PATCH 1/3] Remove outdated comment about Click 3.0
---
click/core.py | 1 -
1 file changed, 1 deletion(-)
diff --git a/click/core.py b/click/core.py
index 7456451..18fa9a5 100644
--- a/click/core.py
+++ b/click/core.py
@@ -68,7 +68,6 @@ def invoke_param_callback(callback, ctx, param, value):
args = getattr(code, 'co_argcount', 3)
if args < 3:
- # This will become a warning in Click 3.0:
from warnings import warn
warn(Warning('Invoked legacy parameter callback "%s". The new '
'signature for such callbacks starting with '
--
2.14.2

@ -1,21 +0,0 @@
From 6e7951c511b8316a73d9a8d9c4cc130becd99e93 Mon Sep 17 00:00:00 2001
From: Adam Dangoor <adamdangoor@gmail.com>
Date: Mon, 31 Jul 2017 18:06:20 +0100
Subject: [PATCH 2/3] Add pytest option to not capture warnings
---
pytest.ini | 2 ++
1 file changed, 2 insertions(+)
create mode 100644 pytest.ini
diff --git a/pytest.ini b/pytest.ini
new file mode 100644
index 0000000..1ceab94
--- /dev/null
+++ b/pytest.ini
@@ -0,0 +1,2 @@
+[pytest]
+addopts = -p no:warnings
--
2.14.2

@ -1,54 +0,0 @@
From e6fb0fe8bc75e7931fe86e95442eec09b49caee7 Mon Sep 17 00:00:00 2001
From: Adam Dangoor <adamdangoor@gmail.com>
Date: Mon, 31 Jul 2017 19:45:24 +0100
Subject: [PATCH 3/3] Catch and test pytest warning
---
pytest.ini | 2 --
tests/test_compat.py | 15 +++++++++++++--
2 files changed, 13 insertions(+), 4 deletions(-)
delete mode 100644 pytest.ini
diff --git a/pytest.ini b/pytest.ini
deleted file mode 100644
index 1ceab94..0000000
--- a/pytest.ini
+++ /dev/null
@@ -1,2 +0,0 @@
-[pytest]
-addopts = -p no:warnings
diff --git a/tests/test_compat.py b/tests/test_compat.py
index e4ecdc8..d86110a 100644
--- a/tests/test_compat.py
+++ b/tests/test_compat.py
@@ -1,3 +1,5 @@
+import pytest
+
import click
@@ -11,10 +13,19 @@ if click.__version__ >= '3.0':
def cli(foo):
click.echo(foo)
- result = runner.invoke(cli, ['--foo', 'wat'])
+ with pytest.warns(Warning) as records:
+ result = runner.invoke(cli, ['--foo', 'wat'])
+
+ [warning_record] = records
+ warning_message = str(warning_record.message)
+ assert 'Invoked legacy parameter callback' in warning_message
assert result.exit_code == 0
+ # Depending on the pytest version, the warning message may be
+ # in `result.output`.
+ #
+ # In pytest version 3.1 pytest started capturing warnings by default.
+ # See https://docs.pytest.org/en/latest/warnings.html#warnings-capture.
assert 'WAT' in result.output
- assert 'Invoked legacy parameter callback' in result.output
def test_bash_func_name():
--
2.14.2
Loading…
Cancel
Save