%global _empty_manifest_terminate_build 0 Name: python-respx Version: 0.20.1 Release: 1 Summary: A utility for mocking out the Python HTTPX and HTTP Core libraries. License: BSD-3-Clause URL: https://lundberg.github.io/respx/ Source0: https://mirrors.nju.edu.cn/pypi/web/packages/b0/22/de442b7a15808434fed3e6b65d61709f798b6a4673ad3d71229c82b5f4a1/respx-0.20.1.tar.gz BuildArch: noarch Requires: python3-httpx %description [![tests](https://img.shields.io/github/workflow/status/lundberg/respx/test?label=tests&logo=github&logoColor=white&style=for-the-badge)](https://github.com/lundberg/respx/actions/workflows/test.yml) [![codecov](https://img.shields.io/codecov/c/github/lundberg/respx?logo=codecov&logoColor=white&style=for-the-badge)](https://codecov.io/gh/lundberg/respx) [![PyPi Version](https://img.shields.io/pypi/v/respx?logo=pypi&logoColor=white&style=for-the-badge)](https://pypi.org/project/respx/) [![Python Versions](https://img.shields.io/pypi/pyversions/respx?logo=python&logoColor=white&style=for-the-badge)](https://pypi.org/project/respx/) ## Documentation Full documentation is available at [lundberg.github.io/respx](https://lundberg.github.io/respx/) ## QuickStart RESPX is a simple, _yet powerful_, utility for mocking out the [HTTPX](https://www.python-httpx.org/), _and [HTTP Core](https://www.encode.io/httpcore/)_, libraries. Start by [patching](https://lundberg.github.io/respx/guide/#mock-httpx) `HTTPX`, using `respx.mock`, then add request [routes](https://lundberg.github.io/respx/guide/#routing-requests) to mock [responses](https://lundberg.github.io/respx/guide/#mocking-responses). ```python import httpx import respx from httpx import Response @respx.mock def test_example(): my_route = respx.get("https://example.org/").mock(return_value=Response(204)) response = httpx.get("https://example.org/") assert my_route.called assert response.status_code == 204 ``` > Read the [User Guide](https://lundberg.github.io/respx/guide/) for a complete > walk-through. ### pytest + httpx For a neater `pytest` experience, RESPX includes a `respx_mock` _fixture_ for easy `HTTPX` mocking, along with an optional `respx` _marker_ to fine-tune the mock [settings](https://lundberg.github.io/respx/api/#configuration). ```python import httpx import pytest def test_default(respx_mock): respx_mock.get("https://foo.bar/").mock(return_value=httpx.Response(204)) response = httpx.get("https://foo.bar/") assert response.status_code == 204 @pytest.mark.respx(base_url="https://foo.bar") def test_with_marker(respx_mock): respx_mock.get("/baz/").mock(return_value=httpx.Response(204)) response = httpx.get("https://foo.bar/baz/") assert response.status_code == 204 ``` ## Installation Install with pip: ```console $ pip install respx ``` Requires Python 3.7+ and HTTPX 0.21+. See [Changelog](https://github.com/lundberg/respx/blob/master/CHANGELOG.md) for older HTTPX compatibility. %package -n python3-respx Summary: A utility for mocking out the Python HTTPX and HTTP Core libraries. Provides: python-respx BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-pip %description -n python3-respx [![tests](https://img.shields.io/github/workflow/status/lundberg/respx/test?label=tests&logo=github&logoColor=white&style=for-the-badge)](https://github.com/lundberg/respx/actions/workflows/test.yml) [![codecov](https://img.shields.io/codecov/c/github/lundberg/respx?logo=codecov&logoColor=white&style=for-the-badge)](https://codecov.io/gh/lundberg/respx) [![PyPi Version](https://img.shields.io/pypi/v/respx?logo=pypi&logoColor=white&style=for-the-badge)](https://pypi.org/project/respx/) [![Python Versions](https://img.shields.io/pypi/pyversions/respx?logo=python&logoColor=white&style=for-the-badge)](https://pypi.org/project/respx/) ## Documentation Full documentation is available at [lundberg.github.io/respx](https://lundberg.github.io/respx/) ## QuickStart RESPX is a simple, _yet powerful_, utility for mocking out the [HTTPX](https://www.python-httpx.org/), _and [HTTP Core](https://www.encode.io/httpcore/)_, libraries. Start by [patching](https://lundberg.github.io/respx/guide/#mock-httpx) `HTTPX`, using `respx.mock`, then add request [routes](https://lundberg.github.io/respx/guide/#routing-requests) to mock [responses](https://lundberg.github.io/respx/guide/#mocking-responses). ```python import httpx import respx from httpx import Response @respx.mock def test_example(): my_route = respx.get("https://example.org/").mock(return_value=Response(204)) response = httpx.get("https://example.org/") assert my_route.called assert response.status_code == 204 ``` > Read the [User Guide](https://lundberg.github.io/respx/guide/) for a complete > walk-through. ### pytest + httpx For a neater `pytest` experience, RESPX includes a `respx_mock` _fixture_ for easy `HTTPX` mocking, along with an optional `respx` _marker_ to fine-tune the mock [settings](https://lundberg.github.io/respx/api/#configuration). ```python import httpx import pytest def test_default(respx_mock): respx_mock.get("https://foo.bar/").mock(return_value=httpx.Response(204)) response = httpx.get("https://foo.bar/") assert response.status_code == 204 @pytest.mark.respx(base_url="https://foo.bar") def test_with_marker(respx_mock): respx_mock.get("/baz/").mock(return_value=httpx.Response(204)) response = httpx.get("https://foo.bar/baz/") assert response.status_code == 204 ``` ## Installation Install with pip: ```console $ pip install respx ``` Requires Python 3.7+ and HTTPX 0.21+. See [Changelog](https://github.com/lundberg/respx/blob/master/CHANGELOG.md) for older HTTPX compatibility. %package help Summary: Development documents and examples for respx Provides: python3-respx-doc %description help [![tests](https://img.shields.io/github/workflow/status/lundberg/respx/test?label=tests&logo=github&logoColor=white&style=for-the-badge)](https://github.com/lundberg/respx/actions/workflows/test.yml) [![codecov](https://img.shields.io/codecov/c/github/lundberg/respx?logo=codecov&logoColor=white&style=for-the-badge)](https://codecov.io/gh/lundberg/respx) [![PyPi Version](https://img.shields.io/pypi/v/respx?logo=pypi&logoColor=white&style=for-the-badge)](https://pypi.org/project/respx/) [![Python Versions](https://img.shields.io/pypi/pyversions/respx?logo=python&logoColor=white&style=for-the-badge)](https://pypi.org/project/respx/) ## Documentation Full documentation is available at [lundberg.github.io/respx](https://lundberg.github.io/respx/) ## QuickStart RESPX is a simple, _yet powerful_, utility for mocking out the [HTTPX](https://www.python-httpx.org/), _and [HTTP Core](https://www.encode.io/httpcore/)_, libraries. Start by [patching](https://lundberg.github.io/respx/guide/#mock-httpx) `HTTPX`, using `respx.mock`, then add request [routes](https://lundberg.github.io/respx/guide/#routing-requests) to mock [responses](https://lundberg.github.io/respx/guide/#mocking-responses). ```python import httpx import respx from httpx import Response @respx.mock def test_example(): my_route = respx.get("https://example.org/").mock(return_value=Response(204)) response = httpx.get("https://example.org/") assert my_route.called assert response.status_code == 204 ``` > Read the [User Guide](https://lundberg.github.io/respx/guide/) for a complete > walk-through. ### pytest + httpx For a neater `pytest` experience, RESPX includes a `respx_mock` _fixture_ for easy `HTTPX` mocking, along with an optional `respx` _marker_ to fine-tune the mock [settings](https://lundberg.github.io/respx/api/#configuration). ```python import httpx import pytest def test_default(respx_mock): respx_mock.get("https://foo.bar/").mock(return_value=httpx.Response(204)) response = httpx.get("https://foo.bar/") assert response.status_code == 204 @pytest.mark.respx(base_url="https://foo.bar") def test_with_marker(respx_mock): respx_mock.get("/baz/").mock(return_value=httpx.Response(204)) response = httpx.get("https://foo.bar/baz/") assert response.status_code == 204 ``` ## Installation Install with pip: ```console $ pip install respx ``` Requires Python 3.7+ and HTTPX 0.21+. See [Changelog](https://github.com/lundberg/respx/blob/master/CHANGELOG.md) for older HTTPX compatibility. %prep %autosetup -n respx-0.20.1 %build %py3_build %install %py3_install install -d -m755 %{buildroot}/%{_pkgdocdir} if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi pushd %{buildroot} if [ -d usr/lib ]; then find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/lib64 ]; then find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/bin ]; then find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/sbin ]; then find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst fi touch doclist.lst if [ -d usr/share/man ]; then find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst fi popd mv %{buildroot}/filelist.lst . mv %{buildroot}/doclist.lst . %files -n python3-respx -f filelist.lst %dir %{python3_sitelib}/* %files help -f doclist.lst %{_docdir}/* %changelog * Thu Mar 09 2023 Python_Bot - 0.20.1-1 - Package Spec generated