1
0
forked from pool/python-mocket
python-mocket/python-mocket.spec
Sebastian Wagner 3af5ffac37 - 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

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-mocket?expand=0&rev=61
2023-02-19 21:06:08 +00:00

116 lines
3.5 KiB
RPMSpec

#
# spec file
#
# Copyright (c) 2023 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
%define skip_python2 1
Name: python-mocket%{psuffix}
Version: 3.11.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 setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-decorator >= 4
Requires: python-http-parser >= 0.9.0
Requires: python-httptools
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 pytest}
BuildRequires: %{python_module redis}
BuildRequires: %{python_module requests}
BuildRequires: %{python_module sure}
BuildRequires: %{python_module xxhash}
BuildRequires: ca-certificates-mozilla
%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 '/cov/ d' setup.cfg
sed -i '/pipenv/ d' setup.py
%build
%if !%{with test}
export LANG=en_US.UTF-8
%python_build
%endif
%install
%if !%{with test}
export LANG=en_US.UTF-8
%python_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
# Requires a running Redis server
donttest="TrueRedisTestCase"
# Checks the ability to record a real request and response. Not available inside obs.
donttest="$donttest or test_asyncio_record_replay"
# The reference recording has different headers in this case
%if %{pkg_vcmp python3-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"
%pytest -rfEs -k "not ($donttest)" ${pytest_$python_ignore}
%endif
%if !%{with test}
%files %{python_files}
%doc README.rst
%license LICENSE
%{python_sitelib}/mocket
%{python_sitelib}/mocket-%{version}-py*.egg-info
%endif
%changelog