2019-09-18 09:40:00 +02:00
|
|
|
#
|
2024-06-04 10:17:27 +02:00
|
|
|
# spec file for package python-mocket
|
2019-09-18 09:40:00 +02:00
|
|
|
#
|
2024-01-13 21:23:34 +01:00
|
|
|
# Copyright (c) 2024 SUSE LLC
|
2019-09-18 09:40:00 +02:00
|
|
|
#
|
|
|
|
# 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/
|
|
|
|
#
|
|
|
|
|
|
|
|
|
2020-08-11 09:08:33 +02:00
|
|
|
%global flavor @BUILD_FLAVOR@%{nil}
|
|
|
|
%if "%{flavor}" == "test"
|
|
|
|
%define psuffix -test
|
|
|
|
%bcond_without test
|
|
|
|
%else
|
|
|
|
%define psuffix %{nil}
|
|
|
|
%bcond_with test
|
|
|
|
%endif
|
2023-01-01 20:33:44 +01:00
|
|
|
|
2023-12-27 11:47:23 +01:00
|
|
|
%{?sle15_python_module_pythons}
|
2020-08-11 09:08:33 +02:00
|
|
|
Name: python-mocket%{psuffix}
|
2024-06-04 10:17:27 +02:00
|
|
|
Version: 3.12.8
|
2019-09-18 09:40:00 +02:00
|
|
|
Release: 0
|
|
|
|
Summary: Python socket mock framework
|
|
|
|
License: BSD-3-Clause
|
|
|
|
URL: https://github.com/mindflayer/python-mocket
|
2020-07-24 03:00:55 +02:00
|
|
|
Source0: https://files.pythonhosted.org/packages/source/m/mocket/mocket-%{version}.tar.gz
|
2023-10-31 18:51:21 +01:00
|
|
|
BuildRequires: %{python_module hatchling}
|
|
|
|
BuildRequires: %{python_module pip}
|
2019-09-18 09:40:00 +02:00
|
|
|
BuildRequires: %{python_module setuptools}
|
2023-10-31 18:51:21 +01:00
|
|
|
BuildRequires: %{python_module wheel}
|
2019-09-18 09:40:00 +02:00
|
|
|
BuildRequires: fdupes
|
|
|
|
BuildRequires: python-rpm-macros
|
2021-09-04 20:23:00 +02:00
|
|
|
Requires: python-decorator >= 4
|
2023-02-15 14:11:24 +01:00
|
|
|
Requires: python-httptools
|
2021-09-04 20:23:00 +02:00
|
|
|
Requires: python-python-magic >= 0.4.5
|
|
|
|
Requires: python-urllib3 >= 1.25.3
|
2019-09-18 09:40:00 +02:00
|
|
|
Suggests: python-pook >= 0.2.1
|
|
|
|
Suggests: python-xxhash
|
|
|
|
BuildArch: noarch
|
2020-08-11 09:08:33 +02:00
|
|
|
%if %{with test}
|
2022-04-19 00:34:38 +02:00
|
|
|
BuildRequires: %{python_module aiohttp}
|
2023-02-02 12:45:43 +01:00
|
|
|
BuildRequires: %{python_module asgiref}
|
2023-01-01 20:33:44 +01:00
|
|
|
BuildRequires: %{python_module fastapi}
|
2019-09-18 09:40:00 +02:00
|
|
|
BuildRequires: %{python_module gevent}
|
2023-02-02 12:45:43 +01:00
|
|
|
BuildRequires: %{python_module httptools}
|
2022-07-25 16:11:56 +02:00
|
|
|
BuildRequires: %{python_module mocket = %{version}}
|
|
|
|
BuildRequires: %{python_module pook >= 0.2.1}
|
2024-01-22 09:39:09 +01:00
|
|
|
BuildRequires: %{python_module psutil}
|
2024-01-22 09:43:39 +01:00
|
|
|
BuildRequires: %{python_module pytest-asyncio}
|
2019-09-18 09:40:00 +02:00
|
|
|
BuildRequires: %{python_module pytest}
|
|
|
|
BuildRequires: %{python_module redis}
|
|
|
|
BuildRequires: %{python_module requests}
|
|
|
|
BuildRequires: %{python_module sure}
|
|
|
|
BuildRequires: %{python_module xxhash}
|
|
|
|
BuildRequires: ca-certificates-mozilla
|
2023-10-24 12:33:14 +02:00
|
|
|
BuildRequires: redis
|
2020-08-11 09:08:33 +02:00
|
|
|
%endif
|
2019-09-18 09:40:00 +02:00
|
|
|
%python_subpackages
|
|
|
|
|
|
|
|
%description
|
|
|
|
Socket Mock Framework - for all kinds of socket animals, web-clients
|
|
|
|
included, with gevent/asyncio/SSL support.
|
|
|
|
|
|
|
|
%prep
|
2023-02-02 12:45:43 +01:00
|
|
|
%autosetup -p1 -n mocket-%{version}
|
2023-10-31 18:51:21 +01:00
|
|
|
#sed -i '/cov/ d' setup.cfg
|
|
|
|
#sed -i '/pipenv/ d' setup.py
|
2019-09-18 09:40:00 +02:00
|
|
|
|
|
|
|
%build
|
2020-08-11 11:12:25 +02:00
|
|
|
%if !%{with test}
|
2019-09-18 09:40:00 +02:00
|
|
|
export LANG=en_US.UTF-8
|
2023-10-31 18:51:21 +01:00
|
|
|
%pyproject_wheel
|
2020-08-11 11:12:25 +02:00
|
|
|
%endif
|
2019-09-18 09:40:00 +02:00
|
|
|
|
|
|
|
%install
|
2020-08-11 09:08:33 +02:00
|
|
|
%if !%{with test}
|
2019-09-18 09:40:00 +02:00
|
|
|
export LANG=en_US.UTF-8
|
2023-10-31 18:51:21 +01:00
|
|
|
%pyproject_install
|
2020-04-01 13:36:44 +02:00
|
|
|
%python_expand %fdupes %{buildroot}%{$python_sitelib}
|
2020-08-11 09:08:33 +02:00
|
|
|
%endif
|
2019-09-18 09:40:00 +02:00
|
|
|
|
|
|
|
%check
|
2020-08-11 09:08:33 +02:00
|
|
|
%if %{with test}
|
2019-09-18 09:40:00 +02:00
|
|
|
export LANG=en_US.UTF-8
|
|
|
|
export SKIP_TRUE_HTTP=1
|
2022-04-19 00:34:38 +02:00
|
|
|
%if 0%{?suse_version} < 1550
|
|
|
|
# Ignore tests which are not supported on Python 3.6
|
|
|
|
pytest_python3_ignore="--ignore tests/tests37 --ignore tests/tests38"
|
2020-12-17 17:01:35 +01:00
|
|
|
%endif
|
2023-10-24 12:33:14 +02:00
|
|
|
|
|
|
|
%{_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
|
|
|
|
|
2022-04-19 00:34:38 +02:00
|
|
|
# Checks the ability to record a real request and response. Not available inside obs.
|
2024-01-22 09:54:37 +01:00
|
|
|
donttest="test_asyncio_record_replay or test_truesendall_with_dump_from_recording or test_no_dangling_fds"
|
2022-07-25 16:11:56 +02:00
|
|
|
# The reference recording has different headers in this case
|
2024-01-02 15:15:51 +01:00
|
|
|
%if %{pkg_vcmp python311-httpx < 0.23}
|
2022-07-25 16:11:56 +02:00
|
|
|
donttest="$donttest or test_truesendall_with_dump_from_recording"
|
|
|
|
%endif
|
2023-02-02 12:45:43 +01:00
|
|
|
# these fail after the python 3.11 patches
|
2023-02-19 22:06:08 +01:00
|
|
|
#donttest="$donttest or test_http_session or test_https_session or test_httprettish_session"
|
2022-07-25 16:11:56 +02:00
|
|
|
%pytest -rfEs -k "not ($donttest)" ${pytest_$python_ignore}
|
2020-08-11 09:08:33 +02:00
|
|
|
%endif
|
2019-09-18 09:40:00 +02:00
|
|
|
|
2020-08-11 09:08:33 +02:00
|
|
|
%if !%{with test}
|
2019-09-18 09:40:00 +02:00
|
|
|
%files %{python_files}
|
|
|
|
%doc README.rst
|
|
|
|
%license LICENSE
|
2020-08-11 11:12:25 +02:00
|
|
|
%{python_sitelib}/mocket
|
2023-10-31 18:51:21 +01:00
|
|
|
%{python_sitelib}/mocket-%{version}.dist-info
|
2020-08-11 09:08:33 +02:00
|
|
|
%endif
|
2019-09-18 09:40:00 +02:00
|
|
|
|
|
|
|
%changelog
|