diff --git a/python-elastic-transport.changes b/python-elastic-transport.changes index d25006d..2f83698 100644 --- a/python-elastic-transport.changes +++ b/python-elastic-transport.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Mon May 27 04:24:39 UTC 2024 - Steve Kowalik + +- Switch to pyproject macros. +- Require pytest 8 or greater. +- Add patch remove-mock.patch: + * Remove requirement on mock, now as a patch, rather than sed. + ------------------------------------------------------------------- Thu May 23 08:17:35 UTC 2024 - Markéta Machová diff --git a/python-elastic-transport.spec b/python-elastic-transport.spec index 6c9b834..40620fc 100644 --- a/python-elastic-transport.spec +++ b/python-elastic-transport.spec @@ -25,9 +25,13 @@ License: Apache-2.0 URL: https://github.com/elastic/elastic-transport-python Source: https://github.com/elastic/elastic-transport-python/archive/refs/tags/v%{version}.tar.gz#/elastic-transport-python-%{version}.tar.gz # PATCH-FIX-UPSTREAM https://github.com/elastic/elastic-transport-python/pull/164 Fix requests 2.32 compatibility -Patch: requests232.patch +Patch0: requests232.patch +# PATCH-FIX-UPSTREAM gh#elastic/elastic-transport-python#163 +Patch1: remove-mock.patch BuildRequires: %{python_module base >= 3.7} +BuildRequires: %{python_module pip} BuildRequires: %{python_module setuptools} +BuildRequires: %{python_module wheel} BuildRequires: fdupes BuildRequires: python-rpm-macros Requires: python-certifi @@ -57,13 +61,12 @@ Transport classes and utilities shared among Python Elastic client libraries %prep %autosetup -p1 -n elastic-transport-python-%{version} sed -i '/addopts/d' setup.cfg -sed -i 's/from mock/from unittest.mock/' tests/node/test_http_*.py %build -%python_build +%pyproject_wheel %install -%python_install +%pyproject_install %python_expand %fdupes %{buildroot}%{$python_sitelib} %check @@ -80,6 +83,6 @@ donttest="$donttest or test_url_to_node_config[https://[::1]:0/-https://[::1]:0- %doc CHANGELOG.md README.md %license LICENSE %{python_sitelib}/elastic_transport -%{python_sitelib}/elastic_transport-%{version}*-info +%{python_sitelib}/elastic_transport-%{version}.dist-info %changelog diff --git a/remove-mock.patch b/remove-mock.patch new file mode 100644 index 0000000..213fcc9 --- /dev/null +++ b/remove-mock.patch @@ -0,0 +1,59 @@ +From 20d207e59f17f9539af12626e2f832f9ad094025 Mon Sep 17 00:00:00 2001 +From: Steve Kowalik +Date: Mon, 20 May 2024 11:51:43 +1000 +Subject: [PATCH] Remove last uses of mock + +The node tests still relied on the external mock library for mocking, +whereas other tests have transitioned to unittest.mock. Since we support +Python 3.7 and greater, we can remove that requirement and pull them in +line too. +--- + setup.py | 1 - + tests/node/test_http_requests.py | 2 +- + tests/node/test_http_urllib3.py | 2 +- + 3 files changed, 2 insertions(+), 3 deletions(-) + +diff --git a/setup.py b/setup.py +index c145012..17370a7 100644 +--- a/setup.py ++++ b/setup.py +@@ -63,7 +63,6 @@ + "pytest-asyncio", + "pytest-httpserver", + "trustme", +- "mock", + "requests", + "aiohttp", + "httpx", +diff --git a/tests/node/test_http_requests.py b/tests/node/test_http_requests.py +index 2ff7bc0..3a99854 100644 +--- a/tests/node/test_http_requests.py ++++ b/tests/node/test_http_requests.py +@@ -18,10 +18,10 @@ + import gzip + import ssl + import warnings ++from unittest.mock import Mock, patch + + import pytest + import requests +-from mock import Mock, patch + from requests.auth import HTTPBasicAuth + + from elastic_transport import NodeConfig, RequestsHttpNode +diff --git a/tests/node/test_http_urllib3.py b/tests/node/test_http_urllib3.py +index fad11e7..25bd920 100644 +--- a/tests/node/test_http_urllib3.py ++++ b/tests/node/test_http_urllib3.py +@@ -19,10 +19,10 @@ + import re + import ssl + import warnings ++from unittest.mock import Mock, patch + + import pytest + import urllib3 +-from mock import Mock, patch + from urllib3.response import HTTPHeaderDict + + from elastic_transport import NodeConfig, TransportError, Urllib3HttpNode