From 2ed8664eb1adf66e8ba7c23e9477432465902ec1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Zachar?= Date: Mon, 2 Dec 2024 09:28:20 +0100 Subject: [PATCH] Change the test source location Change the test source location to support evolving downstream testing requirements. This is needed both for downstream certification activities and changes to test development for internal infrastructure differences. --- ...-location-header-autocorrect-for-wer.patch | 44 ++++++++++++++++++ ...ove-optional-or-unpackaged-test-deps.patch | 38 +++++++++++++++ ...ove-optional-or-unpackaged-test-deps.patch | 46 +++++++++++++++++++ tests/python-httpbin.spec | 2 +- .../python-ldap-always-use-ldap-library.patch | 34 ++++++++++++++ tests/python-ldap.spec | 2 +- tests/python-setuptools.spec | 4 +- 7 files changed, 166 insertions(+), 4 deletions(-) create mode 100644 tests/0001-Fix-disabling-of-location-header-autocorrect-for-wer.patch create mode 100644 tests/0001-Remove-optional-or-unpackaged-test-deps.patch create mode 100644 tests/Remove-optional-or-unpackaged-test-deps.patch create mode 100644 tests/python-ldap-always-use-ldap-library.patch diff --git a/tests/0001-Fix-disabling-of-location-header-autocorrect-for-wer.patch b/tests/0001-Fix-disabling-of-location-header-autocorrect-for-wer.patch new file mode 100644 index 0000000..ef7886c --- /dev/null +++ b/tests/0001-Fix-disabling-of-location-header-autocorrect-for-wer.patch @@ -0,0 +1,44 @@ +From 06f390d522afb6d2d71bb601c2060a9fabe3f7de Mon Sep 17 00:00:00 2001 +From: Adam Williamson +Date: Mon, 19 Jul 2021 15:41:23 -0700 +Subject: [PATCH] Fix disabling of location header autocorrect for werkzeug 2+ + (#647) + +In werkzeug 2.0.0 and later, the Location header autocorrection +moved from BaseResponse to Response, so we need to set +`autocorrect_location_header = False` in `Response` not +`BaseResponse`. From 2.1.0, BaseResponse is removed and importing +it is an error, so we can't support both any more. + +Signed-off-by: Adam Williamson +--- + httpbin/core.py | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/httpbin/core.py b/httpbin/core.py +index 66a2ed6..fd2842c 100644 +--- a/httpbin/core.py ++++ b/httpbin/core.py +@@ -19,7 +19,7 @@ from flask import Flask, Response, request, render_template, redirect, jsonify a + from six.moves import range as xrange + from werkzeug.datastructures import WWWAuthenticate, MultiDict + from werkzeug.http import http_date +-from werkzeug.wrappers import BaseResponse ++from werkzeug.wrappers import Response as WzResponse + from werkzeug.http import parse_authorization_header + from raven.contrib.flask import Sentry + +@@ -48,7 +48,9 @@ def jsonify(*args, **kwargs): + return response + + # Prevent WSGI from correcting the casing of the Location header +-BaseResponse.autocorrect_location_header = False ++# and forcing it to be absolute. ++WzResponse.autocorrect_location_header = False ++ + + # Find the correct template folder when running from a different location + tmpl_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'templates') +-- +2.36.0 + diff --git a/tests/0001-Remove-optional-or-unpackaged-test-deps.patch b/tests/0001-Remove-optional-or-unpackaged-test-deps.patch new file mode 100644 index 0000000..43e7610 --- /dev/null +++ b/tests/0001-Remove-optional-or-unpackaged-test-deps.patch @@ -0,0 +1,38 @@ +From 4612fd1b6b7f9d3fdbfad34863e5b04535bb44cc Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Hrn=C4=8Diar?= +Date: Wed, 8 Dec 2021 10:22:37 +0100 +Subject: [PATCH] Remove optional or unpackaged test deps + +--- + setup.cfg | 10 ---------- + 1 file changed, 10 deletions(-) + +diff --git a/setup.cfg b/setup.cfg +index 0bc0101..442da7a 100644 +--- a/setup.cfg ++++ b/setup.cfg +@@ -37,21 +37,11 @@ exclude = + [options.extras_require] + testing = + pytest >= 6 +- pytest-checkdocs >= 2.4 +- pytest-flake8 +- pytest-black >= 0.3.7; \ +- python_implementation != "PyPy" +- pytest-cov +- pytest-mypy; \ +- python_implementation != "PyPy" +- pytest-enabler >= 1.0.1 + + mock +- flake8-2020 + virtualenv>=13.0.0 + pytest-virtualenv>=1.2.7 # TODO: Update once man-group/pytest-plugins#188 is solved + wheel +- paver + pip>=19.1 # For proper file:// URLs support. + jaraco.envs>=2.2 + pytest-xdist +-- +2.33.1 + diff --git a/tests/Remove-optional-or-unpackaged-test-deps.patch b/tests/Remove-optional-or-unpackaged-test-deps.patch new file mode 100644 index 0000000..60f0941 --- /dev/null +++ b/tests/Remove-optional-or-unpackaged-test-deps.patch @@ -0,0 +1,46 @@ +From a03fa24ad65286ad9f2dc8bf1934bc84525ed06f Mon Sep 17 00:00:00 2001 +From: Charalampos Stratakis +Date: Wed, 8 Mar 2023 02:48:31 +0100 +Subject: [PATCH] Remove optional or unpackaged test deps + +--- + setup.cfg | 16 ---------------- + 1 file changed, 16 deletions(-) + +diff --git a/setup.cfg b/setup.cfg +index 4791ed6..2776b31 100644 +--- a/setup.cfg ++++ b/setup.cfg +@@ -39,20 +39,6 @@ exclude = + [options.extras_require] + testing = + pytest >= 6 +- pytest-checkdocs >= 2.4 +- pytest-flake8; \ +- python_version < "3.12" +- flake8 < 5 +- pytest-black >= 0.3.7; \ +- python_implementation != "PyPy" +- pytest-cov; \ +- python_implementation != "PyPy" +- pytest-mypy >= 0.9.1; \ +- python_implementation != "PyPy" +- pytest-enabler >= 1.3 +- pytest-perf +- +- flake8-2020 + virtualenv>=13.0.0 + wheel + pip>=19.1 # For proper file:// URLs support. +@@ -60,8 +46,6 @@ testing = + pytest-xdist + jaraco.path>=3.2.0 + build[virtualenv] +- filelock>=3.4.0 +- pip_run>=8.8 + ini2toml[lite]>=0.9 + tomli-w>=1.0.0 + pytest-timeout +-- +2.39.2 + diff --git a/tests/python-httpbin.spec b/tests/python-httpbin.spec index de0618f..964ad4b 100644 --- a/tests/python-httpbin.spec +++ b/tests/python-httpbin.spec @@ -12,7 +12,7 @@ BuildRequires: pyproject-rpm-macros %if 0%{?fedora} >= 37 || 0%{?rhel} >= 10 # Wekrzeug in Fedora 37 isn't compatible with our httpbin -Patch: https://src.fedoraproject.org/rpms/python-httpbin/raw/0e4a7e2812/f/0001-Fix-disabling-of-location-header-autocorrect-for-wer.patch +Patch: 0001-Fix-disabling-of-location-header-autocorrect-for-wer.patch %endif # no flask, itsdangerous, raven, werkzeug packaged for EPEL 9 yet diff --git a/tests/python-ldap-always-use-ldap-library.patch b/tests/python-ldap-always-use-ldap-library.patch new file mode 100644 index 0000000..5c56650 --- /dev/null +++ b/tests/python-ldap-always-use-ldap-library.patch @@ -0,0 +1,34 @@ +From 536a7671151e3070481736e5d6159987df920d8b Mon Sep 17 00:00:00 2001 +From: Simon Pichugin +Date: Wed, 9 Feb 2022 16:06:14 -0800 +Subject: [PATCH] Always use 'ldap' library + +--- + setup.py | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/setup.py b/setup.py +index 119b571..851223e 100644 +--- a/setup.py ++++ b/setup.py +@@ -37,6 +37,8 @@ if cfg.has_section('_ldap'): + for name in dir(LDAP_CLASS): + if cfg.has_option('_ldap', name): + setattr(LDAP_CLASS, name, cfg.get('_ldap', name).split()) ++#-- Overwrite it as 'ldap' is the always correct library we have in Fedora 34+ ++LDAP_CLASS.libs = ['ldap', 'lber'] + + for i in range(len(LDAP_CLASS.defines)): + LDAP_CLASS.defines[i]=((LDAP_CLASS.defines[i],None)) +@@ -132,7 +134,7 @@ setup( + extra_objects = LDAP_CLASS.extra_objects, + runtime_library_dirs = (not sys.platform.startswith("win"))*LDAP_CLASS.library_dirs, + define_macros = LDAP_CLASS.defines + \ +- ('ldap_r' in LDAP_CLASS.libs or 'oldap_r' in LDAP_CLASS.libs)*[('HAVE_LIBLDAP_R',None)] + \ ++ ('ldap' in LDAP_CLASS.libs or 'oldap' in LDAP_CLASS.libs)*[('HAVE_LIBLDAP_R',None)] + \ + ('sasl' in LDAP_CLASS.libs or 'sasl2' in LDAP_CLASS.libs or 'libsasl' in LDAP_CLASS.libs)*[('HAVE_SASL',None)] + \ + ('ssl' in LDAP_CLASS.libs and 'crypto' in LDAP_CLASS.libs)*[('HAVE_TLS',None)] + \ + [ +-- +2.31.1 + diff --git a/tests/python-ldap.spec b/tests/python-ldap.spec index c55ef14..6327f8c 100644 --- a/tests/python-ldap.spec +++ b/tests/python-ldap.spec @@ -8,7 +8,7 @@ Source0: %{pypi_source} # OpenLDAP 2.5+ is not yet supported by python-ldap # https://github.com/python-ldap/python-ldap/issues/432 # Fedora has this patch to make it build, but the tests will fail anyway -Patch0: https://src.fedoraproject.org/rpms/python-ldap/raw/a237d9b212bd1581e07f4f1a8f54c26a7190843c/f/python-ldap-always-use-ldap-library.patch +Patch0: python-ldap-always-use-ldap-library.patch BuildRequires: python3-devel BuildRequires: pyproject-rpm-macros diff --git a/tests/python-setuptools.spec b/tests/python-setuptools.spec index 76f11aa..3417016 100644 --- a/tests/python-setuptools.spec +++ b/tests/python-setuptools.spec @@ -15,9 +15,9 @@ Source: %{pypi_source setuptools %{version}} # Patch from Fedora proper %if 0%{?fedora} || 0%{?rhel} >= 10 -Patch: https://src.fedoraproject.org/rpms/python-setuptools/raw/8ae9b2a777c/f/Remove-optional-or-unpackaged-test-deps.patch +Patch: Remove-optional-or-unpackaged-test-deps.patch %else -Patch: https://src.fedoraproject.org/rpms/python-setuptools/raw/6fc093d6b3d/f/0001-Remove-optional-or-unpackaged-test-deps.patch +Patch: 0001-Remove-optional-or-unpackaged-test-deps.patch %endif BuildArch: noarch