14
0
Files
python-CherryPy/pytest5.patch

64 lines
2.5 KiB
Diff
Raw Normal View History

From 96b34dfea7853b0189bc0a3878b6ddff0d4e505c Mon Sep 17 00:00:00 2001
From: Sviatoslav Sydorenko <wk@sydorenko.org.ua>
Date: Wed, 3 Jul 2019 11:59:52 +0200
Subject: [PATCH] Fix test_invalid_status to work with pytest 5
Ref: https://github.com/cherrypy/cherrypy/pull/1791#issuecomment-508026879
---
cherrypy/test/test_httputil.py | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/cherrypy/test/test_httputil.py b/cherrypy/test/test_httputil.py
index fe6a3f41..c6b858b8 100644
--- a/cherrypy/test/test_httputil.py
+++ b/cherrypy/test/test_httputil.py
@@ -74,7 +74,5 @@ def test_valid_status(status, expected_status):
)
def test_invalid_status(status_code, error_msg):
"""Check that invalid status cause certain errors."""
- with pytest.raises(ValueError) as excinfo:
+ with pytest.raises(ValueError, match=error_msg):
httputil.valid_status(status_code)
-
- assert error_msg in str(excinfo)
From 14c12d2420a4b3765bb241250bd186e93b2f25eb Mon Sep 17 00:00:00 2001
From: Sviatoslav Sydorenko <wk@sydorenko.org.ua>
Date: Wed, 3 Jul 2019 14:04:02 +0200
Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=E2=9C=85=20Fix=20pattern=20matchin?=
=?UTF-8?q?g=20in=20test=5Finvalid=5Fstatus?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
cherrypy/test/test_httputil.py | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/cherrypy/test/test_httputil.py b/cherrypy/test/test_httputil.py
index c6b858b8..84661424 100644
--- a/cherrypy/test/test_httputil.py
+++ b/cherrypy/test/test_httputil.py
@@ -62,14 +62,17 @@ def test_valid_status(status, expected_status):
@pytest.mark.parametrize(
'status_code,error_msg',
[
- ('hey', "Illegal response status from server ('hey' is non-numeric)."),
+ (
+ 'hey',
+ r"Illegal response status from server \('hey' is non-numeric\)."
+ ),
(
{'hey': 'hi'},
- 'Illegal response status from server '
- "({'hey': 'hi'} is non-numeric).",
+ r'Illegal response status from server '
+ r"\(\{'hey': 'hi'\} is non-numeric\).",
),
- (1, 'Illegal response status from server (1 is out of range).'),
- (600, 'Illegal response status from server (600 is out of range).'),
+ (1, r'Illegal response status from server \(1 is out of range\).'),
+ (600, r'Illegal response status from server \(600 is out of range\).'),
]
)
def test_invalid_status(status_code, error_msg):