From e299c3cf98ab520e88b61c14952a1bcfcb171c00d1e3c2b828c57e9d66a3c8cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= Date: Mon, 22 Jul 2019 08:13:15 +0000 Subject: [PATCH] - Add patch to work well with pytest5: * pytest5.patch OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-gunicorn?expand=0&rev=40 --- pytest5.patch | 67 +++++++++++++++++++++++++++++++++++++++++ python-gunicorn.changes | 6 ++++ python-gunicorn.spec | 4 ++- 3 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 pytest5.patch diff --git a/pytest5.patch b/pytest5.patch new file mode 100644 index 0000000..e22b1f7 --- /dev/null +++ b/pytest5.patch @@ -0,0 +1,67 @@ +From f38f717539b1b7296720805b8ae3969c3509b9c1 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Martin=20Ba=C5=A1ti?= +Date: Thu, 11 Jul 2019 19:12:16 +0200 +Subject: [PATCH] Fix pytest 5.0.0 compatibility +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +pytest.raises() returns exception info not the exception itself. They +changed implementation of exception info, so now .value property must be +used to get the exception instance and have proper output from str() +method. + +https://github.com/pytest-dev/pytest/issues/5412 + +Signed-off-by: Martin Bašti +--- + tests/test_util.py | 20 ++++++++++---------- + 1 file changed, 10 insertions(+), 10 deletions(-) + +Index: gunicorn-19.9.0/tests/test_util.py +=================================================================== +--- gunicorn-19.9.0.orig/tests/test_util.py ++++ gunicorn-19.9.0/tests/test_util.py +@@ -24,9 +24,9 @@ def test_parse_address(test_input, expec + + + def test_parse_address_invalid(): +- with pytest.raises(RuntimeError) as err: ++ with pytest.raises(RuntimeError) as exc_info: + util.parse_address('127.0.0.1:test') +- assert "'test' is not a valid port number." in str(err) ++ assert "'test' is not a valid port number." in str(exc_info.value) + + + def test_http_date(): +@@ -52,24 +52,24 @@ def test_warn(capsys): + def test_import_app(): + assert util.import_app('support:app') + +- with pytest.raises(ImportError) as err: ++ with pytest.raises(ImportError) as exc_info: + util.import_app('a:app') +- assert 'No module' in str(err) ++ assert 'No module' in str(exc_info.value) + +- with pytest.raises(AppImportError) as err: ++ with pytest.raises(AppImportError) as exc_info: + util.import_app('support:wrong_app') + msg = "Failed to find application object 'wrong_app' in 'support'" +- assert msg in str(err) ++ assert msg in str(exc_info.value) + + + def test_to_bytestring(): + assert util.to_bytestring('test_str', 'ascii') == b'test_str' + assert util.to_bytestring('test_str®') == b'test_str\xc2\xae' + assert util.to_bytestring(b'byte_test_str') == b'byte_test_str' +- with pytest.raises(TypeError) as err: ++ with pytest.raises(TypeError) as exc_info: + util.to_bytestring(100) + msg = '100 is not a string' +- assert msg in str(err) ++ assert msg in str(exc_info.value) + + + @pytest.mark.parametrize('test_input, expected', [ diff --git a/python-gunicorn.changes b/python-gunicorn.changes index e36d119..36478ce 100644 --- a/python-gunicorn.changes +++ b/python-gunicorn.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Mon Jul 22 08:10:35 UTC 2019 - Tomáš Chvátal + +- Add patch to work well with pytest5: + * pytest5.patch + ------------------------------------------------------------------- Thu Oct 18 09:59:59 UTC 2018 - Tomáš Chvátal diff --git a/python-gunicorn.spec b/python-gunicorn.spec index b7c1d40..4754fa0 100644 --- a/python-gunicorn.spec +++ b/python-gunicorn.spec @@ -1,7 +1,7 @@ # # spec file for package python-gunicorn # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -25,6 +25,7 @@ License: MIT Group: Development/Languages/Python URL: http://gunicorn.org Source: https://files.pythonhosted.org/packages/source/g/gunicorn/gunicorn-%{version}.tar.gz +Patch0: pytest5.patch BuildRequires: %{python_module mock} BuildRequires: %{python_module pytest-cov} BuildRequires: %{python_module pytest} @@ -56,6 +57,7 @@ This package contains the documentation. %prep %setup -q -n gunicorn-%{version} +%patch0 -p1 # remove version pinning for test requirements sed -i 's/==.*//' requirements_test.txt sed -i -e '/cover/d' requirements_test.txt