From da0875b5763b5f671215981902bc970768aff9502fd7f120288d2e5ae9741694 Mon Sep 17 00:00:00 2001 From: Sebastian Wagner Date: Thu, 26 Sep 2024 08:26:24 +0000 Subject: [PATCH] - update to version 3.13.0: - Adding Python 3.13 support by @mindflayer in #242 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-mocket?expand=0&rev=88 --- .gitattributes | 23 +++ .gitignore | 1 + _multibuild | 3 + mocket-3.12.8.tar.gz | 3 + mocket-3.12.9.tar.gz | 3 + mocket-3.13.0.tar.gz | 3 + python-mocket.changes | 469 ++++++++++++++++++++++++++++++++++++++++++ python-mocket.spec | 124 +++++++++++ 8 files changed, 629 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 _multibuild create mode 100644 mocket-3.12.8.tar.gz create mode 100644 mocket-3.12.9.tar.gz create mode 100644 mocket-3.13.0.tar.gz create mode 100644 python-mocket.changes create mode 100644 python-mocket.spec diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/_multibuild b/_multibuild new file mode 100644 index 0000000..fcc7b97 --- /dev/null +++ b/_multibuild @@ -0,0 +1,3 @@ + + test + diff --git a/mocket-3.12.8.tar.gz b/mocket-3.12.8.tar.gz new file mode 100644 index 0000000..82306a3 --- /dev/null +++ b/mocket-3.12.8.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fbecc65cbb50d35b2b985d04a9416a6b187e9a73735bc233606d51ccd1935e4c +size 73169 diff --git a/mocket-3.12.9.tar.gz b/mocket-3.12.9.tar.gz new file mode 100644 index 0000000..2195134 --- /dev/null +++ b/mocket-3.12.9.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6a26dd098325a3d83f3ea82510172feb5281d4eed8f4d0b535e3646d8e78752f +size 73303 diff --git a/mocket-3.13.0.tar.gz b/mocket-3.13.0.tar.gz new file mode 100644 index 0000000..c7dff3a --- /dev/null +++ b/mocket-3.13.0.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:185cc80d213ed3d2f8442e70e21ddfaa0abd964c8e563ab924dfbe64d6c759cf +size 73320 diff --git a/python-mocket.changes b/python-mocket.changes new file mode 100644 index 0000000..27a331e --- /dev/null +++ b/python-mocket.changes @@ -0,0 +1,469 @@ +------------------------------------------------------------------- +Thu Sep 26 08:25:18 UTC 2024 - Sebastian Wagner + +- update to version 3.13.0: + - Adding Python 3.13 support by @mindflayer in #242 + +------------------------------------------------------------------- +Tue Sep 3 07:23:27 UTC 2024 - Sebastian Wagner + +- Update to version 3.12.9: + * Replacing httptools with h11 + +------------------------------------------------------------------- +Tue Jun 4 08:17:14 UTC 2024 - Dirk Müller + +- update to 3.12.8: + * Fix regression + * Begin mypy type-checking + * Make Mocket work with big requests + +------------------------------------------------------------------- +Sun May 5 12:58:39 UTC 2024 - Sebastian Wagner + +- Update to version 3.12.6: + - Strict mode check should accept a location as str by @mindflayer in #230 +- Update to version 3.12.5: + - Add getblocking() method by @mindflayer in #228 + +------------------------------------------------------------------- +Tue Feb 6 12:22:14 UTC 2024 - Sebastian Wagner + +- Update to version 3.12.4: + * When creating true socket connection, use host and port stored in instance variables, not in the Mocket class's variable by @ento in #222 + * Switching to Compose v2 by @mindflayer in #223 + * Add allowed locations (whitelist) for STRICT mode by @mindflayer (refactoring of #214 from @ento) in #224 + +------------------------------------------------------------------- +Mon Jan 22 08:43:05 UTC 2024 - Sebastian Wagner + +- add pytest-asyncio and psutil to test build requirements +- skip test_truesendall_with_dump_from_recording and test_no_dangling_fds as they require internet connection + +------------------------------------------------------------------- +Sat Jan 20 19:40:29 UTC 2024 - Dirk Müller + +- update to 3.12.3: + * Fixes for allowing making a mixture of unmocked and mocked + HTTPS requests using aiohttp + * Merging external contribution + * Adding testcase for proving #209 was fixed + +------------------------------------------------------------------- +Sat Jan 13 20:23:20 UTC 2024 - Dirk Müller + +- update to 3.12.2: + * Pook is now compatible with modern Python versions + * Excluding venvs from dist packages + +------------------------------------------------------------------- +Fri Dec 29 16:14:00 UTC 2023 - Antonio Larrosa + +- Fix check that was testing the version package of python3-httpx. + That's not available in SLE so we now use python311-httpx + instead which allows the package to build fine in SLE's Python + 3.11 stack. + +------------------------------------------------------------------- +Tue Dec 26 15:49:11 UTC 2023 - ecsos + +- Add %{?sle15_python_module_pythons} + +------------------------------------------------------------------- +Tue Oct 31 17:34:29 UTC 2023 - Sebastian Wagner + +- Update to version 3.12.0: + * Support for Python 3.12 (#204) + * Fix for Python 3.12 + * Getting rid of Python 3.7, since it's not supported anymore. + * Precommit hooks' autoupdate. + * Disabling `aiohttp` for testing Python 3.12. + +------------------------------------------------------------------- +Tue Oct 24 10:15:32 UTC 2023 - Daniel Garcia + +- Run redis server on %check to fix redis tests that depends on a real + redis server running. + +------------------------------------------------------------------- +Fri May 12 10:42:12 UTC 2023 - Markéta Machová + +- Update to 3.11.1 + * Fix for `urllib2>=2` + * Bump version for publishing a new release + * Adding local container for partially replacing httpbin.org usage + * Replacing httpbin.org with mockbin.org from Kong for what needs HTTPS + +------------------------------------------------------------------- +Sun Feb 19 21:05:20 UTC 2023 - Sebastian Wagner + +- Update to version 3.11: + - Migrating the HTTP[S] mock from relying on http-parser to httptools. + - Never discovered the root cause for the failing tests with aiohttp/Python 3.11 (first time ever I added @pytest.mark.xfail to a few tests). Same test works with httpx, so I suspect it's related to a client issue. I'll probably migrate to httpx as the reference client for testing async/await code. +- remove patches merged upstream: + 0007-Switching-to-httptools.parser.HttpRequestParser.patch + 0008-Disabling-tests-for-pook-when-testing-Python-3.11.patch + 0009-Removing-DeprecationWarning-all-over-the-place.patch + 0010-Python-3.11-needs-an-async-decorator.patch + 0012-Removing-async-timeout-dependency.patch + 0013-Refactoring-using-event_loop-fixture.patch + 0014-Refactoring-using-tempfile-as-a-context-manager.patch + 0015-Skip-those-tests-and-see-what-happens-to-the-rest.patch + +------------------------------------------------------------------- +Thu Feb 2 11:44:50 UTC 2023 - Dirk Müller + +- add these commits as patches from the upstream PR: + 0007-Switching-to-httptools.parser.HttpRequestParser.patch + 0008-Disabling-tests-for-pook-when-testing-Python-3.11.patch + 0009-Removing-DeprecationWarning-all-over-the-place.patch + 0010-Python-3.11-needs-an-async-decorator.patch + 0012-Removing-async-timeout-dependency.patch + 0013-Refactoring-using-event_loop-fixture.patch + 0014-Refactoring-using-tempfile-as-a-context-manager.patch + 0015-Skip-those-tests-and-see-what-happens-to-the-rest.patch +- skip now failing tests, update buildrequires for tests on py 3.11 + +------------------------------------------------------------------- +Sun Jan 1 18:43:24 UTC 2023 - Ben Greiner + +- Update to version 3.10.9 + * Small improvement for socketpair by @mindflayer in #189 + * Fix for an unconvential usage of Mocket by @mindflayer in #192 + * Improve efficiency on CI by @amotl in #194 +- Add missing fastapi test dependency + +------------------------------------------------------------------- +Tue Aug 23 18:47:07 UTC 2022 - Sebastian Wagner + +- update to version 3.10.8: + - Support for calls made by fastapi (#188) + * Introduce a `socket.socketpair()` function that acts as the real one + +------------------------------------------------------------------- +Wed Aug 17 10:09:41 UTC 2022 - Sebastian Wagner + +- update to version 3.10.7: + - Adding support for `httpx` (#183) + - Change methods not using its bound instance to staticmethods (#180) + +------------------------------------------------------------------- +Mon Jul 25 09:24:02 UTC 2022 - Ben Greiner + +- Clean test requirements and suggestions +- Drop recording-urllib3-brotli.patch fixed by updated httpx + +------------------------------------------------------------------- +Wed May 18 06:31:34 UTC 2022 - pgajdos@suse.com + +- version update to 3.10.6 + No need for the external mock dependency +- deleted patches + - python-mocket-no-mock.patch (upstreamed) + +------------------------------------------------------------------- +Tue May 17 13:29:27 UTC 2022 - pgajdos@suse.com + +- do not require python-mock for build +- added patches + fix https://github.com/mindflayer/python-mocket/issues/178 + + python-mocket-no-mock.patch + +------------------------------------------------------------------- +Mon Apr 25 08:36:19 UTC 2022 - Sebastian Wagner + +- - Bump Mocket version + - MocketEntry.request_class str vs bytes (#177) + * Change request_cls to prevent unintended bytes -> str conversion (#176) + * Use type from `.compat`. + Co-authored-by: Michael Lazar + - Update README.rst + - Remove blank lines after docstring (#174) + Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com> + - Remove assert statement from non-test files (#173) + Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com> + - Small refactor. (#172) + - Update README.rst + - Update LICENSE + - No need for it. + - New badge + - Update README.rst + - Update README.rst + - Add Mocket "strict mode" (#171) + * Add Mocket "strict mode". + - Update main.yml + - Introducing `request_list()` method (#170) + * Introducing `request_list()` method. + - Refactoring. (#169) + - Some cleaning/refactoring (#168) + * Some cleaning/refactoring. + * Improving coverage. + - Update README.rst + - Use literal syntax instead of function calls to create data structure (#167) + Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com> + +------------------------------------------------------------------- +Mon Apr 18 19:31:43 UTC 2022 - Ben Greiner + +- Add recording-urllib3-brotli.patch for test data because the + new urllib3 for Tumbleweed accepts Brotli encoding by default + rendering the recorded request differently. +- Upstream dropped Python 2 support. Skip python2 build for 15.3 +- Refresh test ignores for SLE/Leap (not that it matters, the only + Python 3.7 test is skipped by name globally) + +------------------------------------------------------------------- +Sun Jan 9 19:21:59 UTC 2022 - Sebastian Wagner + +- - Add Mocket "strict mode" (#171) + * Add Mocket "strict mode". + - Update main.yml + - Introducing `request_list()` method (#170) + * Introducing `request_list()` method. + - Refactoring. (#169) + - Some cleaning/refactoring (#168) + * Some cleaning/refactoring. + * Improving coverage. + - Update README.rst + - Use literal syntax instead of function calls to create data structure (#167) + Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com> + +------------------------------------------------------------------- +Sat Jan 8 21:39:28 UTC 2022 - Sebastian Wagner + +- - Introducing `request_list()` method (#170) + * Introducing `request_list()` method. + - Refactoring. (#169) + - Some cleaning/refactoring (#168) + * Some cleaning/refactoring. + * Improving coverage. + - Update README.rst + - Use literal syntax instead of function calls to create data structure (#167) + Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com> + +------------------------------------------------------------------- +Wed Dec 1 21:17:39 UTC 2021 - Sebastian Wagner + +- Update to version 3.10.2: + - Help the user to spot issues (#166) + * Help to detect `register()` misusage. + * Bump version. + * Improve DeepSource scans. + - Newer `pipenv` and GIT hooks (#165) + * Newer GIT hooks. + - Remove implicit `object` from the base class (#164) + Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com> + - Change methods not using its bound instance to staticmethods (#163) + Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com> + - Add .deepsource.toml + - Replace `dict` call with comprehension (#162) + Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com> + - Refactor unnecessary `else` / `elif` when `if` block has a `return` statement (#161) + Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com> + - Remove unnecessary generator (#160) + Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com> + - Multi `register()` (#159) + * Add failing test. + * `Entry.collect` let us know if the response should be consumed or not. + * Bump version. + - Update README.rst + - Update main.yml + - In PYPI the package is old and broken + +------------------------------------------------------------------- +Sat Nov 27 10:12:44 UTC 2021 - Sebastian Wagner + +- Update to version 3.10.1: + - Multi `register()` (#159) + * Add failing test. + * `Entry.collect` let us know if the response should be consumed or not. + * Bump version. + - Update README.rst + - Update main.yml + - In PYPI the package is old and broken + +------------------------------------------------------------------- +Fri Sep 24 19:50:05 UTC 2021 - Sebastian Wagner + +- update to version 3.10.0: + - Fix for version number + - Testing out Python 3.10 (#156) + * Adding support for Python 3.10 + - Update LICENSE + - Update main.yml + +------------------------------------------------------------------- +Sat Sep 4 18:19:20 UTC 2021 - Sebastian Wagner + +- remove obsolete kwsyntax.patch. + +------------------------------------------------------------------- +Sat Sep 4 18:10:11 UTC 2021 - Sebastian Wagner + +- Update to version 3.9.44: + - Update __init__.py + - Removing the constraint for `decorator`. + - Update __init__.py (#155) + - Patch from PR #150 (Refactored the mocketize decorator) (#153) + * Patch from PR #150. Thanks to @micheles form the hints. + * Complete refactor for using `decorator>=5`. + - Update README.rs + +------------------------------------------------------------------- +Thu Aug 5 15:22:22 UTC 2021 - Markéta Machová + +- Add kwsyntax.patch to fix test failure with new decorator. + +------------------------------------------------------------------- +Sat Jul 3 20:16:19 UTC 2021 - Sebastian Wagner + +- Update to version 3.9.42: + - Mock check_hostname everywhere (#152) + * Fix for #151. + * Complete refactoring. + +------------------------------------------------------------------- +Fri May 21 16:02:54 UTC 2021 - Sebastian Wagner + +- update to version 3.9.41: + - A few refactors. + - Adding `make setup` for local development. + - Migrating package creation to using build. Avoid decorator>=5 as dependency. (#149) + - Avoid decorator>=5 as dependency. (#149) + +------------------------------------------------------------------- +Tue Feb 2 21:33:54 UTC 2021 - Sebastian Wagner + +- disable test test_asyncio_record_replay as it requires DNS. + +------------------------------------------------------------------- +Sat Jan 23 19:20:19 UTC 2021 - Sebastian Wagner + +- Update to version 3.9.40: + - Fix for asyncio.open_connection() (#144) + - fix UT for 3.5 support + +------------------------------------------------------------------- +Fri Jan 15 16:56:37 UTC 2021 - Sebastian Wagner + +- update to version 3.9.39: + - Use MocketSocket as context manager (#141) + * Adding support for using a `socket` as a context manager as requested by #139. + * Closing real socket. + * Bump version. +- update to version 3.9.38: + - Update __init__.py +- update to version 3.9.37: + - Fix for external decorators (#138) +- update to version 3.9.36: + - New mocket method for checking if all entries have been served (#137) + * Mocket method for checking if all entries have been served at least once. + - Yet another refactor (#135) + - Refactor. (#136) + +------------------------------------------------------------------- +Sun Jan 3 10:37:41 UTC 2021 - Sebastian Wagner + +- update to version 3.9.35: + - Removing Python 2 compatibility layer (#134). + +------------------------------------------------------------------- +Thu Dec 17 17:09:52 UTC 2020 - Benjamin Greiner + +- Do not require and test with pook on Python2 + +------------------------------------------------------------------- +Thu Dec 17 15:10:50 UTC 2020 - Benjamin Greiner + +- Update to version 3.9.4 + * fix for new version of pip resolver +- Skip python38 only tests in python36 flavor and python3 flavor + if python3 <= 3.8 (Leap) + +------------------------------------------------------------------- +Thu Dec 10 01:45:45 UTC 2020 - Benjamin Greiner + +- Relax pinned setup.py requires so that the installed egg-info + does not interfere with other packages + +------------------------------------------------------------------- +Mon Nov 9 20:23:21 UTC 2020 - Sebastian Wagner + +- Update to version 3.9.3: + * Fix for `.makefile()` as reported by @KyleKing. + * From `codecs` to `binascii` for PyPy. (#127) +- Update to version 3.9.2: + * Mocket raises exceptions. + * Fix for Python 2. + +------------------------------------------------------------------- +Sun Oct 11 07:03:02 UTC 2020 - Sebastian Wagner + +- Update to version 3.9.1: + - Multiple HTTP writes (#125) + - Fix for #111. + +------------------------------------------------------------------- +Sat Sep 26 07:39:57 UTC 2020 - Sebastian Wagner + +- Update to version 3.9.0: + - MockHTTP uses `http-parser` as parser + Fix for second sendall used for delivering request's body. +- Update to version 3.8.9: + - Small refactor for HTTPretty plugin + Now the import line can be written as from mocket.plugins.httpretty import httpretty, httprettified. +- Update to version 3.8.8: + - Small fix applied to `setup.py` + +------------------------------------------------------------------- +Tue Aug 11 07:17:16 UTC 2020 - Benjamin Greiner + +- Update to version 3.8.7 + * This version ships the change to support the libmagic wrapper + distributed with file's command. + +------------------------------------------------------------------- +Tue Aug 11 07:08:04 UTC 2020 - Tomáš Chvátal + +- Switch to multibuild as we create cycle with python-pook otherwise + +------------------------------------------------------------------- +Sat Aug 8 13:00:29 UTC 2020 - Sebastian Wagner + +- Change requirements version specifier from == to >=. + +------------------------------------------------------------------- +Thu Jul 23 18:54:20 UTC 2020 - Sebastian Wagner + +- Update to version 3.8.6: + - No upstream changelog available +- Use source tarball from pypi instead of GitHub. + +------------------------------------------------------------------- +Wed Apr 1 07:38:18 UTC 2020 - pgajdos@suse.com + +- version update to 3.8.4 + * Adding missing `load_verify_locations` method + * Removing `hexdump` dependency + * Fix for removing DeprecationWarning (#105) + * Py3.8 classifier + * Fix for Redis module + +------------------------------------------------------------------- +Wed Sep 18 07:41:18 UTC 2019 - Tomáš Chvátal + +- Update to 3.7.3: + * testsuite fixes +- Drop patch partial-wildcards.patch + +------------------------------------------------------------------- +Wed Sep 18 04:08:03 UTC 2019 - John Vandenberg + +- Activate test suite +- Add patch partial-wildcards.patch +- Update to v3.7.2 + +------------------------------------------------------------------- +Fri Apr 19 11:41:58 AM UTC 2019 - John Vandenberg + +- Initial spec for v2.7.2 diff --git a/python-mocket.spec b/python-mocket.spec new file mode 100644 index 0000000..09b7450 --- /dev/null +++ b/python-mocket.spec @@ -0,0 +1,124 @@ +# +# spec file +# +# Copyright (c) 2024 SUSE LLC +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +%global flavor @BUILD_FLAVOR@%{nil} +%if "%{flavor}" == "test" +%define psuffix -test +%bcond_without test +%else +%define psuffix %{nil} +%bcond_with test +%endif + +%{?sle15_python_module_pythons} +Name: python-mocket%{psuffix} +Version: 3.13.0 +Release: 0 +Summary: Python socket mock framework +License: BSD-3-Clause +URL: https://github.com/mindflayer/python-mocket +Source0: https://files.pythonhosted.org/packages/source/m/mocket/mocket-%{version}.tar.gz +BuildRequires: %{python_module hatchling} +BuildRequires: %{python_module pip} +BuildRequires: %{python_module setuptools} +BuildRequires: %{python_module wheel} +BuildRequires: fdupes +BuildRequires: python-rpm-macros +Requires: python-decorator >= 4 +Requires: python-h11 +Requires: python-python-magic >= 0.4.5 +Requires: python-urllib3 >= 1.25.3 +Suggests: python-pook >= 0.2.1 +Suggests: python-xxhash +BuildArch: noarch +%if %{with test} +BuildRequires: %{python_module aiohttp} +BuildRequires: %{python_module asgiref} +BuildRequires: %{python_module fastapi} +BuildRequires: %{python_module gevent} +BuildRequires: %{python_module httptools} +BuildRequires: %{python_module mocket = %{version}} +BuildRequires: %{python_module pook >= 0.2.1} +BuildRequires: %{python_module psutil} +BuildRequires: %{python_module pytest-asyncio} +BuildRequires: %{python_module pytest} +BuildRequires: %{python_module redis} +BuildRequires: %{python_module requests} +BuildRequires: %{python_module sure} +BuildRequires: %{python_module xxhash} +BuildRequires: ca-certificates-mozilla +BuildRequires: redis +%endif +%python_subpackages + +%description +Socket Mock Framework - for all kinds of socket animals, web-clients +included, with gevent/asyncio/SSL support. + +%prep +%autosetup -p1 -n mocket-%{version} +sed -i 's/--cov[^ ]*//g' pyproject.toml + +%build +%if !%{with test} +export LANG=en_US.UTF-8 +%pyproject_wheel +%endif + +%install +%if !%{with test} +export LANG=en_US.UTF-8 +%pyproject_install +%python_expand %fdupes %{buildroot}%{$python_sitelib} +%endif + +%check +%if %{with test} +export LANG=en_US.UTF-8 +export SKIP_TRUE_HTTP=1 +%if 0%{?suse_version} < 1550 +# Ignore tests which are not supported on Python 3.6 +pytest_python3_ignore="--ignore tests/tests37 --ignore tests/tests38" +%endif + +%{_sbindir}/redis-server --version | grep ' v=7\.' && redis7args="--enable-debug-command yes --enable-module-command yes" +%{_sbindir}/redis-server --port 6379 --save "" $redis7args & +victims="$!" +trap "kill $victims || true" EXIT +sleep 2 + +# Checks the ability to record a real request and response. Not available inside obs. +donttest="test_asyncio_record_replay or test_truesendall_with_dump_from_recording or test_no_dangling_fds" +# The reference recording has different headers in this case +%if %{pkg_vcmp python311-httpx < 0.23} +donttest="$donttest or test_truesendall_with_dump_from_recording" +%endif +# these fail after the python 3.11 patches +#donttest="$donttest or test_http_session or test_https_session or test_httprettish_session or test_truesendall or test_wrongpath_truesendall or test_real_request_session or test_multiple_socket_connections or test_intermittent_strict_mode or test_strict_mode_exceptions or test_err or test_get or test_hm or test_incr or test_lrange or test_select_db or test_set or test_shutdown or test_hgetall or test_raise_exception" +%pytest -rfEs -k "not ($donttest)" ${pytest_$python_ignore} tests +%endif + +%if !%{with test} +%files %{python_files} +%doc README.rst +%license LICENSE +%{python_sitelib}/mocket +%{python_sitelib}/mocket-%{version}.dist-info +%endif + +%changelog