Running with gitlab-runner 17.7.0 (3153ccc6)
  on Heavy runner on DO CsXVDUbD, system ID: s_a30377c9ccd3
section_start:1735811515:prepare_executor
Preparing the "docker+machine" executor
Using Docker executor with image python:3.11 ...
Pulling docker image python:3.11 ...
Using docker image sha256:e729f76087ee0eac048a797fb9a1789920373e6c614fc9f6cb3cc4c3d046006f for python:3.11 with digest python@sha256:b337e1fd27dbacda505219f713789bf82766694095876769ea10c2d34b4f470b ...
section_end:1735811655:prepare_executor
section_start:1735811655:prepare_script
Preparing environment
Running on runner-csxvdubd-project-6813-concurrent-0 via runner-csxvdubd-apertis-heavy-1735811515-e81b5cb0...
section_end:1735811657:prepare_script
section_start:1735811657:get_sources
Getting source from Git repository
Fetching changes with git depth set to 50...
Initialized empty Git repository in /builds/infrastructure/obs-proxy/.git/
Created fresh repository.
Checking out 12369f55 as detached HEAD (ref is py-3.12-13-test)...

Skipping Git submodules setup
section_end:1735811658:get_sources
section_start:1735811658:step_script
Executing "step_script" stage of the job script
Using docker image sha256:e729f76087ee0eac048a797fb9a1789920373e6c614fc9f6cb3cc4c3d046006f for python:3.11 with digest python@sha256:b337e1fd27dbacda505219f713789bf82766694095876769ea10c2d34b4f470b ...
$ pip install .[test]
Processing /builds/infrastructure/obs-proxy
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Collecting bidict~=0.18 (from obs-proxy==0)
  Downloading bidict-0.23.1-py3-none-any.whl.metadata (8.7 kB)
Collecting httpx~=0.22 (from obs-proxy==0)
  Downloading httpx-0.28.1-py3-none-any.whl.metadata (7.1 kB)
Collecting json-rpc~=1.12 (from obs-proxy==0)
  Downloading json_rpc-1.15.0-py2.py3-none-any.whl.metadata (7.2 kB)
Collecting Quart~=0.18 (from obs-proxy==0)
  Downloading quart-0.20.0-py3-none-any.whl.metadata (4.1 kB)
Collecting Werkzeug~=2.3 (from obs-proxy==0)
  Downloading werkzeug-2.3.8-py3-none-any.whl.metadata (4.1 kB)
Collecting websockets~=10.0 (from obs-proxy==0)
  Downloading websockets-10.4-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (6.4 kB)
Collecting xmltodict~=0.13 (from obs-proxy==0)
  Downloading xmltodict-0.14.2-py2.py3-none-any.whl.metadata (8.0 kB)
Collecting aiofiles~=0.8 (from obs-proxy==0)
  Downloading aiofiles-0.8.0-py3-none-any.whl.metadata (7.0 kB)
Collecting jinja2~=3.0.0 (from obs-proxy==0)
  Downloading Jinja2-3.0.3-py3-none-any.whl.metadata (3.5 kB)
Collecting structlog~=22.3 (from obs-proxy==0)
  Downloading structlog-22.3.0-py3-none-any.whl.metadata (8.4 kB)
Collecting rich (from obs-proxy==0)
  Downloading rich-13.9.4-py3-none-any.whl.metadata (18 kB)
Collecting pytest>=6 (from obs-proxy==0)
  Downloading pytest-8.3.4-py3-none-any.whl.metadata (7.5 kB)
Collecting pytest-asyncio>=0.17 (from obs-proxy==0)
  Downloading pytest_asyncio-0.25.1-py3-none-any.whl.metadata (3.9 kB)
Collecting pytest-httpx>=0.20 (from obs-proxy==0)
  Downloading pytest_httpx-0.35.0-py3-none-any.whl.metadata (35 kB)
Collecting anyio (from httpx~=0.22->obs-proxy==0)
  Downloading anyio-4.7.0-py3-none-any.whl.metadata (4.7 kB)
Collecting certifi (from httpx~=0.22->obs-proxy==0)
  Downloading certifi-2024.12.14-py3-none-any.whl.metadata (2.3 kB)
Collecting httpcore==1.* (from httpx~=0.22->obs-proxy==0)
  Downloading httpcore-1.0.7-py3-none-any.whl.metadata (21 kB)
Collecting idna (from httpx~=0.22->obs-proxy==0)
  Downloading idna-3.10-py3-none-any.whl.metadata (10 kB)
Collecting h11<0.15,>=0.13 (from httpcore==1.*->httpx~=0.22->obs-proxy==0)
  Downloading h11-0.14.0-py3-none-any.whl.metadata (8.2 kB)
Collecting MarkupSafe>=2.0 (from jinja2~=3.0.0->obs-proxy==0)
  Downloading MarkupSafe-3.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (4.0 kB)
Collecting iniconfig (from pytest>=6->obs-proxy==0)
  Downloading iniconfig-2.0.0-py3-none-any.whl.metadata (2.6 kB)
Collecting packaging (from pytest>=6->obs-proxy==0)
  Downloading packaging-24.2-py3-none-any.whl.metadata (3.2 kB)
Collecting pluggy<2,>=1.5 (from pytest>=6->obs-proxy==0)
  Downloading pluggy-1.5.0-py3-none-any.whl.metadata (4.8 kB)
Collecting blinker>=1.6 (from Quart~=0.18->obs-proxy==0)
  Downloading blinker-1.9.0-py3-none-any.whl.metadata (1.6 kB)
Collecting click>=8.0 (from Quart~=0.18->obs-proxy==0)
  Downloading click-8.1.8-py3-none-any.whl.metadata (2.3 kB)
Collecting flask>=3.0 (from Quart~=0.18->obs-proxy==0)
  Downloading flask-3.1.0-py3-none-any.whl.metadata (2.7 kB)
Collecting hypercorn>=0.11.2 (from Quart~=0.18->obs-proxy==0)
  Downloading hypercorn-0.17.3-py3-none-any.whl.metadata (5.4 kB)
Collecting itsdangerous (from Quart~=0.18->obs-proxy==0)
  Downloading itsdangerous-2.2.0-py3-none-any.whl.metadata (1.9 kB)
INFO: pip is looking at multiple versions of quart to determine which version is compatible with other requirements. This could take a while.
Collecting Quart~=0.18 (from obs-proxy==0)
  Downloading quart-0.19.9-py3-none-any.whl.metadata (5.7 kB)
  Downloading quart-0.19.8-py3-none-any.whl.metadata (5.7 kB)
  Downloading quart-0.19.7-py3-none-any.whl.metadata (5.7 kB)
  Downloading quart-0.19.6-py3-none-any.whl.metadata (5.7 kB)
  Downloading quart-0.19.5-py3-none-any.whl.metadata (5.7 kB)
  Downloading quart-0.19.4-py3-none-any.whl.metadata (5.7 kB)
  Downloading quart-0.19.3-py3-none-any.whl.metadata (5.6 kB)
INFO: pip is still looking at multiple versions of quart to determine which version is compatible with other requirements. This could take a while.
  Downloading quart-0.19.2-py3-none-any.whl.metadata (5.6 kB)
  Downloading quart-0.19.1-py3-none-any.whl.metadata (5.6 kB)
  Downloading quart-0.19.0-py3-none-any.whl.metadata (5.6 kB)
  Downloading quart-0.18.4-py3-none-any.whl.metadata (5.9 kB)
Collecting blinker<1.6 (from Quart~=0.18->obs-proxy==0)
  Downloading blinker-1.5-py2.py3-none-any.whl.metadata (1.8 kB)
Collecting markdown-it-py>=2.2.0 (from rich->obs-proxy==0)
  Downloading markdown_it_py-3.0.0-py3-none-any.whl.metadata (6.9 kB)
Collecting pygments<3.0.0,>=2.13.0 (from rich->obs-proxy==0)
  Downloading pygments-2.18.0-py3-none-any.whl.metadata (2.5 kB)
Collecting h2>=3.1.0 (from hypercorn>=0.11.2->Quart~=0.18->obs-proxy==0)
  Downloading h2-4.1.0-py3-none-any.whl.metadata (3.6 kB)
Collecting priority (from hypercorn>=0.11.2->Quart~=0.18->obs-proxy==0)
  Downloading priority-2.0.0-py3-none-any.whl.metadata (6.6 kB)
Collecting wsproto>=0.14.0 (from hypercorn>=0.11.2->Quart~=0.18->obs-proxy==0)
  Downloading wsproto-1.2.0-py3-none-any.whl.metadata (5.6 kB)
Collecting mdurl~=0.1 (from markdown-it-py>=2.2.0->rich->obs-proxy==0)
  Downloading mdurl-0.1.2-py3-none-any.whl.metadata (1.6 kB)
Collecting sniffio>=1.1 (from anyio->httpx~=0.22->obs-proxy==0)
  Downloading sniffio-1.3.1-py3-none-any.whl.metadata (3.9 kB)
Collecting typing_extensions>=4.5 (from anyio->httpx~=0.22->obs-proxy==0)
  Downloading typing_extensions-4.12.2-py3-none-any.whl.metadata (3.0 kB)
Collecting hyperframe<7,>=6.0 (from h2>=3.1.0->hypercorn>=0.11.2->Quart~=0.18->obs-proxy==0)
  Downloading hyperframe-6.0.1-py3-none-any.whl.metadata (2.7 kB)
Collecting hpack<5,>=4.0 (from h2>=3.1.0->hypercorn>=0.11.2->Quart~=0.18->obs-proxy==0)
  Downloading hpack-4.0.0-py3-none-any.whl.metadata (2.5 kB)
Downloading aiofiles-0.8.0-py3-none-any.whl (13 kB)
Downloading bidict-0.23.1-py3-none-any.whl (32 kB)
Downloading httpx-0.28.1-py3-none-any.whl (73 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 73.5/73.5 kB 8.7 MB/s eta 0:00:00
Downloading httpcore-1.0.7-py3-none-any.whl (78 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 78.6/78.6 kB 8.9 MB/s eta 0:00:00
Downloading Jinja2-3.0.3-py3-none-any.whl (133 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 133.6/133.6 kB 14.5 MB/s eta 0:00:00
Downloading json_rpc-1.15.0-py2.py3-none-any.whl (39 kB)
Downloading pytest-8.3.4-py3-none-any.whl (343 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 343.1/343.1 kB 29.3 MB/s eta 0:00:00
Downloading pytest_asyncio-0.25.1-py3-none-any.whl (19 kB)
Downloading pytest_httpx-0.35.0-py3-none-any.whl (19 kB)
Downloading quart-0.18.4-py3-none-any.whl (100 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100.2/100.2 kB 11.0 MB/s eta 0:00:00
Downloading structlog-22.3.0-py3-none-any.whl (61 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 61.7/61.7 kB 6.3 MB/s eta 0:00:00
Downloading websockets-10.4-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (107 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 107.4/107.4 kB 9.8 MB/s eta 0:00:00
Downloading werkzeug-2.3.8-py3-none-any.whl (242 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 242.3/242.3 kB 26.2 MB/s eta 0:00:00
Downloading xmltodict-0.14.2-py2.py3-none-any.whl (10.0 kB)
Downloading rich-13.9.4-py3-none-any.whl (242 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 242.4/242.4 kB 23.6 MB/s eta 0:00:00
Downloading blinker-1.5-py2.py3-none-any.whl (12 kB)
Downloading click-8.1.8-py3-none-any.whl (98 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 98.2/98.2 kB 9.5 MB/s eta 0:00:00
Downloading hypercorn-0.17.3-py3-none-any.whl (61 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 61.7/61.7 kB 7.1 MB/s eta 0:00:00
Downloading markdown_it_py-3.0.0-py3-none-any.whl (87 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 87.5/87.5 kB 11.9 MB/s eta 0:00:00
Downloading MarkupSafe-3.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (23 kB)
Downloading pluggy-1.5.0-py3-none-any.whl (20 kB)
Downloading pygments-2.18.0-py3-none-any.whl (1.2 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.2/1.2 MB 70.9 MB/s eta 0:00:00
Downloading anyio-4.7.0-py3-none-any.whl (93 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 93.1/93.1 kB 11.2 MB/s eta 0:00:00
Downloading idna-3.10-py3-none-any.whl (70 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 70.4/70.4 kB 8.9 MB/s eta 0:00:00
Downloading certifi-2024.12.14-py3-none-any.whl (164 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 164.9/164.9 kB 21.4 MB/s eta 0:00:00
Downloading iniconfig-2.0.0-py3-none-any.whl (5.9 kB)
Downloading itsdangerous-2.2.0-py3-none-any.whl (16 kB)
Downloading packaging-24.2-py3-none-any.whl (65 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 65.5/65.5 kB 8.1 MB/s eta 0:00:00
Downloading h11-0.14.0-py3-none-any.whl (58 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 58.3/58.3 kB 6.8 MB/s eta 0:00:00
Downloading h2-4.1.0-py3-none-any.whl (57 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 57.5/57.5 kB 5.8 MB/s eta 0:00:00
Downloading mdurl-0.1.2-py3-none-any.whl (10.0 kB)
Downloading sniffio-1.3.1-py3-none-any.whl (10 kB)
Downloading typing_extensions-4.12.2-py3-none-any.whl (37 kB)
Downloading wsproto-1.2.0-py3-none-any.whl (24 kB)
Downloading priority-2.0.0-py3-none-any.whl (8.9 kB)
Downloading hpack-4.0.0-py3-none-any.whl (32 kB)
Downloading hyperframe-6.0.1-py3-none-any.whl (12 kB)
Building wheels for collected packages: obs-proxy
  Building wheel for obs-proxy (setup.py): started
  Building wheel for obs-proxy (setup.py): finished with status 'done'
  Created wheel for obs-proxy: filename=obs_proxy-0-py3-none-any.whl size=37783 sha256=a0cb87fd694ed16cb619e0914147e819c8c98d33c5b44373a272aa2321a94ed1
  Stored in directory: /root/.cache/pip/wheels/1d/82/61/3a9e1003108301faa4e691a3ab5412452257429146cca0c47e
Successfully built obs-proxy
Installing collected packages: json-rpc, xmltodict, websockets, typing_extensions, structlog, sniffio, pygments, priority, pluggy, packaging, mdurl, MarkupSafe, itsdangerous, iniconfig, idna, hyperframe, hpack, h11, click, certifi, blinker, bidict, aiofiles, wsproto, Werkzeug, pytest, markdown-it-py, jinja2, httpcore, h2, anyio, rich, pytest-asyncio, hypercorn, httpx, Quart, pytest-httpx, obs-proxy
Successfully installed MarkupSafe-3.0.2 Quart-0.18.4 Werkzeug-2.3.8 aiofiles-0.8.0 anyio-4.7.0 bidict-0.23.1 blinker-1.5 certifi-2024.12.14 click-8.1.8 h11-0.14.0 h2-4.1.0 hpack-4.0.0 httpcore-1.0.7 httpx-0.28.1 hypercorn-0.17.3 hyperframe-6.0.1 idna-3.10 iniconfig-2.0.0 itsdangerous-2.2.0 jinja2-3.0.3 json-rpc-1.15.0 markdown-it-py-3.0.0 mdurl-0.1.2 obs-proxy-0 packaging-24.2 pluggy-1.5.0 priority-2.0.0 pygments-2.18.0 pytest-8.3.4 pytest-asyncio-0.25.1 pytest-httpx-0.35.0 rich-13.9.4 sniffio-1.3.1 structlog-22.3.0 typing_extensions-4.12.2 websockets-10.4 wsproto-1.2.0 xmltodict-0.14.2
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv

[notice] A new release of pip is available: 24.0 -> 24.3.1
[notice] To update, run: pip install --upgrade pip
$ python setup.py build sdist bdist
/usr/local/lib/python3.11/site-packages/setuptools/config/setupcfg.py:508: SetuptoolsDeprecationWarning: The license_file parameter is deprecated, use license_files instead.
  warnings.warn(msg, warning_class)
running build
running build_py
running sdist
running egg_info
writing obs_proxy.egg-info/PKG-INFO
writing dependency_links to obs_proxy.egg-info/dependency_links.txt
writing entry points to obs_proxy.egg-info/entry_points.txt
writing requirements to obs_proxy.egg-info/requires.txt
writing top-level names to obs_proxy.egg-info/top_level.txt
reading manifest file 'obs_proxy.egg-info/SOURCES.txt'
adding license file 'COPYING.MPL'
writing manifest file 'obs_proxy.egg-info/SOURCES.txt'
running check
creating obs-proxy-0
creating obs-proxy-0/obs_proxy
creating obs-proxy-0/obs_proxy.egg-info
creating obs-proxy-0/obs_proxy/chunked_uploads
copying files to obs-proxy-0...
copying COPYING.MPL -> obs-proxy-0
copying README.md -> obs-proxy-0
copying proxy.conf -> obs-proxy-0
copying setup.cfg -> obs-proxy-0
copying setup.py -> obs-proxy-0
copying obs_proxy/__init__.py -> obs-proxy-0/obs_proxy
copying obs_proxy/async_jsonrpc.py -> obs-proxy-0/obs_proxy
copying obs_proxy/client.py -> obs-proxy-0/obs_proxy
copying obs_proxy/config.py -> obs-proxy-0/obs_proxy
copying obs_proxy/repserver.py -> obs-proxy-0/obs_proxy
copying obs_proxy/rpcqueue.py -> obs-proxy-0/obs_proxy
copying obs_proxy/server.py -> obs-proxy-0/obs_proxy
copying obs_proxy/utils.py -> obs-proxy-0/obs_proxy
copying obs_proxy/worker.py -> obs-proxy-0/obs_proxy
copying obs_proxy/wsclient.py -> obs-proxy-0/obs_proxy
copying obs_proxy.egg-info/PKG-INFO -> obs-proxy-0/obs_proxy.egg-info
copying obs_proxy.egg-info/SOURCES.txt -> obs-proxy-0/obs_proxy.egg-info
copying obs_proxy.egg-info/dependency_links.txt -> obs-proxy-0/obs_proxy.egg-info
copying obs_proxy.egg-info/entry_points.txt -> obs-proxy-0/obs_proxy.egg-info
copying obs_proxy.egg-info/requires.txt -> obs-proxy-0/obs_proxy.egg-info
copying obs_proxy.egg-info/top_level.txt -> obs-proxy-0/obs_proxy.egg-info
copying obs_proxy/chunked_uploads/__init__.py -> obs-proxy-0/obs_proxy/chunked_uploads
copying obs_proxy/chunked_uploads/client.py -> obs-proxy-0/obs_proxy/chunked_uploads
copying obs_proxy/chunked_uploads/routes.py -> obs-proxy-0/obs_proxy/chunked_uploads
copying obs_proxy/chunked_uploads/utils.py -> obs-proxy-0/obs_proxy/chunked_uploads
Writing obs-proxy-0/setup.cfg
creating dist
Creating tar archive
removing 'obs-proxy-0' (and everything under it)
running bdist
running bdist_dumb
/usr/local/lib/python3.11/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
installing to build/bdist.linux-x86_64/dumb
running install
running install_lib
creating build/bdist.linux-x86_64/dumb
creating build/bdist.linux-x86_64/dumb/usr
creating build/bdist.linux-x86_64/dumb/usr/local
creating build/bdist.linux-x86_64/dumb/usr/local/lib
creating build/bdist.linux-x86_64/dumb/usr/local/lib/python3.11
creating build/bdist.linux-x86_64/dumb/usr/local/lib/python3.11/site-packages
creating build/bdist.linux-x86_64/dumb/usr/local/lib/python3.11/site-packages/obs_proxy
copying build/lib/obs_proxy/server.py -> build/bdist.linux-x86_64/dumb/usr/local/lib/python3.11/site-packages/obs_proxy
creating build/bdist.linux-x86_64/dumb/usr/local/lib/python3.11/site-packages/obs_proxy/chunked_uploads
copying build/lib/obs_proxy/chunked_uploads/client.py -> build/bdist.linux-x86_64/dumb/usr/local/lib/python3.11/site-packages/obs_proxy/chunked_uploads
copying build/lib/obs_proxy/chunked_uploads/utils.py -> build/bdist.linux-x86_64/dumb/usr/local/lib/python3.11/site-packages/obs_proxy/chunked_uploads
copying build/lib/obs_proxy/chunked_uploads/__init__.py -> build/bdist.linux-x86_64/dumb/usr/local/lib/python3.11/site-packages/obs_proxy/chunked_uploads
copying build/lib/obs_proxy/chunked_uploads/routes.py -> build/bdist.linux-x86_64/dumb/usr/local/lib/python3.11/site-packages/obs_proxy/chunked_uploads
copying build/lib/obs_proxy/worker.py -> build/bdist.linux-x86_64/dumb/usr/local/lib/python3.11/site-packages/obs_proxy
copying build/lib/obs_proxy/rpcqueue.py -> build/bdist.linux-x86_64/dumb/usr/local/lib/python3.11/site-packages/obs_proxy
copying build/lib/obs_proxy/repserver.py -> build/bdist.linux-x86_64/dumb/usr/local/lib/python3.11/site-packages/obs_proxy
copying build/lib/obs_proxy/wsclient.py -> build/bdist.linux-x86_64/dumb/usr/local/lib/python3.11/site-packages/obs_proxy
copying build/lib/obs_proxy/config.py -> build/bdist.linux-x86_64/dumb/usr/local/lib/python3.11/site-packages/obs_proxy
copying build/lib/obs_proxy/async_jsonrpc.py -> build/bdist.linux-x86_64/dumb/usr/local/lib/python3.11/site-packages/obs_proxy
copying build/lib/obs_proxy/client.py -> build/bdist.linux-x86_64/dumb/usr/local/lib/python3.11/site-packages/obs_proxy
copying build/lib/obs_proxy/utils.py -> build/bdist.linux-x86_64/dumb/usr/local/lib/python3.11/site-packages/obs_proxy
copying build/lib/obs_proxy/__init__.py -> build/bdist.linux-x86_64/dumb/usr/local/lib/python3.11/site-packages/obs_proxy
byte-compiling build/bdist.linux-x86_64/dumb/usr/local/lib/python3.11/site-packages/obs_proxy/server.py to server.cpython-311.pyc
byte-compiling build/bdist.linux-x86_64/dumb/usr/local/lib/python3.11/site-packages/obs_proxy/chunked_uploads/client.py to client.cpython-311.pyc
byte-compiling build/bdist.linux-x86_64/dumb/usr/local/lib/python3.11/site-packages/obs_proxy/chunked_uploads/utils.py to utils.cpython-311.pyc
byte-compiling build/bdist.linux-x86_64/dumb/usr/local/lib/python3.11/site-packages/obs_proxy/chunked_uploads/__init__.py to __init__.cpython-311.pyc
byte-compiling build/bdist.linux-x86_64/dumb/usr/local/lib/python3.11/site-packages/obs_proxy/chunked_uploads/routes.py to routes.cpython-311.pyc
byte-compiling build/bdist.linux-x86_64/dumb/usr/local/lib/python3.11/site-packages/obs_proxy/worker.py to worker.cpython-311.pyc
byte-compiling build/bdist.linux-x86_64/dumb/usr/local/lib/python3.11/site-packages/obs_proxy/rpcqueue.py to rpcqueue.cpython-311.pyc
byte-compiling build/bdist.linux-x86_64/dumb/usr/local/lib/python3.11/site-packages/obs_proxy/repserver.py to repserver.cpython-311.pyc
byte-compiling build/bdist.linux-x86_64/dumb/usr/local/lib/python3.11/site-packages/obs_proxy/wsclient.py to wsclient.cpython-311.pyc
byte-compiling build/bdist.linux-x86_64/dumb/usr/local/lib/python3.11/site-packages/obs_proxy/config.py to config.cpython-311.pyc
byte-compiling build/bdist.linux-x86_64/dumb/usr/local/lib/python3.11/site-packages/obs_proxy/async_jsonrpc.py to async_jsonrpc.cpython-311.pyc
byte-compiling build/bdist.linux-x86_64/dumb/usr/local/lib/python3.11/site-packages/obs_proxy/client.py to client.cpython-311.pyc
byte-compiling build/bdist.linux-x86_64/dumb/usr/local/lib/python3.11/site-packages/obs_proxy/utils.py to utils.cpython-311.pyc
byte-compiling build/bdist.linux-x86_64/dumb/usr/local/lib/python3.11/site-packages/obs_proxy/__init__.py to __init__.cpython-311.pyc
running install_data
creating build/bdist.linux-x86_64/dumb/usr/local/share
creating build/bdist.linux-x86_64/dumb/usr/local/share/doc
creating build/bdist.linux-x86_64/dumb/usr/local/share/doc/obs-proxy
creating build/bdist.linux-x86_64/dumb/usr/local/share/doc/obs-proxy/examples
copying proxy.conf -> build/bdist.linux-x86_64/dumb/usr/local/share/doc/obs-proxy/examples
running install_egg_info
Copying obs_proxy.egg-info to build/bdist.linux-x86_64/dumb/usr/local/lib/python3.11/site-packages/obs_proxy-0-py3.11.egg-info
running install_scripts
Installing obs-proxy-client script to build/bdist.linux-x86_64/dumb/usr/local/bin
Installing obs-proxy-server script to build/bdist.linux-x86_64/dumb/usr/local/bin
Creating tar archive
removing 'build/bdist.linux-x86_64/dumb' (and everything under it)
$ pytest --junit-xml=test-results.xml -v
/usr/local/lib/python3.11/site-packages/pytest_asyncio/plugin.py:207: PytestDeprecationWarning: The configuration option "asyncio_default_fixture_loop_scope" is unset.
The event loop scope for asynchronous fixtures will default to the fixture caching scope. Future versions of pytest-asyncio will default the loop scope for asynchronous fixtures to function scope. Set the default fixture loop scope explicitly in order to avoid unexpected behavior in the future. Valid fixture loop scopes are: "function", "class", "module", "package", "session"

  warnings.warn(PytestDeprecationWarning(_DEFAULT_FIXTURE_LOOP_SCOPE_UNSET))
============================= test session starts ==============================
platform linux -- Python 3.11.11, pytest-8.3.4, pluggy-1.5.0 -- /usr/local/bin/python3.11
cachedir: .pytest_cache
rootdir: /builds/infrastructure/obs-proxy
configfile: setup.cfg
plugins: httpx-0.35.0, asyncio-0.25.1, anyio-4.7.0
asyncio: mode=Mode.AUTO, asyncio_default_fixture_loop_scope=None
collecting ... collected 30 items

obs_proxy/server.py::obs_proxy.server.proxied_uri PASSED                 [  3%]
obs_proxy/utils.py::obs_proxy.utils.shorten PASSED                       [  6%]
obs_proxy/worker.py::obs_proxy.worker.Worker.fromxml PASSED              [ 10%]
tests/chunked_uploads/test_upload_chunked.py::test_upload_chunked_timeout FAILED [ 13%]
tests/chunked_uploads/test_upload_chunked.py::test_upload_chunked_timeout ERROR [ 13%]
tests/chunked_uploads/test_upload_chunked.py::test_upload_chunked_wrong_response FAILED [ 16%]
tests/chunked_uploads/test_upload_chunked.py::test_upload_chunked_wrong_response ERROR [ 16%]
tests/chunked_uploads/test_upload_chunked.py::test_upload_chunked_transient_server_error FAILED [ 20%]
tests/chunked_uploads/test_upload_chunked.py::test_upload_chunked_transient_server_error ERROR [ 20%]
tests/chunked_uploads/test_upload_chunked.py::test_upload_chunked_complete FAILED [ 23%]
tests/chunked_uploads/test_upload_chunked.py::test_upload_chunked_complete ERROR [ 23%]
tests/chunked_uploads/test_upload_client_server.py::test_client_uploading_to_server PASSED [ 26%]
tests/chunked_uploads/test_upload_endpoint.py::test_smoke PASSED         [ 30%]
tests/chunked_uploads/test_upload_endpoint.py::test_invalid_jobid PASSED [ 33%]
tests/chunked_uploads/test_upload_endpoint.py::test_missing_content_length PASSED [ 36%]
tests/chunked_uploads/test_upload_endpoint.py::test_patch_range_parser[bytes 123-233/999-400-length must match] PASSED [ 40%]
tests/chunked_uploads/test_upload_endpoint.py::test_patch_range_parser[furlongs 123-233/999-400-Unsupported unit] PASSED [ 43%]
tests/chunked_uploads/test_upload_endpoint.py::test_patch_range_parser[*/0-400-A range is required] PASSED [ 46%]
tests/chunked_uploads/test_upload_endpoint.py::test_patch_sequential_upload PASSED [ 50%]
tests/chunked_uploads/test_upload_endpoint.py::test_patch_incomplete_upload PASSED [ 53%]
tests/test_auth.py::test_userpass PASSED                                 [ 56%]
tests/test_auth.py::test_token PASSED                                    [ 60%]
tests/test_config.py::test_config_parser PASSED                          [ 63%]
tests/test_config.py::test_config_parser_dict PASSED                     [ 66%]
tests/test_config.py::test_mini_config PASSED                            [ 70%]
tests/test_config.py::test_mini_config_update PASSED                     [ 73%]
tests/test_rpcqueue.py::test_rpcqueue PASSED                             [ 76%]
tests/upload/test_upload.py::test_upload_data_no_error PASSED            [ 80%]
tests/upload/test_upload.py::test_upload_data_req_error PASSED           [ 83%]
tests/upload/test_upload.py::test_upload_data_no_error_streaming PASSED  [ 86%]
tests/upload/test_upload_five_gigazeroes.py::test_getbinaries PASSED     [ 90%]
tests/upload/test_upload_five_gigazeroes.py::test_five_gigazero_upload PASSED [ 93%]
tests/upload/test_upload_prefix.py::test_getbinaries PASSED              [ 96%]
tests/upload/test_upload_prefix.py::test_five_kilozero_upload PASSED     [100%]

==================================== ERRORS ====================================
_______________ ERROR at teardown of test_upload_chunked_timeout _______________

monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7f51bc38eb10>
request = <SubRequest 'httpx_mock' for <Coroutine test_upload_chunked_timeout>>

    @pytest.fixture
    def httpx_mock(
        monkeypatch: MonkeyPatch,
        request: FixtureRequest,
    ) -> Generator[HTTPXMock, None, None]:
        options = {}
        for marker in request.node.iter_markers("httpx_mock"):
            options = marker.kwargs | options
        __tracebackhide__ = methodcaller("errisinstance", TypeError)
        options = _HTTPXMockOptions(**options)
    
        mock = HTTPXMock(options)
    
        # Mock synchronous requests
        real_handle_request = httpx.HTTPTransport.handle_request
    
        def mocked_handle_request(
            transport: httpx.HTTPTransport, request: httpx.Request
        ) -> httpx.Response:
            if options.should_mock(request):
                return mock._handle_request(transport, request)
            return real_handle_request(transport, request)
    
        monkeypatch.setattr(
            httpx.HTTPTransport,
            "handle_request",
            mocked_handle_request,
        )
    
        # Mock asynchronous requests
        real_handle_async_request = httpx.AsyncHTTPTransport.handle_async_request
    
        async def mocked_handle_async_request(
            transport: httpx.AsyncHTTPTransport, request: httpx.Request
        ) -> httpx.Response:
            if options.should_mock(request):
                return await mock._handle_async_request(transport, request)
            return await real_handle_async_request(transport, request)
    
        monkeypatch.setattr(
            httpx.AsyncHTTPTransport,
            "handle_async_request",
            mocked_handle_async_request,
        )
    
        yield mock
        try:
>           mock._assert_options()

/usr/local/lib/python3.11/site-packages/pytest_httpx/__init__.py:67: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <pytest_httpx._httpx_mock.HTTPXMock object at 0x7f51bba1bf10>

    def _assert_options(self) -> None:
        callbacks_not_executed = [
            matcher for matcher, _ in self._callbacks if matcher.should_have_matched()
        ]
        matchers_description = "\n".join(
            [f"- {matcher}" for matcher in callbacks_not_executed]
        )
    
>       assert not callbacks_not_executed, (
            "The following responses are mocked but not requested:\n"
            f"{matchers_description}\n"
            "\n"
            "If this is on purpose, refer to https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-more-responses-than-what-will-be-requested"
        )
E       AssertionError: The following responses are mocked but not requested:
E         - Match any request with {'Patch-Content-Range': 'bytes 2621440-3145727/4194304'} headers
E         
E         If this is on purpose, refer to https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-more-responses-than-what-will-be-requested
E       assert not [<pytest_httpx._request_matcher._RequestMatcher object at 0x7f51bba1b950>]

/usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:319: AssertionError
----------------------------- Captured stdout call -----------------------------
2025-01-02 09:54:35 [debug    ] patching                       attempt=0 content_range=<ContentRange 'bytes 0-524287/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 09:54:35 [debug    ] patch result                   result=<Response [200 OK]>
2025-01-02 09:54:35 [debug    ] patching                       attempt=0 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 09:54:35 [error    ] retrying                       attempt=0
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /builds/infrastructure/obs-proxy/obs_proxy/chunked_uploads/client.py:84 in   │
│ upload_chunked                                                               │
│                                                                              │
│    81 │   │   │   for attempt in range(MAX_ATTEMPTS):                        │
│    82 │   │   │   │   try:                                                   │
│    83 │   │   │   │   │   logger.debug("patching", uri=uri, size=len(chunk), │
│ ❱  84 │   │   │   │   │   r = await client.patch(                            │
│    85 │   │   │   │   │   │   uri,                                           │
│    86 │   │   │   │   │   │   content=chunk,                                 │
│    87 │   │   │   │   │   │   headers=chunk_headers,                         │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       attempt = 0                                                        │ │
│ │         chunk = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\… │ │
│ │ chunk_headers = {                                                        │ │
│ │                 │   'Patch-Content-Range': 'bytes                        │ │
│ │                 524288-1048575/4194304',                                 │ │
│ │                 │   'Content-Length': '524288'                           │ │
│ │                 }                                                        │ │
│ │    chunk_size = 524288                                                   │ │
│ │        client = <httpx.AsyncClient object at 0x7f51bba19110>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f51bba1b0d0> wrapping <_io.BufferedReader          │ │
│ │                 name='/tmp/pytest-of-root/pytest-0/test_upload_chunked_… │ │
│ │             e = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Patch-Content-Range': 'bytes 524288-1048575/4194304',  │ │
│ │                 'Content-Length': '524288'} headers amongst:\n- Match    │ │
│ │                 any request with {'Patch-Content-Range': 'bytes          │ │
│ │                 2621440-3145727/4194304'} headers\n- Already matched any │ │
│ │                 request with {'Content-Length': '524288'} headers\n\nIf  │ │
│ │                 you wanted to reuse an already matched response instead  │ │
│ │                 of registering it again, refer to                        │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │           exc = None                                                     │ │
│ │   file_hasher = <md5 _hashlib.HASH object @ 0x7f51bbaadd10>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1933 in patch       │
│                                                                              │
│   1930 │   │                                                                 │
│   1931 │   │   **Parameters**: See `httpx.request`.                          │
│   1932 │   │   """                                                           │
│ ❱ 1933 │   │   return await self.request(                                    │
│   1934 │   │   │   "PATCH",                                                  │
│   1935 │   │   │   url,                                                      │
│   1936 │   │   │   content=content,                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bba19110>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1540 in request     │
│                                                                              │
│   1537 │   │   │   timeout=timeout,                                          │
│   1538 │   │   │   extensions=extensions,                                    │
│   1539 │   │   )                                                             │
│ ❱ 1540 │   │   return await self.send(request, auth=auth, follow_redirects=f │
│   1541 │                                                                     │
│   1542 │   @asynccontextmanager                                              │
│   1543 │   async def stream(                                                 │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           method = 'PATCH'                                               │ │
│ │           params = None                                                  │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bba19110>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1629 in send        │
│                                                                              │
│   1626 │   │                                                                 │
│   1627 │   │   auth = self._build_request_auth(request, auth)                │
│   1628 │   │                                                                 │
│ ❱ 1629 │   │   response = await self._send_handling_auth(                    │
│   1630 │   │   │   request,                                                  │
│   1631 │   │   │   auth=auth,                                                │
│   1632 │   │   │   follow_redirects=follow_redirects,                        │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │             auth = <httpx.Auth object at 0x7f51bba1a2d0>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51bba19110>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1657 in             │
│ _send_handling_auth                                                          │
│                                                                              │
│   1654 │   │   │   request = await auth_flow.__anext__()                     │
│   1655 │   │   │                                                             │
│   1656 │   │   │   while True:                                               │
│ ❱ 1657 │   │   │   │   response = await self._send_handling_redirects(       │
│   1658 │   │   │   │   │   request,                                          │
│   1659 │   │   │   │   │   follow_redirects=follow_redirects,                │
│   1660 │   │   │   │   │   history=history,                                  │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx.Auth object at 0x7f51bba1a2d0>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f51bbb7e200>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bba19110>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1694 in             │
│ _send_handling_redirects                                                     │
│                                                                              │
│   1691 │   │   │   for hook in self._event_hooks["request"]:                 │
│   1692 │   │   │   │   await hook(request)                                   │
│   1693 │   │   │                                                             │
│ ❱ 1694 │   │   │   response = await self._send_single_request(request)       │
│   1695 │   │   │   try:                                                      │
│   1696 │   │   │   │   for hook in self._event_hooks["response"]:            │
│   1697 │   │   │   │   │   await hook(response)                              │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │ follow_redirects = False                                           │       │
│ │          history = []                                              │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51bba19110>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1730 in             │
│ _send_single_request                                                         │
│                                                                              │
│   1727 │   │   │   )                                                         │
│   1728 │   │                                                                 │
│   1729 │   │   with request_context(request=request):                        │
│ ❱ 1730 │   │   │   response = await transport.handle_async_request(request)  │
│   1731 │   │                                                                 │
│   1732 │   │   assert isinstance(response.stream, AsyncByteStream)           │
│   1733 │   │   response.request = request                                    │
│                                                                              │
│ ╭──────────────────────────── locals ─────────────────────────────╮          │
│ │   request = <Request('PATCH', 'http://example.org/upload')>     │          │
│ │      self = <httpx.AsyncClient object at 0x7f51bba19110>        │          │
│ │     start = 136.800514143                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51bba18650> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/__init__.py:56 in       │
│ mocked_handle_async_request                                                  │
│                                                                              │
│   53 │   │   transport: httpx.AsyncHTTPTransport, request: httpx.Request     │
│   54 │   ) -> httpx.Response:                                                │
│   55 │   │   if options.should_mock(request):                                │
│ ❱ 56 │   │   │   return await mock._handle_async_request(transport, request) │
│   57 │   │   return await real_handle_async_request(transport, request)      │
│   58 │                                                                       │
│   59 │   monkeypatch.setattr(                                                │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │      mock = <pytest_httpx._httpx_mock.HTTPXMock object at                │ │
│ │             0x7f51bba1bf10>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f51bba1b790>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51bba18650>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:183 in   │
│ _handle_async_request                                                        │
│                                                                              │
│   180 │   │   │   │   │   response = await response                          │
│   181 │   │   │   │   return _unread(response)                               │
│   182 │   │                                                                  │
│ ❱ 183 │   │   self._request_not_matched(real_transport, request)             │
│   184 │                                                                      │
│   185 │   def _request_not_matched(                                          │
│   186 │   │   self,                                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       callback = None                                                    │ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51bba18650>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51bba1bf10>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:191 in   │
│ _request_not_matched                                                         │
│                                                                              │
│   188 │   │   request: httpx.Request,                                        │
│   189 │   ) -> NoReturn:                                                     │
│   190 │   │   self._requests_not_matched.append(request)                     │
│ ❱ 191 │   │   raise httpx.TimeoutException(                                  │
│   192 │   │   │   self._explain_that_no_response_was_found(real_transport, r │
│   193 │   │   │   request=request,                                           │
│   194 │   │   )                                                              │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51bba18650>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51bba1bf10>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
TimeoutException: No response can be found for PATCH request on 
http://example.org/upload with {'Patch-Content-Range': 'bytes 
524288-1048575/4194304', 'Content-Length': '524288'} headers amongst:
- Match any request with {'Patch-Content-Range': 'bytes 
2621440-3145727/4194304'} headers
- Already matched any request with {'Content-Length': '524288'} headers

If you wanted to reuse an already matched response instead of registering it 
again, refer to 
https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-
a-response-for-more-than-one-request

2025-01-02 09:54:36 [debug    ] patching                       attempt=1 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 09:54:36 [error    ] retrying                       attempt=1
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /builds/infrastructure/obs-proxy/obs_proxy/chunked_uploads/client.py:84 in   │
│ upload_chunked                                                               │
│                                                                              │
│    81 │   │   │   for attempt in range(MAX_ATTEMPTS):                        │
│    82 │   │   │   │   try:                                                   │
│    83 │   │   │   │   │   logger.debug("patching", uri=uri, size=len(chunk), │
│ ❱  84 │   │   │   │   │   r = await client.patch(                            │
│    85 │   │   │   │   │   │   uri,                                           │
│    86 │   │   │   │   │   │   content=chunk,                                 │
│    87 │   │   │   │   │   │   headers=chunk_headers,                         │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       attempt = 1                                                        │ │
│ │         chunk = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\… │ │
│ │ chunk_headers = {                                                        │ │
│ │                 │   'Patch-Content-Range': 'bytes                        │ │
│ │                 524288-1048575/4194304',                                 │ │
│ │                 │   'Content-Length': '524288'                           │ │
│ │                 }                                                        │ │
│ │    chunk_size = 524288                                                   │ │
│ │        client = <httpx.AsyncClient object at 0x7f51bba19110>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f51bba1b0d0> wrapping <_io.BufferedReader          │ │
│ │                 name='/tmp/pytest-of-root/pytest-0/test_upload_chunked_… │ │
│ │             e = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Patch-Content-Range': 'bytes 524288-1048575/4194304',  │ │
│ │                 'Content-Length': '524288'} headers amongst:\n- Match    │ │
│ │                 any request with {'Patch-Content-Range': 'bytes          │ │
│ │                 2621440-3145727/4194304'} headers\n- Already matched any │ │
│ │                 request with {'Content-Length': '524288'} headers\n\nIf  │ │
│ │                 you wanted to reuse an already matched response instead  │ │
│ │                 of registering it again, refer to                        │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │           exc = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Patch-Content-Range': 'bytes 524288-1048575/4194304',  │ │
│ │                 'Content-Length': '524288'} headers amongst:\n- Match    │ │
│ │                 any request with {'Patch-Content-Range': 'bytes          │ │
│ │                 2621440-3145727/4194304'} headers\n- Already matched any │ │
│ │                 request with {'Content-Length': '524288'} headers\n\nIf  │ │
│ │                 you wanted to reuse an already matched response instead  │ │
│ │                 of registering it again, refer to                        │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │   file_hasher = <md5 _hashlib.HASH object @ 0x7f51bbaadd10>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1933 in patch       │
│                                                                              │
│   1930 │   │                                                                 │
│   1931 │   │   **Parameters**: See `httpx.request`.                          │
│   1932 │   │   """                                                           │
│ ❱ 1933 │   │   return await self.request(                                    │
│   1934 │   │   │   "PATCH",                                                  │
│   1935 │   │   │   url,                                                      │
│   1936 │   │   │   content=content,                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bba19110>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1540 in request     │
│                                                                              │
│   1537 │   │   │   timeout=timeout,                                          │
│   1538 │   │   │   extensions=extensions,                                    │
│   1539 │   │   )                                                             │
│ ❱ 1540 │   │   return await self.send(request, auth=auth, follow_redirects=f │
│   1541 │                                                                     │
│   1542 │   @asynccontextmanager                                              │
│   1543 │   async def stream(                                                 │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           method = 'PATCH'                                               │ │
│ │           params = None                                                  │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bba19110>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1629 in send        │
│                                                                              │
│   1626 │   │                                                                 │
│   1627 │   │   auth = self._build_request_auth(request, auth)                │
│   1628 │   │                                                                 │
│ ❱ 1629 │   │   response = await self._send_handling_auth(                    │
│   1630 │   │   │   request,                                                  │
│   1631 │   │   │   auth=auth,                                                │
│   1632 │   │   │   follow_redirects=follow_redirects,                        │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │             auth = <httpx.Auth object at 0x7f51bbb06ad0>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51bba19110>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1657 in             │
│ _send_handling_auth                                                          │
│                                                                              │
│   1654 │   │   │   request = await auth_flow.__anext__()                     │
│   1655 │   │   │                                                             │
│   1656 │   │   │   while True:                                               │
│ ❱ 1657 │   │   │   │   response = await self._send_handling_redirects(       │
│   1658 │   │   │   │   │   request,                                          │
│   1659 │   │   │   │   │   follow_redirects=follow_redirects,                │
│   1660 │   │   │   │   │   history=history,                                  │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx.Auth object at 0x7f51bbb06ad0>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f51bba38310>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bba19110>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1694 in             │
│ _send_handling_redirects                                                     │
│                                                                              │
│   1691 │   │   │   for hook in self._event_hooks["request"]:                 │
│   1692 │   │   │   │   await hook(request)                                   │
│   1693 │   │   │                                                             │
│ ❱ 1694 │   │   │   response = await self._send_single_request(request)       │
│   1695 │   │   │   try:                                                      │
│   1696 │   │   │   │   for hook in self._event_hooks["response"]:            │
│   1697 │   │   │   │   │   await hook(response)                              │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │ follow_redirects = False                                           │       │
│ │          history = []                                              │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51bba19110>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1730 in             │
│ _send_single_request                                                         │
│                                                                              │
│   1727 │   │   │   )                                                         │
│   1728 │   │                                                                 │
│   1729 │   │   with request_context(request=request):                        │
│ ❱ 1730 │   │   │   response = await transport.handle_async_request(request)  │
│   1731 │   │                                                                 │
│   1732 │   │   assert isinstance(response.stream, AsyncByteStream)           │
│   1733 │   │   response.request = request                                    │
│                                                                              │
│ ╭──────────────────────────── locals ─────────────────────────────╮          │
│ │   request = <Request('PATCH', 'http://example.org/upload')>     │          │
│ │      self = <httpx.AsyncClient object at 0x7f51bba19110>        │          │
│ │     start = 138.427616326                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51bba18650> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/__init__.py:56 in       │
│ mocked_handle_async_request                                                  │
│                                                                              │
│   53 │   │   transport: httpx.AsyncHTTPTransport, request: httpx.Request     │
│   54 │   ) -> httpx.Response:                                                │
│   55 │   │   if options.should_mock(request):                                │
│ ❱ 56 │   │   │   return await mock._handle_async_request(transport, request) │
│   57 │   │   return await real_handle_async_request(transport, request)      │
│   58 │                                                                       │
│   59 │   monkeypatch.setattr(                                                │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │      mock = <pytest_httpx._httpx_mock.HTTPXMock object at                │ │
│ │             0x7f51bba1bf10>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f51bba1b790>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51bba18650>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:183 in   │
│ _handle_async_request                                                        │
│                                                                              │
│   180 │   │   │   │   │   response = await response                          │
│   181 │   │   │   │   return _unread(response)                               │
│   182 │   │                                                                  │
│ ❱ 183 │   │   self._request_not_matched(real_transport, request)             │
│   184 │                                                                      │
│   185 │   def _request_not_matched(                                          │
│   186 │   │   self,                                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       callback = None                                                    │ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51bba18650>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51bba1bf10>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:191 in   │
│ _request_not_matched                                                         │
│                                                                              │
│   188 │   │   request: httpx.Request,                                        │
│   189 │   ) -> NoReturn:                                                     │
│   190 │   │   self._requests_not_matched.append(request)                     │
│ ❱ 191 │   │   raise httpx.TimeoutException(                                  │
│   192 │   │   │   self._explain_that_no_response_was_found(real_transport, r │
│   193 │   │   │   request=request,                                           │
│   194 │   │   )                                                              │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51bba18650>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51bba1bf10>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
TimeoutException: No response can be found for PATCH request on 
http://example.org/upload with {'Patch-Content-Range': 'bytes 
524288-1048575/4194304', 'Content-Length': '524288'} headers amongst:
- Match any request with {'Patch-Content-Range': 'bytes 
2621440-3145727/4194304'} headers
- Already matched any request with {'Content-Length': '524288'} headers

If you wanted to reuse an already matched response instead of registering it 
again, refer to 
https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-
a-response-for-more-than-one-request

2025-01-02 09:54:38 [debug    ] patching                       attempt=2 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 09:54:38 [error    ] retrying                       attempt=2
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /builds/infrastructure/obs-proxy/obs_proxy/chunked_uploads/client.py:84 in   │
│ upload_chunked                                                               │
│                                                                              │
│    81 │   │   │   for attempt in range(MAX_ATTEMPTS):                        │
│    82 │   │   │   │   try:                                                   │
│    83 │   │   │   │   │   logger.debug("patching", uri=uri, size=len(chunk), │
│ ❱  84 │   │   │   │   │   r = await client.patch(                            │
│    85 │   │   │   │   │   │   uri,                                           │
│    86 │   │   │   │   │   │   content=chunk,                                 │
│    87 │   │   │   │   │   │   headers=chunk_headers,                         │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       attempt = 2                                                        │ │
│ │         chunk = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\… │ │
│ │ chunk_headers = {                                                        │ │
│ │                 │   'Patch-Content-Range': 'bytes                        │ │
│ │                 524288-1048575/4194304',                                 │ │
│ │                 │   'Content-Length': '524288'                           │ │
│ │                 }                                                        │ │
│ │    chunk_size = 524288                                                   │ │
│ │        client = <httpx.AsyncClient object at 0x7f51bba19110>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f51bba1b0d0> wrapping <_io.BufferedReader          │ │
│ │                 name='/tmp/pytest-of-root/pytest-0/test_upload_chunked_… │ │
│ │             e = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Patch-Content-Range': 'bytes 524288-1048575/4194304',  │ │
│ │                 'Content-Length': '524288'} headers amongst:\n- Match    │ │
│ │                 any request with {'Patch-Content-Range': 'bytes          │ │
│ │                 2621440-3145727/4194304'} headers\n- Already matched any │ │
│ │                 request with {'Content-Length': '524288'} headers\n\nIf  │ │
│ │                 you wanted to reuse an already matched response instead  │ │
│ │                 of registering it again, refer to                        │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │           exc = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Patch-Content-Range': 'bytes 524288-1048575/4194304',  │ │
│ │                 'Content-Length': '524288'} headers amongst:\n- Match    │ │
│ │                 any request with {'Patch-Content-Range': 'bytes          │ │
│ │                 2621440-3145727/4194304'} headers\n- Already matched any │ │
│ │                 request with {'Content-Length': '524288'} headers\n\nIf  │ │
│ │                 you wanted to reuse an already matched response instead  │ │
│ │                 of registering it again, refer to                        │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │   file_hasher = <md5 _hashlib.HASH object @ 0x7f51bbaadd10>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1933 in patch       │
│                                                                              │
│   1930 │   │                                                                 │
│   1931 │   │   **Parameters**: See `httpx.request`.                          │
│   1932 │   │   """                                                           │
│ ❱ 1933 │   │   return await self.request(                                    │
│   1934 │   │   │   "PATCH",                                                  │
│   1935 │   │   │   url,                                                      │
│   1936 │   │   │   content=content,                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bba19110>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1540 in request     │
│                                                                              │
│   1537 │   │   │   timeout=timeout,                                          │
│   1538 │   │   │   extensions=extensions,                                    │
│   1539 │   │   )                                                             │
│ ❱ 1540 │   │   return await self.send(request, auth=auth, follow_redirects=f │
│   1541 │                                                                     │
│   1542 │   @asynccontextmanager                                              │
│   1543 │   async def stream(                                                 │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           method = 'PATCH'                                               │ │
│ │           params = None                                                  │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bba19110>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1629 in send        │
│                                                                              │
│   1626 │   │                                                                 │
│   1627 │   │   auth = self._build_request_auth(request, auth)                │
│   1628 │   │                                                                 │
│ ❱ 1629 │   │   response = await self._send_handling_auth(                    │
│   1630 │   │   │   request,                                                  │
│   1631 │   │   │   auth=auth,                                                │
│   1632 │   │   │   follow_redirects=follow_redirects,                        │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │             auth = <httpx.Auth object at 0x7f51bbacb750>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51bba19110>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1657 in             │
│ _send_handling_auth                                                          │
│                                                                              │
│   1654 │   │   │   request = await auth_flow.__anext__()                     │
│   1655 │   │   │                                                             │
│   1656 │   │   │   while True:                                               │
│ ❱ 1657 │   │   │   │   response = await self._send_handling_redirects(       │
│   1658 │   │   │   │   │   request,                                          │
│   1659 │   │   │   │   │   follow_redirects=follow_redirects,                │
│   1660 │   │   │   │   │   history=history,                                  │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx.Auth object at 0x7f51bbacb750>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f51bba389a0>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bba19110>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1694 in             │
│ _send_handling_redirects                                                     │
│                                                                              │
│   1691 │   │   │   for hook in self._event_hooks["request"]:                 │
│   1692 │   │   │   │   await hook(request)                                   │
│   1693 │   │   │                                                             │
│ ❱ 1694 │   │   │   response = await self._send_single_request(request)       │
│   1695 │   │   │   try:                                                      │
│   1696 │   │   │   │   for hook in self._event_hooks["response"]:            │
│   1697 │   │   │   │   │   await hook(response)                              │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │ follow_redirects = False                                           │       │
│ │          history = []                                              │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51bba19110>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1730 in             │
│ _send_single_request                                                         │
│                                                                              │
│   1727 │   │   │   )                                                         │
│   1728 │   │                                                                 │
│   1729 │   │   with request_context(request=request):                        │
│ ❱ 1730 │   │   │   response = await transport.handle_async_request(request)  │
│   1731 │   │                                                                 │
│   1732 │   │   assert isinstance(response.stream, AsyncByteStream)           │
│   1733 │   │   response.request = request                                    │
│                                                                              │
│ ╭──────────────────────────── locals ─────────────────────────────╮          │
│ │   request = <Request('PATCH', 'http://example.org/upload')>     │          │
│ │      self = <httpx.AsyncClient object at 0x7f51bba19110>        │          │
│ │     start = 139.984235736                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51bba18650> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/__init__.py:56 in       │
│ mocked_handle_async_request                                                  │
│                                                                              │
│   53 │   │   transport: httpx.AsyncHTTPTransport, request: httpx.Request     │
│   54 │   ) -> httpx.Response:                                                │
│   55 │   │   if options.should_mock(request):                                │
│ ❱ 56 │   │   │   return await mock._handle_async_request(transport, request) │
│   57 │   │   return await real_handle_async_request(transport, request)      │
│   58 │                                                                       │
│   59 │   monkeypatch.setattr(                                                │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │      mock = <pytest_httpx._httpx_mock.HTTPXMock object at                │ │
│ │             0x7f51bba1bf10>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f51bba1b790>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51bba18650>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:183 in   │
│ _handle_async_request                                                        │
│                                                                              │
│   180 │   │   │   │   │   response = await response                          │
│   181 │   │   │   │   return _unread(response)                               │
│   182 │   │                                                                  │
│ ❱ 183 │   │   self._request_not_matched(real_transport, request)             │
│   184 │                                                                      │
│   185 │   def _request_not_matched(                                          │
│   186 │   │   self,                                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       callback = None                                                    │ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51bba18650>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51bba1bf10>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:191 in   │
│ _request_not_matched                                                         │
│                                                                              │
│   188 │   │   request: httpx.Request,                                        │
│   189 │   ) -> NoReturn:                                                     │
│   190 │   │   self._requests_not_matched.append(request)                     │
│ ❱ 191 │   │   raise httpx.TimeoutException(                                  │
│   192 │   │   │   self._explain_that_no_response_was_found(real_transport, r │
│   193 │   │   │   request=request,                                           │
│   194 │   │   )                                                              │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51bba18650>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51bba1bf10>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
TimeoutException: No response can be found for PATCH request on 
http://example.org/upload with {'Patch-Content-Range': 'bytes 
524288-1048575/4194304', 'Content-Length': '524288'} headers amongst:
- Match any request with {'Patch-Content-Range': 'bytes 
2621440-3145727/4194304'} headers
- Already matched any request with {'Content-Length': '524288'} headers

If you wanted to reuse an already matched response instead of registering it 
again, refer to 
https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-
a-response-for-more-than-one-request

2025-01-02 09:54:40 [debug    ] patching                       attempt=3 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 09:54:40 [error    ] retrying                       attempt=3
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /builds/infrastructure/obs-proxy/obs_proxy/chunked_uploads/client.py:84 in   │
│ upload_chunked                                                               │
│                                                                              │
│    81 │   │   │   for attempt in range(MAX_ATTEMPTS):                        │
│    82 │   │   │   │   try:                                                   │
│    83 │   │   │   │   │   logger.debug("patching", uri=uri, size=len(chunk), │
│ ❱  84 │   │   │   │   │   r = await client.patch(                            │
│    85 │   │   │   │   │   │   uri,                                           │
│    86 │   │   │   │   │   │   content=chunk,                                 │
│    87 │   │   │   │   │   │   headers=chunk_headers,                         │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       attempt = 3                                                        │ │
│ │         chunk = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\… │ │
│ │ chunk_headers = {                                                        │ │
│ │                 │   'Patch-Content-Range': 'bytes                        │ │
│ │                 524288-1048575/4194304',                                 │ │
│ │                 │   'Content-Length': '524288'                           │ │
│ │                 }                                                        │ │
│ │    chunk_size = 524288                                                   │ │
│ │        client = <httpx.AsyncClient object at 0x7f51bba19110>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f51bba1b0d0> wrapping <_io.BufferedReader          │ │
│ │                 name='/tmp/pytest-of-root/pytest-0/test_upload_chunked_… │ │
│ │             e = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Patch-Content-Range': 'bytes 524288-1048575/4194304',  │ │
│ │                 'Content-Length': '524288'} headers amongst:\n- Match    │ │
│ │                 any request with {'Patch-Content-Range': 'bytes          │ │
│ │                 2621440-3145727/4194304'} headers\n- Already matched any │ │
│ │                 request with {'Content-Length': '524288'} headers\n\nIf  │ │
│ │                 you wanted to reuse an already matched response instead  │ │
│ │                 of registering it again, refer to                        │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │           exc = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Patch-Content-Range': 'bytes 524288-1048575/4194304',  │ │
│ │                 'Content-Length': '524288'} headers amongst:\n- Match    │ │
│ │                 any request with {'Patch-Content-Range': 'bytes          │ │
│ │                 2621440-3145727/4194304'} headers\n- Already matched any │ │
│ │                 request with {'Content-Length': '524288'} headers\n\nIf  │ │
│ │                 you wanted to reuse an already matched response instead  │ │
│ │                 of registering it again, refer to                        │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │   file_hasher = <md5 _hashlib.HASH object @ 0x7f51bbaadd10>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1933 in patch       │
│                                                                              │
│   1930 │   │                                                                 │
│   1931 │   │   **Parameters**: See `httpx.request`.                          │
│   1932 │   │   """                                                           │
│ ❱ 1933 │   │   return await self.request(                                    │
│   1934 │   │   │   "PATCH",                                                  │
│   1935 │   │   │   url,                                                      │
│   1936 │   │   │   content=content,                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bba19110>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1540 in request     │
│                                                                              │
│   1537 │   │   │   timeout=timeout,                                          │
│   1538 │   │   │   extensions=extensions,                                    │
│   1539 │   │   )                                                             │
│ ❱ 1540 │   │   return await self.send(request, auth=auth, follow_redirects=f │
│   1541 │                                                                     │
│   1542 │   @asynccontextmanager                                              │
│   1543 │   async def stream(                                                 │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           method = 'PATCH'                                               │ │
│ │           params = None                                                  │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bba19110>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1629 in send        │
│                                                                              │
│   1626 │   │                                                                 │
│   1627 │   │   auth = self._build_request_auth(request, auth)                │
│   1628 │   │                                                                 │
│ ❱ 1629 │   │   response = await self._send_handling_auth(                    │
│   1630 │   │   │   request,                                                  │
│   1631 │   │   │   auth=auth,                                                │
│   1632 │   │   │   follow_redirects=follow_redirects,                        │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │             auth = <httpx.Auth object at 0x7f51bbcb2ad0>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51bba19110>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1657 in             │
│ _send_handling_auth                                                          │
│                                                                              │
│   1654 │   │   │   request = await auth_flow.__anext__()                     │
│   1655 │   │   │                                                             │
│   1656 │   │   │   while True:                                               │
│ ❱ 1657 │   │   │   │   response = await self._send_handling_redirects(       │
│   1658 │   │   │   │   │   request,                                          │
│   1659 │   │   │   │   │   follow_redirects=follow_redirects,                │
│   1660 │   │   │   │   │   history=history,                                  │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx.Auth object at 0x7f51bbcb2ad0>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f51bba38d60>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bba19110>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1694 in             │
│ _send_handling_redirects                                                     │
│                                                                              │
│   1691 │   │   │   for hook in self._event_hooks["request"]:                 │
│   1692 │   │   │   │   await hook(request)                                   │
│   1693 │   │   │                                                             │
│ ❱ 1694 │   │   │   response = await self._send_single_request(request)       │
│   1695 │   │   │   try:                                                      │
│   1696 │   │   │   │   for hook in self._event_hooks["response"]:            │
│   1697 │   │   │   │   │   await hook(response)                              │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │ follow_redirects = False                                           │       │
│ │          history = []                                              │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51bba19110>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1730 in             │
│ _send_single_request                                                         │
│                                                                              │
│   1727 │   │   │   )                                                         │
│   1728 │   │                                                                 │
│   1729 │   │   with request_context(request=request):                        │
│ ❱ 1730 │   │   │   response = await transport.handle_async_request(request)  │
│   1731 │   │                                                                 │
│   1732 │   │   assert isinstance(response.stream, AsyncByteStream)           │
│   1733 │   │   response.request = request                                    │
│                                                                              │
│ ╭──────────────────────────── locals ─────────────────────────────╮          │
│ │   request = <Request('PATCH', 'http://example.org/upload')>     │          │
│ │      self = <httpx.AsyncClient object at 0x7f51bba19110>        │          │
│ │     start = 141.591669583                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51bba18650> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/__init__.py:56 in       │
│ mocked_handle_async_request                                                  │
│                                                                              │
│   53 │   │   transport: httpx.AsyncHTTPTransport, request: httpx.Request     │
│   54 │   ) -> httpx.Response:                                                │
│   55 │   │   if options.should_mock(request):                                │
│ ❱ 56 │   │   │   return await mock._handle_async_request(transport, request) │
│   57 │   │   return await real_handle_async_request(transport, request)      │
│   58 │                                                                       │
│   59 │   monkeypatch.setattr(                                                │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │      mock = <pytest_httpx._httpx_mock.HTTPXMock object at                │ │
│ │             0x7f51bba1bf10>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f51bba1b790>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51bba18650>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:183 in   │
│ _handle_async_request                                                        │
│                                                                              │
│   180 │   │   │   │   │   response = await response                          │
│   181 │   │   │   │   return _unread(response)                               │
│   182 │   │                                                                  │
│ ❱ 183 │   │   self._request_not_matched(real_transport, request)             │
│   184 │                                                                      │
│   185 │   def _request_not_matched(                                          │
│   186 │   │   self,                                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       callback = None                                                    │ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51bba18650>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51bba1bf10>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:191 in   │
│ _request_not_matched                                                         │
│                                                                              │
│   188 │   │   request: httpx.Request,                                        │
│   189 │   ) -> NoReturn:                                                     │
│   190 │   │   self._requests_not_matched.append(request)                     │
│ ❱ 191 │   │   raise httpx.TimeoutException(                                  │
│   192 │   │   │   self._explain_that_no_response_was_found(real_transport, r │
│   193 │   │   │   request=request,                                           │
│   194 │   │   )                                                              │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51bba18650>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51bba1bf10>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
TimeoutException: No response can be found for PATCH request on 
http://example.org/upload with {'Patch-Content-Range': 'bytes 
524288-1048575/4194304', 'Content-Length': '524288'} headers amongst:
- Match any request with {'Patch-Content-Range': 'bytes 
2621440-3145727/4194304'} headers
- Already matched any request with {'Content-Length': '524288'} headers

If you wanted to reuse an already matched response instead of registering it 
again, refer to 
https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-
a-response-for-more-than-one-request

2025-01-02 09:54:41 [debug    ] patching                       attempt=4 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 09:54:41 [error    ] retrying                       attempt=4
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /builds/infrastructure/obs-proxy/obs_proxy/chunked_uploads/client.py:84 in   │
│ upload_chunked                                                               │
│                                                                              │
│    81 │   │   │   for attempt in range(MAX_ATTEMPTS):                        │
│    82 │   │   │   │   try:                                                   │
│    83 │   │   │   │   │   logger.debug("patching", uri=uri, size=len(chunk), │
│ ❱  84 │   │   │   │   │   r = await client.patch(                            │
│    85 │   │   │   │   │   │   uri,                                           │
│    86 │   │   │   │   │   │   content=chunk,                                 │
│    87 │   │   │   │   │   │   headers=chunk_headers,                         │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       attempt = 4                                                        │ │
│ │         chunk = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\… │ │
│ │ chunk_headers = {                                                        │ │
│ │                 │   'Patch-Content-Range': 'bytes                        │ │
│ │                 524288-1048575/4194304',                                 │ │
│ │                 │   'Content-Length': '524288'                           │ │
│ │                 }                                                        │ │
│ │    chunk_size = 524288                                                   │ │
│ │        client = <httpx.AsyncClient object at 0x7f51bba19110>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f51bba1b0d0> wrapping <_io.BufferedReader          │ │
│ │                 name='/tmp/pytest-of-root/pytest-0/test_upload_chunked_… │ │
│ │             e = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Patch-Content-Range': 'bytes 524288-1048575/4194304',  │ │
│ │                 'Content-Length': '524288'} headers amongst:\n- Match    │ │
│ │                 any request with {'Patch-Content-Range': 'bytes          │ │
│ │                 2621440-3145727/4194304'} headers\n- Already matched any │ │
│ │                 request with {'Content-Length': '524288'} headers\n\nIf  │ │
│ │                 you wanted to reuse an already matched response instead  │ │
│ │                 of registering it again, refer to                        │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │           exc = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Patch-Content-Range': 'bytes 524288-1048575/4194304',  │ │
│ │                 'Content-Length': '524288'} headers amongst:\n- Match    │ │
│ │                 any request with {'Patch-Content-Range': 'bytes          │ │
│ │                 2621440-3145727/4194304'} headers\n- Already matched any │ │
│ │                 request with {'Content-Length': '524288'} headers\n\nIf  │ │
│ │                 you wanted to reuse an already matched response instead  │ │
│ │                 of registering it again, refer to                        │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │   file_hasher = <md5 _hashlib.HASH object @ 0x7f51bbaadd10>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1933 in patch       │
│                                                                              │
│   1930 │   │                                                                 │
│   1931 │   │   **Parameters**: See `httpx.request`.                          │
│   1932 │   │   """                                                           │
│ ❱ 1933 │   │   return await self.request(                                    │
│   1934 │   │   │   "PATCH",                                                  │
│   1935 │   │   │   url,                                                      │
│   1936 │   │   │   content=content,                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bba19110>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1540 in request     │
│                                                                              │
│   1537 │   │   │   timeout=timeout,                                          │
│   1538 │   │   │   extensions=extensions,                                    │
│   1539 │   │   )                                                             │
│ ❱ 1540 │   │   return await self.send(request, auth=auth, follow_redirects=f │
│   1541 │                                                                     │
│   1542 │   @asynccontextmanager                                              │
│   1543 │   async def stream(                                                 │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           method = 'PATCH'                                               │ │
│ │           params = None                                                  │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bba19110>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1629 in send        │
│                                                                              │
│   1626 │   │                                                                 │
│   1627 │   │   auth = self._build_request_auth(request, auth)                │
│   1628 │   │                                                                 │
│ ❱ 1629 │   │   response = await self._send_handling_auth(                    │
│   1630 │   │   │   request,                                                  │
│   1631 │   │   │   auth=auth,                                                │
│   1632 │   │   │   follow_redirects=follow_redirects,                        │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │             auth = <httpx.Auth object at 0x7f51bbc978d0>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51bba19110>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1657 in             │
│ _send_handling_auth                                                          │
│                                                                              │
│   1654 │   │   │   request = await auth_flow.__anext__()                     │
│   1655 │   │   │                                                             │
│   1656 │   │   │   while True:                                               │
│ ❱ 1657 │   │   │   │   response = await self._send_handling_redirects(       │
│   1658 │   │   │   │   │   request,                                          │
│   1659 │   │   │   │   │   follow_redirects=follow_redirects,                │
│   1660 │   │   │   │   │   history=history,                                  │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx.Auth object at 0x7f51bbc978d0>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f51bba38130>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bba19110>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1694 in             │
│ _send_handling_redirects                                                     │
│                                                                              │
│   1691 │   │   │   for hook in self._event_hooks["request"]:                 │
│   1692 │   │   │   │   await hook(request)                                   │
│   1693 │   │   │                                                             │
│ ❱ 1694 │   │   │   response = await self._send_single_request(request)       │
│   1695 │   │   │   try:                                                      │
│   1696 │   │   │   │   for hook in self._event_hooks["response"]:            │
│   1697 │   │   │   │   │   await hook(response)                              │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │ follow_redirects = False                                           │       │
│ │          history = []                                              │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51bba19110>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1730 in             │
│ _send_single_request                                                         │
│                                                                              │
│   1727 │   │   │   )                                                         │
│   1728 │   │                                                                 │
│   1729 │   │   with request_context(request=request):                        │
│ ❱ 1730 │   │   │   response = await transport.handle_async_request(request)  │
│   1731 │   │                                                                 │
│   1732 │   │   assert isinstance(response.stream, AsyncByteStream)           │
│   1733 │   │   response.request = request                                    │
│                                                                              │
│ ╭──────────────────────────── locals ─────────────────────────────╮          │
│ │   request = <Request('PATCH', 'http://example.org/upload')>     │          │
│ │      self = <httpx.AsyncClient object at 0x7f51bba19110>        │          │
│ │     start = 143.113264733                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51bba18650> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/__init__.py:56 in       │
│ mocked_handle_async_request                                                  │
│                                                                              │
│   53 │   │   transport: httpx.AsyncHTTPTransport, request: httpx.Request     │
│   54 │   ) -> httpx.Response:                                                │
│   55 │   │   if options.should_mock(request):                                │
│ ❱ 56 │   │   │   return await mock._handle_async_request(transport, request) │
│   57 │   │   return await real_handle_async_request(transport, request)      │
│   58 │                                                                       │
│   59 │   monkeypatch.setattr(                                                │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │      mock = <pytest_httpx._httpx_mock.HTTPXMock object at                │ │
│ │             0x7f51bba1bf10>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f51bba1b790>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51bba18650>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:183 in   │
│ _handle_async_request                                                        │
│                                                                              │
│   180 │   │   │   │   │   response = await response                          │
│   181 │   │   │   │   return _unread(response)                               │
│   182 │   │                                                                  │
│ ❱ 183 │   │   self._request_not_matched(real_transport, request)             │
│   184 │                                                                      │
│   185 │   def _request_not_matched(                                          │
│   186 │   │   self,                                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       callback = None                                                    │ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51bba18650>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51bba1bf10>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:191 in   │
│ _request_not_matched                                                         │
│                                                                              │
│   188 │   │   request: httpx.Request,                                        │
│   189 │   ) -> NoReturn:                                                     │
│   190 │   │   self._requests_not_matched.append(request)                     │
│ ❱ 191 │   │   raise httpx.TimeoutException(                                  │
│   192 │   │   │   self._explain_that_no_response_was_found(real_transport, r │
│   193 │   │   │   request=request,                                           │
│   194 │   │   )                                                              │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51bba18650>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51bba1bf10>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
TimeoutException: No response can be found for PATCH request on 
http://example.org/upload with {'Patch-Content-Range': 'bytes 
524288-1048575/4194304', 'Content-Length': '524288'} headers amongst:
- Match any request with {'Patch-Content-Range': 'bytes 
2621440-3145727/4194304'} headers
- Already matched any request with {'Content-Length': '524288'} headers

If you wanted to reuse an already matched response instead of registering it 
again, refer to 
https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-
a-response-for-more-than-one-request

___________ ERROR at teardown of test_upload_chunked_wrong_response ____________

monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7f51badf8150>
request = <SubRequest 'httpx_mock' for <Coroutine test_upload_chunked_wrong_response>>

    @pytest.fixture
    def httpx_mock(
        monkeypatch: MonkeyPatch,
        request: FixtureRequest,
    ) -> Generator[HTTPXMock, None, None]:
        options = {}
        for marker in request.node.iter_markers("httpx_mock"):
            options = marker.kwargs | options
        __tracebackhide__ = methodcaller("errisinstance", TypeError)
        options = _HTTPXMockOptions(**options)
    
        mock = HTTPXMock(options)
    
        # Mock synchronous requests
        real_handle_request = httpx.HTTPTransport.handle_request
    
        def mocked_handle_request(
            transport: httpx.HTTPTransport, request: httpx.Request
        ) -> httpx.Response:
            if options.should_mock(request):
                return mock._handle_request(transport, request)
            return real_handle_request(transport, request)
    
        monkeypatch.setattr(
            httpx.HTTPTransport,
            "handle_request",
            mocked_handle_request,
        )
    
        # Mock asynchronous requests
        real_handle_async_request = httpx.AsyncHTTPTransport.handle_async_request
    
        async def mocked_handle_async_request(
            transport: httpx.AsyncHTTPTransport, request: httpx.Request
        ) -> httpx.Response:
            if options.should_mock(request):
                return await mock._handle_async_request(transport, request)
            return await real_handle_async_request(transport, request)
    
        monkeypatch.setattr(
            httpx.AsyncHTTPTransport,
            "handle_async_request",
            mocked_handle_async_request,
        )
    
        yield mock
        try:
>           mock._assert_options()

/usr/local/lib/python3.11/site-packages/pytest_httpx/__init__.py:67: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <pytest_httpx._httpx_mock.HTTPXMock object at 0x7f51badf9f90>

    def _assert_options(self) -> None:
        callbacks_not_executed = [
            matcher for matcher, _ in self._callbacks if matcher.should_have_matched()
        ]
        matchers_description = "\n".join(
            [f"- {matcher}" for matcher in callbacks_not_executed]
        )
    
>       assert not callbacks_not_executed, (
            "The following responses are mocked but not requested:\n"
            f"{matchers_description}\n"
            "\n"
            "If this is on purpose, refer to https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-more-responses-than-what-will-be-requested"
        )
E       AssertionError: The following responses are mocked but not requested:
E         - Match any request with {'Patch-Content-Range': 'bytes 2621440-3145727/4194304'} headers
E         
E         If this is on purpose, refer to https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-more-responses-than-what-will-be-requested
E       assert not [<pytest_httpx._request_matcher._RequestMatcher object at 0x7f51badfa150>]

/usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:319: AssertionError
----------------------------- Captured stdout call -----------------------------
2025-01-02 09:54:43 [debug    ] patching                       attempt=0 content_range=<ContentRange 'bytes 0-524287/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 09:54:43 [debug    ] patch result                   result=<Response [200 OK]>
2025-01-02 09:54:43 [debug    ] patching                       attempt=0 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 09:54:43 [error    ] retrying                       attempt=0
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /builds/infrastructure/obs-proxy/obs_proxy/chunked_uploads/client.py:84 in   │
│ upload_chunked                                                               │
│                                                                              │
│    81 │   │   │   for attempt in range(MAX_ATTEMPTS):                        │
│    82 │   │   │   │   try:                                                   │
│    83 │   │   │   │   │   logger.debug("patching", uri=uri, size=len(chunk), │
│ ❱  84 │   │   │   │   │   r = await client.patch(                            │
│    85 │   │   │   │   │   │   uri,                                           │
│    86 │   │   │   │   │   │   content=chunk,                                 │
│    87 │   │   │   │   │   │   headers=chunk_headers,                         │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       attempt = 0                                                        │ │
│ │         chunk = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\… │ │
│ │ chunk_headers = {                                                        │ │
│ │                 │   'Patch-Content-Range': 'bytes                        │ │
│ │                 524288-1048575/4194304',                                 │ │
│ │                 │   'Content-Length': '524288'                           │ │
│ │                 }                                                        │ │
│ │    chunk_size = 524288                                                   │ │
│ │        client = <httpx.AsyncClient object at 0x7f51badfb6d0>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f51badf8c90> wrapping <_io.BufferedReader          │ │
│ │                 name='/tmp/pytest-of-root/pytest-0/test_upload_chunked_… │ │
│ │             e = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Patch-Content-Range': 'bytes 524288-1048575/4194304',  │ │
│ │                 'Content-Length': '524288'} headers amongst:\n- Match    │ │
│ │                 any request with {'Patch-Content-Range': 'bytes          │ │
│ │                 2621440-3145727/4194304'} headers\n- Already matched any │ │
│ │                 request with {'Content-Length': '524288'} headers\n\nIf  │ │
│ │                 you wanted to reuse an already matched response instead  │ │
│ │                 of registering it again, refer to                        │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │           exc = None                                                     │ │
│ │   file_hasher = <md5 _hashlib.HASH object @ 0x7f51bbaafd30>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1933 in patch       │
│                                                                              │
│   1930 │   │                                                                 │
│   1931 │   │   **Parameters**: See `httpx.request`.                          │
│   1932 │   │   """                                                           │
│ ❱ 1933 │   │   return await self.request(                                    │
│   1934 │   │   │   "PATCH",                                                  │
│   1935 │   │   │   url,                                                      │
│   1936 │   │   │   content=content,                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f51badfb6d0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1540 in request     │
│                                                                              │
│   1537 │   │   │   timeout=timeout,                                          │
│   1538 │   │   │   extensions=extensions,                                    │
│   1539 │   │   )                                                             │
│ ❱ 1540 │   │   return await self.send(request, auth=auth, follow_redirects=f │
│   1541 │                                                                     │
│   1542 │   @asynccontextmanager                                              │
│   1543 │   async def stream(                                                 │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           method = 'PATCH'                                               │ │
│ │           params = None                                                  │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51badfb6d0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1629 in send        │
│                                                                              │
│   1626 │   │                                                                 │
│   1627 │   │   auth = self._build_request_auth(request, auth)                │
│   1628 │   │                                                                 │
│ ❱ 1629 │   │   response = await self._send_handling_auth(                    │
│   1630 │   │   │   request,                                                  │
│   1631 │   │   │   auth=auth,                                                │
│   1632 │   │   │   follow_redirects=follow_redirects,                        │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │             auth = <httpx.Auth object at 0x7f51badfbf90>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51badfb6d0>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1657 in             │
│ _send_handling_auth                                                          │
│                                                                              │
│   1654 │   │   │   request = await auth_flow.__anext__()                     │
│   1655 │   │   │                                                             │
│   1656 │   │   │   while True:                                               │
│ ❱ 1657 │   │   │   │   response = await self._send_handling_redirects(       │
│   1658 │   │   │   │   │   request,                                          │
│   1659 │   │   │   │   │   follow_redirects=follow_redirects,                │
│   1660 │   │   │   │   │   history=history,                                  │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx.Auth object at 0x7f51badfbf90>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f51bb96d300>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51badfb6d0>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1694 in             │
│ _send_handling_redirects                                                     │
│                                                                              │
│   1691 │   │   │   for hook in self._event_hooks["request"]:                 │
│   1692 │   │   │   │   await hook(request)                                   │
│   1693 │   │   │                                                             │
│ ❱ 1694 │   │   │   response = await self._send_single_request(request)       │
│   1695 │   │   │   try:                                                      │
│   1696 │   │   │   │   for hook in self._event_hooks["response"]:            │
│   1697 │   │   │   │   │   await hook(response)                              │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │ follow_redirects = False                                           │       │
│ │          history = []                                              │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51badfb6d0>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1730 in             │
│ _send_single_request                                                         │
│                                                                              │
│   1727 │   │   │   )                                                         │
│   1728 │   │                                                                 │
│   1729 │   │   with request_context(request=request):                        │
│ ❱ 1730 │   │   │   response = await transport.handle_async_request(request)  │
│   1731 │   │                                                                 │
│   1732 │   │   assert isinstance(response.stream, AsyncByteStream)           │
│   1733 │   │   response.request = request                                    │
│                                                                              │
│ ╭──────────────────────────── locals ─────────────────────────────╮          │
│ │   request = <Request('PATCH', 'http://example.org/upload')>     │          │
│ │      self = <httpx.AsyncClient object at 0x7f51badfb6d0>        │          │
│ │     start = 144.965858387                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51badf9d90> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/__init__.py:56 in       │
│ mocked_handle_async_request                                                  │
│                                                                              │
│   53 │   │   transport: httpx.AsyncHTTPTransport, request: httpx.Request     │
│   54 │   ) -> httpx.Response:                                                │
│   55 │   │   if options.should_mock(request):                                │
│ ❱ 56 │   │   │   return await mock._handle_async_request(transport, request) │
│   57 │   │   return await real_handle_async_request(transport, request)      │
│   58 │                                                                       │
│   59 │   monkeypatch.setattr(                                                │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │      mock = <pytest_httpx._httpx_mock.HTTPXMock object at                │ │
│ │             0x7f51badf9f90>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f51badfb510>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51badf9d90>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:183 in   │
│ _handle_async_request                                                        │
│                                                                              │
│   180 │   │   │   │   │   response = await response                          │
│   181 │   │   │   │   return _unread(response)                               │
│   182 │   │                                                                  │
│ ❱ 183 │   │   self._request_not_matched(real_transport, request)             │
│   184 │                                                                      │
│   185 │   def _request_not_matched(                                          │
│   186 │   │   self,                                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       callback = None                                                    │ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51badf9d90>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51badf9f90>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:191 in   │
│ _request_not_matched                                                         │
│                                                                              │
│   188 │   │   request: httpx.Request,                                        │
│   189 │   ) -> NoReturn:                                                     │
│   190 │   │   self._requests_not_matched.append(request)                     │
│ ❱ 191 │   │   raise httpx.TimeoutException(                                  │
│   192 │   │   │   self._explain_that_no_response_was_found(real_transport, r │
│   193 │   │   │   request=request,                                           │
│   194 │   │   )                                                              │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51badf9d90>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51badf9f90>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
TimeoutException: No response can be found for PATCH request on 
http://example.org/upload with {'Patch-Content-Range': 'bytes 
524288-1048575/4194304', 'Content-Length': '524288'} headers amongst:
- Match any request with {'Patch-Content-Range': 'bytes 
2621440-3145727/4194304'} headers
- Already matched any request with {'Content-Length': '524288'} headers

If you wanted to reuse an already matched response instead of registering it 
again, refer to 
https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-
a-response-for-more-than-one-request

2025-01-02 09:54:44 [debug    ] patching                       attempt=1 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 09:54:44 [error    ] retrying                       attempt=1
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /builds/infrastructure/obs-proxy/obs_proxy/chunked_uploads/client.py:84 in   │
│ upload_chunked                                                               │
│                                                                              │
│    81 │   │   │   for attempt in range(MAX_ATTEMPTS):                        │
│    82 │   │   │   │   try:                                                   │
│    83 │   │   │   │   │   logger.debug("patching", uri=uri, size=len(chunk), │
│ ❱  84 │   │   │   │   │   r = await client.patch(                            │
│    85 │   │   │   │   │   │   uri,                                           │
│    86 │   │   │   │   │   │   content=chunk,                                 │
│    87 │   │   │   │   │   │   headers=chunk_headers,                         │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       attempt = 1                                                        │ │
│ │         chunk = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\… │ │
│ │ chunk_headers = {                                                        │ │
│ │                 │   'Patch-Content-Range': 'bytes                        │ │
│ │                 524288-1048575/4194304',                                 │ │
│ │                 │   'Content-Length': '524288'                           │ │
│ │                 }                                                        │ │
│ │    chunk_size = 524288                                                   │ │
│ │        client = <httpx.AsyncClient object at 0x7f51badfb6d0>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f51badf8c90> wrapping <_io.BufferedReader          │ │
│ │                 name='/tmp/pytest-of-root/pytest-0/test_upload_chunked_… │ │
│ │             e = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Patch-Content-Range': 'bytes 524288-1048575/4194304',  │ │
│ │                 'Content-Length': '524288'} headers amongst:\n- Match    │ │
│ │                 any request with {'Patch-Content-Range': 'bytes          │ │
│ │                 2621440-3145727/4194304'} headers\n- Already matched any │ │
│ │                 request with {'Content-Length': '524288'} headers\n\nIf  │ │
│ │                 you wanted to reuse an already matched response instead  │ │
│ │                 of registering it again, refer to                        │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │           exc = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Patch-Content-Range': 'bytes 524288-1048575/4194304',  │ │
│ │                 'Content-Length': '524288'} headers amongst:\n- Match    │ │
│ │                 any request with {'Patch-Content-Range': 'bytes          │ │
│ │                 2621440-3145727/4194304'} headers\n- Already matched any │ │
│ │                 request with {'Content-Length': '524288'} headers\n\nIf  │ │
│ │                 you wanted to reuse an already matched response instead  │ │
│ │                 of registering it again, refer to                        │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │   file_hasher = <md5 _hashlib.HASH object @ 0x7f51bbaafd30>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1933 in patch       │
│                                                                              │
│   1930 │   │                                                                 │
│   1931 │   │   **Parameters**: See `httpx.request`.                          │
│   1932 │   │   """                                                           │
│ ❱ 1933 │   │   return await self.request(                                    │
│   1934 │   │   │   "PATCH",                                                  │
│   1935 │   │   │   url,                                                      │
│   1936 │   │   │   content=content,                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f51badfb6d0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1540 in request     │
│                                                                              │
│   1537 │   │   │   timeout=timeout,                                          │
│   1538 │   │   │   extensions=extensions,                                    │
│   1539 │   │   )                                                             │
│ ❱ 1540 │   │   return await self.send(request, auth=auth, follow_redirects=f │
│   1541 │                                                                     │
│   1542 │   @asynccontextmanager                                              │
│   1543 │   async def stream(                                                 │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           method = 'PATCH'                                               │ │
│ │           params = None                                                  │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51badfb6d0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1629 in send        │
│                                                                              │
│   1626 │   │                                                                 │
│   1627 │   │   auth = self._build_request_auth(request, auth)                │
│   1628 │   │                                                                 │
│ ❱ 1629 │   │   response = await self._send_handling_auth(                    │
│   1630 │   │   │   request,                                                  │
│   1631 │   │   │   auth=auth,                                                │
│   1632 │   │   │   follow_redirects=follow_redirects,                        │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │             auth = <httpx.Auth object at 0x7f51bbdd33d0>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51badfb6d0>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1657 in             │
│ _send_handling_auth                                                          │
│                                                                              │
│   1654 │   │   │   request = await auth_flow.__anext__()                     │
│   1655 │   │   │                                                             │
│   1656 │   │   │   while True:                                               │
│ ❱ 1657 │   │   │   │   response = await self._send_handling_redirects(       │
│   1658 │   │   │   │   │   request,                                          │
│   1659 │   │   │   │   │   follow_redirects=follow_redirects,                │
│   1660 │   │   │   │   │   history=history,                                  │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx.Auth object at 0x7f51bbdd33d0>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f51bba38c70>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51badfb6d0>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1694 in             │
│ _send_handling_redirects                                                     │
│                                                                              │
│   1691 │   │   │   for hook in self._event_hooks["request"]:                 │
│   1692 │   │   │   │   await hook(request)                                   │
│   1693 │   │   │                                                             │
│ ❱ 1694 │   │   │   response = await self._send_single_request(request)       │
│   1695 │   │   │   try:                                                      │
│   1696 │   │   │   │   for hook in self._event_hooks["response"]:            │
│   1697 │   │   │   │   │   await hook(response)                              │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │ follow_redirects = False                                           │       │
│ │          history = []                                              │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51badfb6d0>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1730 in             │
│ _send_single_request                                                         │
│                                                                              │
│   1727 │   │   │   )                                                         │
│   1728 │   │                                                                 │
│   1729 │   │   with request_context(request=request):                        │
│ ❱ 1730 │   │   │   response = await transport.handle_async_request(request)  │
│   1731 │   │                                                                 │
│   1732 │   │   assert isinstance(response.stream, AsyncByteStream)           │
│   1733 │   │   response.request = request                                    │
│                                                                              │
│ ╭──────────────────────────── locals ─────────────────────────────╮          │
│ │   request = <Request('PATCH', 'http://example.org/upload')>     │          │
│ │      self = <httpx.AsyncClient object at 0x7f51badfb6d0>        │          │
│ │     start = 146.139331717                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51badf9d90> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/__init__.py:56 in       │
│ mocked_handle_async_request                                                  │
│                                                                              │
│   53 │   │   transport: httpx.AsyncHTTPTransport, request: httpx.Request     │
│   54 │   ) -> httpx.Response:                                                │
│   55 │   │   if options.should_mock(request):                                │
│ ❱ 56 │   │   │   return await mock._handle_async_request(transport, request) │
│   57 │   │   return await real_handle_async_request(transport, request)      │
│   58 │                                                                       │
│   59 │   monkeypatch.setattr(                                                │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │      mock = <pytest_httpx._httpx_mock.HTTPXMock object at                │ │
│ │             0x7f51badf9f90>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f51badfb510>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51badf9d90>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:183 in   │
│ _handle_async_request                                                        │
│                                                                              │
│   180 │   │   │   │   │   response = await response                          │
│   181 │   │   │   │   return _unread(response)                               │
│   182 │   │                                                                  │
│ ❱ 183 │   │   self._request_not_matched(real_transport, request)             │
│   184 │                                                                      │
│   185 │   def _request_not_matched(                                          │
│   186 │   │   self,                                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       callback = None                                                    │ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51badf9d90>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51badf9f90>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:191 in   │
│ _request_not_matched                                                         │
│                                                                              │
│   188 │   │   request: httpx.Request,                                        │
│   189 │   ) -> NoReturn:                                                     │
│   190 │   │   self._requests_not_matched.append(request)                     │
│ ❱ 191 │   │   raise httpx.TimeoutException(                                  │
│   192 │   │   │   self._explain_that_no_response_was_found(real_transport, r │
│   193 │   │   │   request=request,                                           │
│   194 │   │   )                                                              │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51badf9d90>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51badf9f90>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
TimeoutException: No response can be found for PATCH request on 
http://example.org/upload with {'Patch-Content-Range': 'bytes 
524288-1048575/4194304', 'Content-Length': '524288'} headers amongst:
- Match any request with {'Patch-Content-Range': 'bytes 
2621440-3145727/4194304'} headers
- Already matched any request with {'Content-Length': '524288'} headers

If you wanted to reuse an already matched response instead of registering it 
again, refer to 
https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-
a-response-for-more-than-one-request

2025-01-02 09:54:45 [debug    ] patching                       attempt=2 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 09:54:45 [error    ] retrying                       attempt=2
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /builds/infrastructure/obs-proxy/obs_proxy/chunked_uploads/client.py:84 in   │
│ upload_chunked                                                               │
│                                                                              │
│    81 │   │   │   for attempt in range(MAX_ATTEMPTS):                        │
│    82 │   │   │   │   try:                                                   │
│    83 │   │   │   │   │   logger.debug("patching", uri=uri, size=len(chunk), │
│ ❱  84 │   │   │   │   │   r = await client.patch(                            │
│    85 │   │   │   │   │   │   uri,                                           │
│    86 │   │   │   │   │   │   content=chunk,                                 │
│    87 │   │   │   │   │   │   headers=chunk_headers,                         │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       attempt = 2                                                        │ │
│ │         chunk = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\… │ │
│ │ chunk_headers = {                                                        │ │
│ │                 │   'Patch-Content-Range': 'bytes                        │ │
│ │                 524288-1048575/4194304',                                 │ │
│ │                 │   'Content-Length': '524288'                           │ │
│ │                 }                                                        │ │
│ │    chunk_size = 524288                                                   │ │
│ │        client = <httpx.AsyncClient object at 0x7f51badfb6d0>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f51badf8c90> wrapping <_io.BufferedReader          │ │
│ │                 name='/tmp/pytest-of-root/pytest-0/test_upload_chunked_… │ │
│ │             e = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Patch-Content-Range': 'bytes 524288-1048575/4194304',  │ │
│ │                 'Content-Length': '524288'} headers amongst:\n- Match    │ │
│ │                 any request with {'Patch-Content-Range': 'bytes          │ │
│ │                 2621440-3145727/4194304'} headers\n- Already matched any │ │
│ │                 request with {'Content-Length': '524288'} headers\n\nIf  │ │
│ │                 you wanted to reuse an already matched response instead  │ │
│ │                 of registering it again, refer to                        │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │           exc = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Patch-Content-Range': 'bytes 524288-1048575/4194304',  │ │
│ │                 'Content-Length': '524288'} headers amongst:\n- Match    │ │
│ │                 any request with {'Patch-Content-Range': 'bytes          │ │
│ │                 2621440-3145727/4194304'} headers\n- Already matched any │ │
│ │                 request with {'Content-Length': '524288'} headers\n\nIf  │ │
│ │                 you wanted to reuse an already matched response instead  │ │
│ │                 of registering it again, refer to                        │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │   file_hasher = <md5 _hashlib.HASH object @ 0x7f51bbaafd30>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1933 in patch       │
│                                                                              │
│   1930 │   │                                                                 │
│   1931 │   │   **Parameters**: See `httpx.request`.                          │
│   1932 │   │   """                                                           │
│ ❱ 1933 │   │   return await self.request(                                    │
│   1934 │   │   │   "PATCH",                                                  │
│   1935 │   │   │   url,                                                      │
│   1936 │   │   │   content=content,                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f51badfb6d0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1540 in request     │
│                                                                              │
│   1537 │   │   │   timeout=timeout,                                          │
│   1538 │   │   │   extensions=extensions,                                    │
│   1539 │   │   )                                                             │
│ ❱ 1540 │   │   return await self.send(request, auth=auth, follow_redirects=f │
│   1541 │                                                                     │
│   1542 │   @asynccontextmanager                                              │
│   1543 │   async def stream(                                                 │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           method = 'PATCH'                                               │ │
│ │           params = None                                                  │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51badfb6d0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1629 in send        │
│                                                                              │
│   1626 │   │                                                                 │
│   1627 │   │   auth = self._build_request_auth(request, auth)                │
│   1628 │   │                                                                 │
│ ❱ 1629 │   │   response = await self._send_handling_auth(                    │
│   1630 │   │   │   request,                                                  │
│   1631 │   │   │   auth=auth,                                                │
│   1632 │   │   │   follow_redirects=follow_redirects,                        │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │             auth = <httpx.Auth object at 0x7f51bae25750>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51badfb6d0>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1657 in             │
│ _send_handling_auth                                                          │
│                                                                              │
│   1654 │   │   │   request = await auth_flow.__anext__()                     │
│   1655 │   │   │                                                             │
│   1656 │   │   │   while True:                                               │
│ ❱ 1657 │   │   │   │   response = await self._send_handling_redirects(       │
│   1658 │   │   │   │   │   request,                                          │
│   1659 │   │   │   │   │   follow_redirects=follow_redirects,                │
│   1660 │   │   │   │   │   history=history,                                  │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx.Auth object at 0x7f51bae25750>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f51bba38220>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51badfb6d0>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1694 in             │
│ _send_handling_redirects                                                     │
│                                                                              │
│   1691 │   │   │   for hook in self._event_hooks["request"]:                 │
│   1692 │   │   │   │   await hook(request)                                   │
│   1693 │   │   │                                                             │
│ ❱ 1694 │   │   │   response = await self._send_single_request(request)       │
│   1695 │   │   │   try:                                                      │
│   1696 │   │   │   │   for hook in self._event_hooks["response"]:            │
│   1697 │   │   │   │   │   await hook(response)                              │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │ follow_redirects = False                                           │       │
│ │          history = []                                              │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51badfb6d0>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1730 in             │
│ _send_single_request                                                         │
│                                                                              │
│   1727 │   │   │   )                                                         │
│   1728 │   │                                                                 │
│   1729 │   │   with request_context(request=request):                        │
│ ❱ 1730 │   │   │   response = await transport.handle_async_request(request)  │
│   1731 │   │                                                                 │
│   1732 │   │   assert isinstance(response.stream, AsyncByteStream)           │
│   1733 │   │   response.request = request                                    │
│                                                                              │
│ ╭──────────────────────────── locals ─────────────────────────────╮          │
│ │   request = <Request('PATCH', 'http://example.org/upload')>     │          │
│ │      self = <httpx.AsyncClient object at 0x7f51badfb6d0>        │          │
│ │     start = 147.262615907                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51badf9d90> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/__init__.py:56 in       │
│ mocked_handle_async_request                                                  │
│                                                                              │
│   53 │   │   transport: httpx.AsyncHTTPTransport, request: httpx.Request     │
│   54 │   ) -> httpx.Response:                                                │
│   55 │   │   if options.should_mock(request):                                │
│ ❱ 56 │   │   │   return await mock._handle_async_request(transport, request) │
│   57 │   │   return await real_handle_async_request(transport, request)      │
│   58 │                                                                       │
│   59 │   monkeypatch.setattr(                                                │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │      mock = <pytest_httpx._httpx_mock.HTTPXMock object at                │ │
│ │             0x7f51badf9f90>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f51badfb510>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51badf9d90>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:183 in   │
│ _handle_async_request                                                        │
│                                                                              │
│   180 │   │   │   │   │   response = await response                          │
│   181 │   │   │   │   return _unread(response)                               │
│   182 │   │                                                                  │
│ ❱ 183 │   │   self._request_not_matched(real_transport, request)             │
│   184 │                                                                      │
│   185 │   def _request_not_matched(                                          │
│   186 │   │   self,                                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       callback = None                                                    │ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51badf9d90>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51badf9f90>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:191 in   │
│ _request_not_matched                                                         │
│                                                                              │
│   188 │   │   request: httpx.Request,                                        │
│   189 │   ) -> NoReturn:                                                     │
│   190 │   │   self._requests_not_matched.append(request)                     │
│ ❱ 191 │   │   raise httpx.TimeoutException(                                  │
│   192 │   │   │   self._explain_that_no_response_was_found(real_transport, r │
│   193 │   │   │   request=request,                                           │
│   194 │   │   )                                                              │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51badf9d90>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51badf9f90>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
TimeoutException: No response can be found for PATCH request on 
http://example.org/upload with {'Patch-Content-Range': 'bytes 
524288-1048575/4194304', 'Content-Length': '524288'} headers amongst:
- Match any request with {'Patch-Content-Range': 'bytes 
2621440-3145727/4194304'} headers
- Already matched any request with {'Content-Length': '524288'} headers

If you wanted to reuse an already matched response instead of registering it 
again, refer to 
https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-
a-response-for-more-than-one-request

2025-01-02 09:54:46 [debug    ] patching                       attempt=3 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 09:54:46 [error    ] retrying                       attempt=3
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /builds/infrastructure/obs-proxy/obs_proxy/chunked_uploads/client.py:84 in   │
│ upload_chunked                                                               │
│                                                                              │
│    81 │   │   │   for attempt in range(MAX_ATTEMPTS):                        │
│    82 │   │   │   │   try:                                                   │
│    83 │   │   │   │   │   logger.debug("patching", uri=uri, size=len(chunk), │
│ ❱  84 │   │   │   │   │   r = await client.patch(                            │
│    85 │   │   │   │   │   │   uri,                                           │
│    86 │   │   │   │   │   │   content=chunk,                                 │
│    87 │   │   │   │   │   │   headers=chunk_headers,                         │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       attempt = 3                                                        │ │
│ │         chunk = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\… │ │
│ │ chunk_headers = {                                                        │ │
│ │                 │   'Patch-Content-Range': 'bytes                        │ │
│ │                 524288-1048575/4194304',                                 │ │
│ │                 │   'Content-Length': '524288'                           │ │
│ │                 }                                                        │ │
│ │    chunk_size = 524288                                                   │ │
│ │        client = <httpx.AsyncClient object at 0x7f51badfb6d0>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f51badf8c90> wrapping <_io.BufferedReader          │ │
│ │                 name='/tmp/pytest-of-root/pytest-0/test_upload_chunked_… │ │
│ │             e = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Patch-Content-Range': 'bytes 524288-1048575/4194304',  │ │
│ │                 'Content-Length': '524288'} headers amongst:\n- Match    │ │
│ │                 any request with {'Patch-Content-Range': 'bytes          │ │
│ │                 2621440-3145727/4194304'} headers\n- Already matched any │ │
│ │                 request with {'Content-Length': '524288'} headers\n\nIf  │ │
│ │                 you wanted to reuse an already matched response instead  │ │
│ │                 of registering it again, refer to                        │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │           exc = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Patch-Content-Range': 'bytes 524288-1048575/4194304',  │ │
│ │                 'Content-Length': '524288'} headers amongst:\n- Match    │ │
│ │                 any request with {'Patch-Content-Range': 'bytes          │ │
│ │                 2621440-3145727/4194304'} headers\n- Already matched any │ │
│ │                 request with {'Content-Length': '524288'} headers\n\nIf  │ │
│ │                 you wanted to reuse an already matched response instead  │ │
│ │                 of registering it again, refer to                        │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │   file_hasher = <md5 _hashlib.HASH object @ 0x7f51bbaafd30>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1933 in patch       │
│                                                                              │
│   1930 │   │                                                                 │
│   1931 │   │   **Parameters**: See `httpx.request`.                          │
│   1932 │   │   """                                                           │
│ ❱ 1933 │   │   return await self.request(                                    │
│   1934 │   │   │   "PATCH",                                                  │
│   1935 │   │   │   url,                                                      │
│   1936 │   │   │   content=content,                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f51badfb6d0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1540 in request     │
│                                                                              │
│   1537 │   │   │   timeout=timeout,                                          │
│   1538 │   │   │   extensions=extensions,                                    │
│   1539 │   │   )                                                             │
│ ❱ 1540 │   │   return await self.send(request, auth=auth, follow_redirects=f │
│   1541 │                                                                     │
│   1542 │   @asynccontextmanager                                              │
│   1543 │   async def stream(                                                 │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           method = 'PATCH'                                               │ │
│ │           params = None                                                  │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51badfb6d0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1629 in send        │
│                                                                              │
│   1626 │   │                                                                 │
│   1627 │   │   auth = self._build_request_auth(request, auth)                │
│   1628 │   │                                                                 │
│ ❱ 1629 │   │   response = await self._send_handling_auth(                    │
│   1630 │   │   │   request,                                                  │
│   1631 │   │   │   auth=auth,                                                │
│   1632 │   │   │   follow_redirects=follow_redirects,                        │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │             auth = <httpx.Auth object at 0x7f51bbacac10>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51badfb6d0>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1657 in             │
│ _send_handling_auth                                                          │
│                                                                              │
│   1654 │   │   │   request = await auth_flow.__anext__()                     │
│   1655 │   │   │                                                             │
│   1656 │   │   │   while True:                                               │
│ ❱ 1657 │   │   │   │   response = await self._send_handling_redirects(       │
│   1658 │   │   │   │   │   request,                                          │
│   1659 │   │   │   │   │   follow_redirects=follow_redirects,                │
│   1660 │   │   │   │   │   history=history,                                  │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx.Auth object at 0x7f51bbacac10>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f51bc2f6d40>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51badfb6d0>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1694 in             │
│ _send_handling_redirects                                                     │
│                                                                              │
│   1691 │   │   │   for hook in self._event_hooks["request"]:                 │
│   1692 │   │   │   │   await hook(request)                                   │
│   1693 │   │   │                                                             │
│ ❱ 1694 │   │   │   response = await self._send_single_request(request)       │
│   1695 │   │   │   try:                                                      │
│   1696 │   │   │   │   for hook in self._event_hooks["response"]:            │
│   1697 │   │   │   │   │   await hook(response)                              │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │ follow_redirects = False                                           │       │
│ │          history = []                                              │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51badfb6d0>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1730 in             │
│ _send_single_request                                                         │
│                                                                              │
│   1727 │   │   │   )                                                         │
│   1728 │   │                                                                 │
│   1729 │   │   with request_context(request=request):                        │
│ ❱ 1730 │   │   │   response = await transport.handle_async_request(request)  │
│   1731 │   │                                                                 │
│   1732 │   │   assert isinstance(response.stream, AsyncByteStream)           │
│   1733 │   │   response.request = request                                    │
│                                                                              │
│ ╭──────────────────────────── locals ─────────────────────────────╮          │
│ │   request = <Request('PATCH', 'http://example.org/upload')>     │          │
│ │      self = <httpx.AsyncClient object at 0x7f51badfb6d0>        │          │
│ │     start = 148.349859744                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51badf9d90> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/__init__.py:56 in       │
│ mocked_handle_async_request                                                  │
│                                                                              │
│   53 │   │   transport: httpx.AsyncHTTPTransport, request: httpx.Request     │
│   54 │   ) -> httpx.Response:                                                │
│   55 │   │   if options.should_mock(request):                                │
│ ❱ 56 │   │   │   return await mock._handle_async_request(transport, request) │
│   57 │   │   return await real_handle_async_request(transport, request)      │
│   58 │                                                                       │
│   59 │   monkeypatch.setattr(                                                │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │      mock = <pytest_httpx._httpx_mock.HTTPXMock object at                │ │
│ │             0x7f51badf9f90>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f51badfb510>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51badf9d90>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:183 in   │
│ _handle_async_request                                                        │
│                                                                              │
│   180 │   │   │   │   │   response = await response                          │
│   181 │   │   │   │   return _unread(response)                               │
│   182 │   │                                                                  │
│ ❱ 183 │   │   self._request_not_matched(real_transport, request)             │
│   184 │                                                                      │
│   185 │   def _request_not_matched(                                          │
│   186 │   │   self,                                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       callback = None                                                    │ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51badf9d90>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51badf9f90>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:191 in   │
│ _request_not_matched                                                         │
│                                                                              │
│   188 │   │   request: httpx.Request,                                        │
│   189 │   ) -> NoReturn:                                                     │
│   190 │   │   self._requests_not_matched.append(request)                     │
│ ❱ 191 │   │   raise httpx.TimeoutException(                                  │
│   192 │   │   │   self._explain_that_no_response_was_found(real_transport, r │
│   193 │   │   │   request=request,                                           │
│   194 │   │   )                                                              │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51badf9d90>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51badf9f90>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
TimeoutException: No response can be found for PATCH request on 
http://example.org/upload with {'Patch-Content-Range': 'bytes 
524288-1048575/4194304', 'Content-Length': '524288'} headers amongst:
- Match any request with {'Patch-Content-Range': 'bytes 
2621440-3145727/4194304'} headers
- Already matched any request with {'Content-Length': '524288'} headers

If you wanted to reuse an already matched response instead of registering it 
again, refer to 
https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-
a-response-for-more-than-one-request

2025-01-02 09:54:47 [debug    ] patching                       attempt=4 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 09:54:47 [error    ] retrying                       attempt=4
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /builds/infrastructure/obs-proxy/obs_proxy/chunked_uploads/client.py:84 in   │
│ upload_chunked                                                               │
│                                                                              │
│    81 │   │   │   for attempt in range(MAX_ATTEMPTS):                        │
│    82 │   │   │   │   try:                                                   │
│    83 │   │   │   │   │   logger.debug("patching", uri=uri, size=len(chunk), │
│ ❱  84 │   │   │   │   │   r = await client.patch(                            │
│    85 │   │   │   │   │   │   uri,                                           │
│    86 │   │   │   │   │   │   content=chunk,                                 │
│    87 │   │   │   │   │   │   headers=chunk_headers,                         │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       attempt = 4                                                        │ │
│ │         chunk = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\… │ │
│ │ chunk_headers = {                                                        │ │
│ │                 │   'Patch-Content-Range': 'bytes                        │ │
│ │                 524288-1048575/4194304',                                 │ │
│ │                 │   'Content-Length': '524288'                           │ │
│ │                 }                                                        │ │
│ │    chunk_size = 524288                                                   │ │
│ │        client = <httpx.AsyncClient object at 0x7f51badfb6d0>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f51badf8c90> wrapping <_io.BufferedReader          │ │
│ │                 name='/tmp/pytest-of-root/pytest-0/test_upload_chunked_… │ │
│ │             e = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Patch-Content-Range': 'bytes 524288-1048575/4194304',  │ │
│ │                 'Content-Length': '524288'} headers amongst:\n- Match    │ │
│ │                 any request with {'Patch-Content-Range': 'bytes          │ │
│ │                 2621440-3145727/4194304'} headers\n- Already matched any │ │
│ │                 request with {'Content-Length': '524288'} headers\n\nIf  │ │
│ │                 you wanted to reuse an already matched response instead  │ │
│ │                 of registering it again, refer to                        │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │           exc = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Patch-Content-Range': 'bytes 524288-1048575/4194304',  │ │
│ │                 'Content-Length': '524288'} headers amongst:\n- Match    │ │
│ │                 any request with {'Patch-Content-Range': 'bytes          │ │
│ │                 2621440-3145727/4194304'} headers\n- Already matched any │ │
│ │                 request with {'Content-Length': '524288'} headers\n\nIf  │ │
│ │                 you wanted to reuse an already matched response instead  │ │
│ │                 of registering it again, refer to                        │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │   file_hasher = <md5 _hashlib.HASH object @ 0x7f51bbaafd30>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1933 in patch       │
│                                                                              │
│   1930 │   │                                                                 │
│   1931 │   │   **Parameters**: See `httpx.request`.                          │
│   1932 │   │   """                                                           │
│ ❱ 1933 │   │   return await self.request(                                    │
│   1934 │   │   │   "PATCH",                                                  │
│   1935 │   │   │   url,                                                      │
│   1936 │   │   │   content=content,                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f51badfb6d0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1540 in request     │
│                                                                              │
│   1537 │   │   │   timeout=timeout,                                          │
│   1538 │   │   │   extensions=extensions,                                    │
│   1539 │   │   )                                                             │
│ ❱ 1540 │   │   return await self.send(request, auth=auth, follow_redirects=f │
│   1541 │                                                                     │
│   1542 │   @asynccontextmanager                                              │
│   1543 │   async def stream(                                                 │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           method = 'PATCH'                                               │ │
│ │           params = None                                                  │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51badfb6d0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1629 in send        │
│                                                                              │
│   1626 │   │                                                                 │
│   1627 │   │   auth = self._build_request_auth(request, auth)                │
│   1628 │   │                                                                 │
│ ❱ 1629 │   │   response = await self._send_handling_auth(                    │
│   1630 │   │   │   request,                                                  │
│   1631 │   │   │   auth=auth,                                                │
│   1632 │   │   │   follow_redirects=follow_redirects,                        │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │             auth = <httpx.Auth object at 0x7f51bbdd33d0>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51badfb6d0>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1657 in             │
│ _send_handling_auth                                                          │
│                                                                              │
│   1654 │   │   │   request = await auth_flow.__anext__()                     │
│   1655 │   │   │                                                             │
│   1656 │   │   │   while True:                                               │
│ ❱ 1657 │   │   │   │   response = await self._send_handling_redirects(       │
│   1658 │   │   │   │   │   request,                                          │
│   1659 │   │   │   │   │   follow_redirects=follow_redirects,                │
│   1660 │   │   │   │   │   history=history,                                  │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx.Auth object at 0x7f51bbdd33d0>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f51bba38c70>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51badfb6d0>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1694 in             │
│ _send_handling_redirects                                                     │
│                                                                              │
│   1691 │   │   │   for hook in self._event_hooks["request"]:                 │
│   1692 │   │   │   │   await hook(request)                                   │
│   1693 │   │   │                                                             │
│ ❱ 1694 │   │   │   response = await self._send_single_request(request)       │
│   1695 │   │   │   try:                                                      │
│   1696 │   │   │   │   for hook in self._event_hooks["response"]:            │
│   1697 │   │   │   │   │   await hook(response)                              │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │ follow_redirects = False                                           │       │
│ │          history = []                                              │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51badfb6d0>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1730 in             │
│ _send_single_request                                                         │
│                                                                              │
│   1727 │   │   │   )                                                         │
│   1728 │   │                                                                 │
│   1729 │   │   with request_context(request=request):                        │
│ ❱ 1730 │   │   │   response = await transport.handle_async_request(request)  │
│   1731 │   │                                                                 │
│   1732 │   │   assert isinstance(response.stream, AsyncByteStream)           │
│   1733 │   │   response.request = request                                    │
│                                                                              │
│ ╭──────────────────────────── locals ─────────────────────────────╮          │
│ │   request = <Request('PATCH', 'http://example.org/upload')>     │          │
│ │      self = <httpx.AsyncClient object at 0x7f51badfb6d0>        │          │
│ │     start = 149.368643594                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51badf9d90> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/__init__.py:56 in       │
│ mocked_handle_async_request                                                  │
│                                                                              │
│   53 │   │   transport: httpx.AsyncHTTPTransport, request: httpx.Request     │
│   54 │   ) -> httpx.Response:                                                │
│   55 │   │   if options.should_mock(request):                                │
│ ❱ 56 │   │   │   return await mock._handle_async_request(transport, request) │
│   57 │   │   return await real_handle_async_request(transport, request)      │
│   58 │                                                                       │
│   59 │   monkeypatch.setattr(                                                │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │      mock = <pytest_httpx._httpx_mock.HTTPXMock object at                │ │
│ │             0x7f51badf9f90>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f51badfb510>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51badf9d90>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:183 in   │
│ _handle_async_request                                                        │
│                                                                              │
│   180 │   │   │   │   │   response = await response                          │
│   181 │   │   │   │   return _unread(response)                               │
│   182 │   │                                                                  │
│ ❱ 183 │   │   self._request_not_matched(real_transport, request)             │
│   184 │                                                                      │
│   185 │   def _request_not_matched(                                          │
│   186 │   │   self,                                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       callback = None                                                    │ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51badf9d90>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51badf9f90>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:191 in   │
│ _request_not_matched                                                         │
│                                                                              │
│   188 │   │   request: httpx.Request,                                        │
│   189 │   ) -> NoReturn:                                                     │
│   190 │   │   self._requests_not_matched.append(request)                     │
│ ❱ 191 │   │   raise httpx.TimeoutException(                                  │
│   192 │   │   │   self._explain_that_no_response_was_found(real_transport, r │
│   193 │   │   │   request=request,                                           │
│   194 │   │   )                                                              │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51badf9d90>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51badf9f90>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
TimeoutException: No response can be found for PATCH request on 
http://example.org/upload with {'Patch-Content-Range': 'bytes 
524288-1048575/4194304', 'Content-Length': '524288'} headers amongst:
- Match any request with {'Patch-Content-Range': 'bytes 
2621440-3145727/4194304'} headers
- Already matched any request with {'Content-Length': '524288'} headers

If you wanted to reuse an already matched response instead of registering it 
again, refer to 
https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-
a-response-for-more-than-one-request

_______ ERROR at teardown of test_upload_chunked_transient_server_error ________

monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7f51bba09490>
request = <SubRequest 'httpx_mock' for <Coroutine test_upload_chunked_transient_server_error>>

    @pytest.fixture
    def httpx_mock(
        monkeypatch: MonkeyPatch,
        request: FixtureRequest,
    ) -> Generator[HTTPXMock, None, None]:
        options = {}
        for marker in request.node.iter_markers("httpx_mock"):
            options = marker.kwargs | options
        __tracebackhide__ = methodcaller("errisinstance", TypeError)
        options = _HTTPXMockOptions(**options)
    
        mock = HTTPXMock(options)
    
        # Mock synchronous requests
        real_handle_request = httpx.HTTPTransport.handle_request
    
        def mocked_handle_request(
            transport: httpx.HTTPTransport, request: httpx.Request
        ) -> httpx.Response:
            if options.should_mock(request):
                return mock._handle_request(transport, request)
            return real_handle_request(transport, request)
    
        monkeypatch.setattr(
            httpx.HTTPTransport,
            "handle_request",
            mocked_handle_request,
        )
    
        # Mock asynchronous requests
        real_handle_async_request = httpx.AsyncHTTPTransport.handle_async_request
    
        async def mocked_handle_async_request(
            transport: httpx.AsyncHTTPTransport, request: httpx.Request
        ) -> httpx.Response:
            if options.should_mock(request):
                return await mock._handle_async_request(transport, request)
            return await real_handle_async_request(transport, request)
    
        monkeypatch.setattr(
            httpx.AsyncHTTPTransport,
            "handle_async_request",
            mocked_handle_async_request,
        )
    
        yield mock
        try:
>           mock._assert_options()

/usr/local/lib/python3.11/site-packages/pytest_httpx/__init__.py:67: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <pytest_httpx._httpx_mock.HTTPXMock object at 0x7f51bba09fd0>

    def _assert_options(self) -> None:
        callbacks_not_executed = [
            matcher for matcher, _ in self._callbacks if matcher.should_have_matched()
        ]
        matchers_description = "\n".join(
            [f"- {matcher}" for matcher in callbacks_not_executed]
        )
    
>       assert not callbacks_not_executed, (
            "The following responses are mocked but not requested:\n"
            f"{matchers_description}\n"
            "\n"
            "If this is on purpose, refer to https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-more-responses-than-what-will-be-requested"
        )
E       AssertionError: The following responses are mocked but not requested:
E         - Match any request with {'Patch-Content-Range': 'bytes 2621440-3145727/4194304'} headers
E         
E         If this is on purpose, refer to https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-more-responses-than-what-will-be-requested
E       assert not [<pytest_httpx._request_matcher._RequestMatcher object at 0x7f51bba09e50>]

/usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:319: AssertionError
----------------------------- Captured stdout call -----------------------------
2025-01-02 09:54:49 [debug    ] patching                       attempt=0 content_range=<ContentRange 'bytes 0-524287/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 09:54:49 [debug    ] patch result                   result=<Response [200 OK]>
2025-01-02 09:54:49 [debug    ] patching                       attempt=0 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 09:54:49 [error    ] retrying                       attempt=0
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /builds/infrastructure/obs-proxy/obs_proxy/chunked_uploads/client.py:84 in   │
│ upload_chunked                                                               │
│                                                                              │
│    81 │   │   │   for attempt in range(MAX_ATTEMPTS):                        │
│    82 │   │   │   │   try:                                                   │
│    83 │   │   │   │   │   logger.debug("patching", uri=uri, size=len(chunk), │
│ ❱  84 │   │   │   │   │   r = await client.patch(                            │
│    85 │   │   │   │   │   │   uri,                                           │
│    86 │   │   │   │   │   │   content=chunk,                                 │
│    87 │   │   │   │   │   │   headers=chunk_headers,                         │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       attempt = 0                                                        │ │
│ │         chunk = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\… │ │
│ │ chunk_headers = {                                                        │ │
│ │                 │   'Patch-Content-Range': 'bytes                        │ │
│ │                 524288-1048575/4194304',                                 │ │
│ │                 │   'Content-Length': '524288'                           │ │
│ │                 }                                                        │ │
│ │    chunk_size = 524288                                                   │ │
│ │        client = <httpx.AsyncClient object at 0x7f51bba09cd0>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f51bba61e10> wrapping <_io.BufferedReader          │ │
│ │                 name='/tmp/pytest-of-root/pytest-0/test_upload_chunked_… │ │
│ │             e = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Patch-Content-Range': 'bytes 524288-1048575/4194304',  │ │
│ │                 'Content-Length': '524288'} headers amongst:\n- Match    │ │
│ │                 any request with {'Patch-Content-Range': 'bytes          │ │
│ │                 2621440-3145727/4194304'} headers\n- Already matched any │ │
│ │                 request with {'Content-Length': '524288'} headers\n\nIf  │ │
│ │                 you wanted to reuse an already matched response instead  │ │
│ │                 of registering it again, refer to                        │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │           exc = None                                                     │ │
│ │   file_hasher = <md5 _hashlib.HASH object @ 0x7f51bb902810>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1933 in patch       │
│                                                                              │
│   1930 │   │                                                                 │
│   1931 │   │   **Parameters**: See `httpx.request`.                          │
│   1932 │   │   """                                                           │
│ ❱ 1933 │   │   return await self.request(                                    │
│   1934 │   │   │   "PATCH",                                                  │
│   1935 │   │   │   url,                                                      │
│   1936 │   │   │   content=content,                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bba09cd0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1540 in request     │
│                                                                              │
│   1537 │   │   │   timeout=timeout,                                          │
│   1538 │   │   │   extensions=extensions,                                    │
│   1539 │   │   )                                                             │
│ ❱ 1540 │   │   return await self.send(request, auth=auth, follow_redirects=f │
│   1541 │                                                                     │
│   1542 │   @asynccontextmanager                                              │
│   1543 │   async def stream(                                                 │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           method = 'PATCH'                                               │ │
│ │           params = None                                                  │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bba09cd0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1629 in send        │
│                                                                              │
│   1626 │   │                                                                 │
│   1627 │   │   auth = self._build_request_auth(request, auth)                │
│   1628 │   │                                                                 │
│ ❱ 1629 │   │   response = await self._send_handling_auth(                    │
│   1630 │   │   │   request,                                                  │
│   1631 │   │   │   auth=auth,                                                │
│   1632 │   │   │   follow_redirects=follow_redirects,                        │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │             auth = <httpx.Auth object at 0x7f51bba621d0>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51bba09cd0>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1657 in             │
│ _send_handling_auth                                                          │
│                                                                              │
│   1654 │   │   │   request = await auth_flow.__anext__()                     │
│   1655 │   │   │                                                             │
│   1656 │   │   │   while True:                                               │
│ ❱ 1657 │   │   │   │   response = await self._send_handling_redirects(       │
│   1658 │   │   │   │   │   request,                                          │
│   1659 │   │   │   │   │   follow_redirects=follow_redirects,                │
│   1660 │   │   │   │   │   history=history,                                  │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx.Auth object at 0x7f51bba621d0>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f51bbb7fb50>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bba09cd0>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1694 in             │
│ _send_handling_redirects                                                     │
│                                                                              │
│   1691 │   │   │   for hook in self._event_hooks["request"]:                 │
│   1692 │   │   │   │   await hook(request)                                   │
│   1693 │   │   │                                                             │
│ ❱ 1694 │   │   │   response = await self._send_single_request(request)       │
│   1695 │   │   │   try:                                                      │
│   1696 │   │   │   │   for hook in self._event_hooks["response"]:            │
│   1697 │   │   │   │   │   await hook(response)                              │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │ follow_redirects = False                                           │       │
│ │          history = []                                              │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51bba09cd0>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1730 in             │
│ _send_single_request                                                         │
│                                                                              │
│   1727 │   │   │   )                                                         │
│   1728 │   │                                                                 │
│   1729 │   │   with request_context(request=request):                        │
│ ❱ 1730 │   │   │   response = await transport.handle_async_request(request)  │
│   1731 │   │                                                                 │
│   1732 │   │   assert isinstance(response.stream, AsyncByteStream)           │
│   1733 │   │   response.request = request                                    │
│                                                                              │
│ ╭──────────────────────────── locals ─────────────────────────────╮          │
│ │   request = <Request('PATCH', 'http://example.org/upload')>     │          │
│ │      self = <httpx.AsyncClient object at 0x7f51bba09cd0>        │          │
│ │     start = 150.656830374                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51bba63a90> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/__init__.py:56 in       │
│ mocked_handle_async_request                                                  │
│                                                                              │
│   53 │   │   transport: httpx.AsyncHTTPTransport, request: httpx.Request     │
│   54 │   ) -> httpx.Response:                                                │
│   55 │   │   if options.should_mock(request):                                │
│ ❱ 56 │   │   │   return await mock._handle_async_request(transport, request) │
│   57 │   │   return await real_handle_async_request(transport, request)      │
│   58 │                                                                       │
│   59 │   monkeypatch.setattr(                                                │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │      mock = <pytest_httpx._httpx_mock.HTTPXMock object at                │ │
│ │             0x7f51bba09fd0>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f51bba09090>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51bba63a90>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:183 in   │
│ _handle_async_request                                                        │
│                                                                              │
│   180 │   │   │   │   │   response = await response                          │
│   181 │   │   │   │   return _unread(response)                               │
│   182 │   │                                                                  │
│ ❱ 183 │   │   self._request_not_matched(real_transport, request)             │
│   184 │                                                                      │
│   185 │   def _request_not_matched(                                          │
│   186 │   │   self,                                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       callback = None                                                    │ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51bba63a90>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51bba09fd0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:191 in   │
│ _request_not_matched                                                         │
│                                                                              │
│   188 │   │   request: httpx.Request,                                        │
│   189 │   ) -> NoReturn:                                                     │
│   190 │   │   self._requests_not_matched.append(request)                     │
│ ❱ 191 │   │   raise httpx.TimeoutException(                                  │
│   192 │   │   │   self._explain_that_no_response_was_found(real_transport, r │
│   193 │   │   │   request=request,                                           │
│   194 │   │   )                                                              │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51bba63a90>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51bba09fd0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
TimeoutException: No response can be found for PATCH request on 
http://example.org/upload with {'Patch-Content-Range': 'bytes 
524288-1048575/4194304', 'Content-Length': '524288'} headers amongst:
- Match any request with {'Patch-Content-Range': 'bytes 
2621440-3145727/4194304'} headers
- Already matched any request with {'Content-Length': '524288'} headers

If you wanted to reuse an already matched response instead of registering it 
again, refer to 
https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-
a-response-for-more-than-one-request

2025-01-02 09:54:50 [debug    ] patching                       attempt=1 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 09:54:50 [error    ] retrying                       attempt=1
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /builds/infrastructure/obs-proxy/obs_proxy/chunked_uploads/client.py:84 in   │
│ upload_chunked                                                               │
│                                                                              │
│    81 │   │   │   for attempt in range(MAX_ATTEMPTS):                        │
│    82 │   │   │   │   try:                                                   │
│    83 │   │   │   │   │   logger.debug("patching", uri=uri, size=len(chunk), │
│ ❱  84 │   │   │   │   │   r = await client.patch(                            │
│    85 │   │   │   │   │   │   uri,                                           │
│    86 │   │   │   │   │   │   content=chunk,                                 │
│    87 │   │   │   │   │   │   headers=chunk_headers,                         │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       attempt = 1                                                        │ │
│ │         chunk = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\… │ │
│ │ chunk_headers = {                                                        │ │
│ │                 │   'Patch-Content-Range': 'bytes                        │ │
│ │                 524288-1048575/4194304',                                 │ │
│ │                 │   'Content-Length': '524288'                           │ │
│ │                 }                                                        │ │
│ │    chunk_size = 524288                                                   │ │
│ │        client = <httpx.AsyncClient object at 0x7f51bba09cd0>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f51bba61e10> wrapping <_io.BufferedReader          │ │
│ │                 name='/tmp/pytest-of-root/pytest-0/test_upload_chunked_… │ │
│ │             e = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Patch-Content-Range': 'bytes 524288-1048575/4194304',  │ │
│ │                 'Content-Length': '524288'} headers amongst:\n- Match    │ │
│ │                 any request with {'Patch-Content-Range': 'bytes          │ │
│ │                 2621440-3145727/4194304'} headers\n- Already matched any │ │
│ │                 request with {'Content-Length': '524288'} headers\n\nIf  │ │
│ │                 you wanted to reuse an already matched response instead  │ │
│ │                 of registering it again, refer to                        │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │           exc = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Patch-Content-Range': 'bytes 524288-1048575/4194304',  │ │
│ │                 'Content-Length': '524288'} headers amongst:\n- Match    │ │
│ │                 any request with {'Patch-Content-Range': 'bytes          │ │
│ │                 2621440-3145727/4194304'} headers\n- Already matched any │ │
│ │                 request with {'Content-Length': '524288'} headers\n\nIf  │ │
│ │                 you wanted to reuse an already matched response instead  │ │
│ │                 of registering it again, refer to                        │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │   file_hasher = <md5 _hashlib.HASH object @ 0x7f51bb902810>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1933 in patch       │
│                                                                              │
│   1930 │   │                                                                 │
│   1931 │   │   **Parameters**: See `httpx.request`.                          │
│   1932 │   │   """                                                           │
│ ❱ 1933 │   │   return await self.request(                                    │
│   1934 │   │   │   "PATCH",                                                  │
│   1935 │   │   │   url,                                                      │
│   1936 │   │   │   content=content,                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bba09cd0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1540 in request     │
│                                                                              │
│   1537 │   │   │   timeout=timeout,                                          │
│   1538 │   │   │   extensions=extensions,                                    │
│   1539 │   │   )                                                             │
│ ❱ 1540 │   │   return await self.send(request, auth=auth, follow_redirects=f │
│   1541 │                                                                     │
│   1542 │   @asynccontextmanager                                              │
│   1543 │   async def stream(                                                 │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           method = 'PATCH'                                               │ │
│ │           params = None                                                  │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bba09cd0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1629 in send        │
│                                                                              │
│   1626 │   │                                                                 │
│   1627 │   │   auth = self._build_request_auth(request, auth)                │
│   1628 │   │                                                                 │
│ ❱ 1629 │   │   response = await self._send_handling_auth(                    │
│   1630 │   │   │   request,                                                  │
│   1631 │   │   │   auth=auth,                                                │
│   1632 │   │   │   follow_redirects=follow_redirects,                        │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │             auth = <httpx.Auth object at 0x7f51bbc36ad0>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51bba09cd0>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1657 in             │
│ _send_handling_auth                                                          │
│                                                                              │
│   1654 │   │   │   request = await auth_flow.__anext__()                     │
│   1655 │   │   │                                                             │
│   1656 │   │   │   while True:                                               │
│ ❱ 1657 │   │   │   │   response = await self._send_handling_redirects(       │
│   1658 │   │   │   │   │   request,                                          │
│   1659 │   │   │   │   │   follow_redirects=follow_redirects,                │
│   1660 │   │   │   │   │   history=history,                                  │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx.Auth object at 0x7f51bbc36ad0>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f51bc2f73d0>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bba09cd0>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1694 in             │
│ _send_handling_redirects                                                     │
│                                                                              │
│   1691 │   │   │   for hook in self._event_hooks["request"]:                 │
│   1692 │   │   │   │   await hook(request)                                   │
│   1693 │   │   │                                                             │
│ ❱ 1694 │   │   │   response = await self._send_single_request(request)       │
│   1695 │   │   │   try:                                                      │
│   1696 │   │   │   │   for hook in self._event_hooks["response"]:            │
│   1697 │   │   │   │   │   await hook(response)                              │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │ follow_redirects = False                                           │       │
│ │          history = []                                              │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51bba09cd0>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1730 in             │
│ _send_single_request                                                         │
│                                                                              │
│   1727 │   │   │   )                                                         │
│   1728 │   │                                                                 │
│   1729 │   │   with request_context(request=request):                        │
│ ❱ 1730 │   │   │   response = await transport.handle_async_request(request)  │
│   1731 │   │                                                                 │
│   1732 │   │   assert isinstance(response.stream, AsyncByteStream)           │
│   1733 │   │   response.request = request                                    │
│                                                                              │
│ ╭──────────────────────────── locals ─────────────────────────────╮          │
│ │   request = <Request('PATCH', 'http://example.org/upload')>     │          │
│ │      self = <httpx.AsyncClient object at 0x7f51bba09cd0>        │          │
│ │     start = 151.852035881                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51bba63a90> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/__init__.py:56 in       │
│ mocked_handle_async_request                                                  │
│                                                                              │
│   53 │   │   transport: httpx.AsyncHTTPTransport, request: httpx.Request     │
│   54 │   ) -> httpx.Response:                                                │
│   55 │   │   if options.should_mock(request):                                │
│ ❱ 56 │   │   │   return await mock._handle_async_request(transport, request) │
│   57 │   │   return await real_handle_async_request(transport, request)      │
│   58 │                                                                       │
│   59 │   monkeypatch.setattr(                                                │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │      mock = <pytest_httpx._httpx_mock.HTTPXMock object at                │ │
│ │             0x7f51bba09fd0>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f51bba09090>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51bba63a90>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:183 in   │
│ _handle_async_request                                                        │
│                                                                              │
│   180 │   │   │   │   │   response = await response                          │
│   181 │   │   │   │   return _unread(response)                               │
│   182 │   │                                                                  │
│ ❱ 183 │   │   self._request_not_matched(real_transport, request)             │
│   184 │                                                                      │
│   185 │   def _request_not_matched(                                          │
│   186 │   │   self,                                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       callback = None                                                    │ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51bba63a90>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51bba09fd0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:191 in   │
│ _request_not_matched                                                         │
│                                                                              │
│   188 │   │   request: httpx.Request,                                        │
│   189 │   ) -> NoReturn:                                                     │
│   190 │   │   self._requests_not_matched.append(request)                     │
│ ❱ 191 │   │   raise httpx.TimeoutException(                                  │
│   192 │   │   │   self._explain_that_no_response_was_found(real_transport, r │
│   193 │   │   │   request=request,                                           │
│   194 │   │   )                                                              │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51bba63a90>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51bba09fd0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
TimeoutException: No response can be found for PATCH request on 
http://example.org/upload with {'Patch-Content-Range': 'bytes 
524288-1048575/4194304', 'Content-Length': '524288'} headers amongst:
- Match any request with {'Patch-Content-Range': 'bytes 
2621440-3145727/4194304'} headers
- Already matched any request with {'Content-Length': '524288'} headers

If you wanted to reuse an already matched response instead of registering it 
again, refer to 
https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-
a-response-for-more-than-one-request

2025-01-02 09:54:51 [debug    ] patching                       attempt=2 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 09:54:51 [error    ] retrying                       attempt=2
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /builds/infrastructure/obs-proxy/obs_proxy/chunked_uploads/client.py:84 in   │
│ upload_chunked                                                               │
│                                                                              │
│    81 │   │   │   for attempt in range(MAX_ATTEMPTS):                        │
│    82 │   │   │   │   try:                                                   │
│    83 │   │   │   │   │   logger.debug("patching", uri=uri, size=len(chunk), │
│ ❱  84 │   │   │   │   │   r = await client.patch(                            │
│    85 │   │   │   │   │   │   uri,                                           │
│    86 │   │   │   │   │   │   content=chunk,                                 │
│    87 │   │   │   │   │   │   headers=chunk_headers,                         │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       attempt = 2                                                        │ │
│ │         chunk = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\… │ │
│ │ chunk_headers = {                                                        │ │
│ │                 │   'Patch-Content-Range': 'bytes                        │ │
│ │                 524288-1048575/4194304',                                 │ │
│ │                 │   'Content-Length': '524288'                           │ │
│ │                 }                                                        │ │
│ │    chunk_size = 524288                                                   │ │
│ │        client = <httpx.AsyncClient object at 0x7f51bba09cd0>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f51bba61e10> wrapping <_io.BufferedReader          │ │
│ │                 name='/tmp/pytest-of-root/pytest-0/test_upload_chunked_… │ │
│ │             e = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Patch-Content-Range': 'bytes 524288-1048575/4194304',  │ │
│ │                 'Content-Length': '524288'} headers amongst:\n- Match    │ │
│ │                 any request with {'Patch-Content-Range': 'bytes          │ │
│ │                 2621440-3145727/4194304'} headers\n- Already matched any │ │
│ │                 request with {'Content-Length': '524288'} headers\n\nIf  │ │
│ │                 you wanted to reuse an already matched response instead  │ │
│ │                 of registering it again, refer to                        │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │           exc = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Patch-Content-Range': 'bytes 524288-1048575/4194304',  │ │
│ │                 'Content-Length': '524288'} headers amongst:\n- Match    │ │
│ │                 any request with {'Patch-Content-Range': 'bytes          │ │
│ │                 2621440-3145727/4194304'} headers\n- Already matched any │ │
│ │                 request with {'Content-Length': '524288'} headers\n\nIf  │ │
│ │                 you wanted to reuse an already matched response instead  │ │
│ │                 of registering it again, refer to                        │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │   file_hasher = <md5 _hashlib.HASH object @ 0x7f51bb902810>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1933 in patch       │
│                                                                              │
│   1930 │   │                                                                 │
│   1931 │   │   **Parameters**: See `httpx.request`.                          │
│   1932 │   │   """                                                           │
│ ❱ 1933 │   │   return await self.request(                                    │
│   1934 │   │   │   "PATCH",                                                  │
│   1935 │   │   │   url,                                                      │
│   1936 │   │   │   content=content,                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bba09cd0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1540 in request     │
│                                                                              │
│   1537 │   │   │   timeout=timeout,                                          │
│   1538 │   │   │   extensions=extensions,                                    │
│   1539 │   │   )                                                             │
│ ❱ 1540 │   │   return await self.send(request, auth=auth, follow_redirects=f │
│   1541 │                                                                     │
│   1542 │   @asynccontextmanager                                              │
│   1543 │   async def stream(                                                 │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           method = 'PATCH'                                               │ │
│ │           params = None                                                  │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bba09cd0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1629 in send        │
│                                                                              │
│   1626 │   │                                                                 │
│   1627 │   │   auth = self._build_request_auth(request, auth)                │
│   1628 │   │                                                                 │
│ ❱ 1629 │   │   response = await self._send_handling_auth(                    │
│   1630 │   │   │   request,                                                  │
│   1631 │   │   │   auth=auth,                                                │
│   1632 │   │   │   follow_redirects=follow_redirects,                        │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │             auth = <httpx.Auth object at 0x7f51bc4b0890>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51bba09cd0>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1657 in             │
│ _send_handling_auth                                                          │
│                                                                              │
│   1654 │   │   │   request = await auth_flow.__anext__()                     │
│   1655 │   │   │                                                             │
│   1656 │   │   │   while True:                                               │
│ ❱ 1657 │   │   │   │   response = await self._send_handling_redirects(       │
│   1658 │   │   │   │   │   request,                                          │
│   1659 │   │   │   │   │   follow_redirects=follow_redirects,                │
│   1660 │   │   │   │   │   history=history,                                  │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx.Auth object at 0x7f51bc4b0890>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f51bbb7f4c0>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bba09cd0>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1694 in             │
│ _send_handling_redirects                                                     │
│                                                                              │
│   1691 │   │   │   for hook in self._event_hooks["request"]:                 │
│   1692 │   │   │   │   await hook(request)                                   │
│   1693 │   │   │                                                             │
│ ❱ 1694 │   │   │   response = await self._send_single_request(request)       │
│   1695 │   │   │   try:                                                      │
│   1696 │   │   │   │   for hook in self._event_hooks["response"]:            │
│   1697 │   │   │   │   │   await hook(response)                              │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │ follow_redirects = False                                           │       │
│ │          history = []                                              │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51bba09cd0>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1730 in             │
│ _send_single_request                                                         │
│                                                                              │
│   1727 │   │   │   )                                                         │
│   1728 │   │                                                                 │
│   1729 │   │   with request_context(request=request):                        │
│ ❱ 1730 │   │   │   response = await transport.handle_async_request(request)  │
│   1731 │   │                                                                 │
│   1732 │   │   assert isinstance(response.stream, AsyncByteStream)           │
│   1733 │   │   response.request = request                                    │
│                                                                              │
│ ╭──────────────────────────── locals ─────────────────────────────╮          │
│ │   request = <Request('PATCH', 'http://example.org/upload')>     │          │
│ │      self = <httpx.AsyncClient object at 0x7f51bba09cd0>        │          │
│ │     start = 153.118299928                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51bba63a90> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/__init__.py:56 in       │
│ mocked_handle_async_request                                                  │
│                                                                              │
│   53 │   │   transport: httpx.AsyncHTTPTransport, request: httpx.Request     │
│   54 │   ) -> httpx.Response:                                                │
│   55 │   │   if options.should_mock(request):                                │
│ ❱ 56 │   │   │   return await mock._handle_async_request(transport, request) │
│   57 │   │   return await real_handle_async_request(transport, request)      │
│   58 │                                                                       │
│   59 │   monkeypatch.setattr(                                                │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │      mock = <pytest_httpx._httpx_mock.HTTPXMock object at                │ │
│ │             0x7f51bba09fd0>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f51bba09090>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51bba63a90>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:183 in   │
│ _handle_async_request                                                        │
│                                                                              │
│   180 │   │   │   │   │   response = await response                          │
│   181 │   │   │   │   return _unread(response)                               │
│   182 │   │                                                                  │
│ ❱ 183 │   │   self._request_not_matched(real_transport, request)             │
│   184 │                                                                      │
│   185 │   def _request_not_matched(                                          │
│   186 │   │   self,                                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       callback = None                                                    │ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51bba63a90>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51bba09fd0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:191 in   │
│ _request_not_matched                                                         │
│                                                                              │
│   188 │   │   request: httpx.Request,                                        │
│   189 │   ) -> NoReturn:                                                     │
│   190 │   │   self._requests_not_matched.append(request)                     │
│ ❱ 191 │   │   raise httpx.TimeoutException(                                  │
│   192 │   │   │   self._explain_that_no_response_was_found(real_transport, r │
│   193 │   │   │   request=request,                                           │
│   194 │   │   )                                                              │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51bba63a90>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51bba09fd0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
TimeoutException: No response can be found for PATCH request on 
http://example.org/upload with {'Patch-Content-Range': 'bytes 
524288-1048575/4194304', 'Content-Length': '524288'} headers amongst:
- Match any request with {'Patch-Content-Range': 'bytes 
2621440-3145727/4194304'} headers
- Already matched any request with {'Content-Length': '524288'} headers

If you wanted to reuse an already matched response instead of registering it 
again, refer to 
https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-
a-response-for-more-than-one-request

2025-01-02 09:54:52 [debug    ] patching                       attempt=3 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 09:54:52 [error    ] retrying                       attempt=3
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /builds/infrastructure/obs-proxy/obs_proxy/chunked_uploads/client.py:84 in   │
│ upload_chunked                                                               │
│                                                                              │
│    81 │   │   │   for attempt in range(MAX_ATTEMPTS):                        │
│    82 │   │   │   │   try:                                                   │
│    83 │   │   │   │   │   logger.debug("patching", uri=uri, size=len(chunk), │
│ ❱  84 │   │   │   │   │   r = await client.patch(                            │
│    85 │   │   │   │   │   │   uri,                                           │
│    86 │   │   │   │   │   │   content=chunk,                                 │
│    87 │   │   │   │   │   │   headers=chunk_headers,                         │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       attempt = 3                                                        │ │
│ │         chunk = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\… │ │
│ │ chunk_headers = {                                                        │ │
│ │                 │   'Patch-Content-Range': 'bytes                        │ │
│ │                 524288-1048575/4194304',                                 │ │
│ │                 │   'Content-Length': '524288'                           │ │
│ │                 }                                                        │ │
│ │    chunk_size = 524288                                                   │ │
│ │        client = <httpx.AsyncClient object at 0x7f51bba09cd0>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f51bba61e10> wrapping <_io.BufferedReader          │ │
│ │                 name='/tmp/pytest-of-root/pytest-0/test_upload_chunked_… │ │
│ │             e = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Patch-Content-Range': 'bytes 524288-1048575/4194304',  │ │
│ │                 'Content-Length': '524288'} headers amongst:\n- Match    │ │
│ │                 any request with {'Patch-Content-Range': 'bytes          │ │
│ │                 2621440-3145727/4194304'} headers\n- Already matched any │ │
│ │                 request with {'Content-Length': '524288'} headers\n\nIf  │ │
│ │                 you wanted to reuse an already matched response instead  │ │
│ │                 of registering it again, refer to                        │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │           exc = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Patch-Content-Range': 'bytes 524288-1048575/4194304',  │ │
│ │                 'Content-Length': '524288'} headers amongst:\n- Match    │ │
│ │                 any request with {'Patch-Content-Range': 'bytes          │ │
│ │                 2621440-3145727/4194304'} headers\n- Already matched any │ │
│ │                 request with {'Content-Length': '524288'} headers\n\nIf  │ │
│ │                 you wanted to reuse an already matched response instead  │ │
│ │                 of registering it again, refer to                        │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │   file_hasher = <md5 _hashlib.HASH object @ 0x7f51bb902810>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1933 in patch       │
│                                                                              │
│   1930 │   │                                                                 │
│   1931 │   │   **Parameters**: See `httpx.request`.                          │
│   1932 │   │   """                                                           │
│ ❱ 1933 │   │   return await self.request(                                    │
│   1934 │   │   │   "PATCH",                                                  │
│   1935 │   │   │   url,                                                      │
│   1936 │   │   │   content=content,                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bba09cd0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1540 in request     │
│                                                                              │
│   1537 │   │   │   timeout=timeout,                                          │
│   1538 │   │   │   extensions=extensions,                                    │
│   1539 │   │   )                                                             │
│ ❱ 1540 │   │   return await self.send(request, auth=auth, follow_redirects=f │
│   1541 │                                                                     │
│   1542 │   @asynccontextmanager                                              │
│   1543 │   async def stream(                                                 │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           method = 'PATCH'                                               │ │
│ │           params = None                                                  │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bba09cd0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1629 in send        │
│                                                                              │
│   1626 │   │                                                                 │
│   1627 │   │   auth = self._build_request_auth(request, auth)                │
│   1628 │   │                                                                 │
│ ❱ 1629 │   │   response = await self._send_handling_auth(                    │
│   1630 │   │   │   request,                                                  │
│   1631 │   │   │   auth=auth,                                                │
│   1632 │   │   │   follow_redirects=follow_redirects,                        │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │             auth = <httpx.Auth object at 0x7f51bbb079d0>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51bba09cd0>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1657 in             │
│ _send_handling_auth                                                          │
│                                                                              │
│   1654 │   │   │   request = await auth_flow.__anext__()                     │
│   1655 │   │   │                                                             │
│   1656 │   │   │   while True:                                               │
│ ❱ 1657 │   │   │   │   response = await self._send_handling_redirects(       │
│   1658 │   │   │   │   │   request,                                          │
│   1659 │   │   │   │   │   follow_redirects=follow_redirects,                │
│   1660 │   │   │   │   │   history=history,                                  │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx.Auth object at 0x7f51bbb079d0>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f51bbb7fb50>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bba09cd0>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1694 in             │
│ _send_handling_redirects                                                     │
│                                                                              │
│   1691 │   │   │   for hook in self._event_hooks["request"]:                 │
│   1692 │   │   │   │   await hook(request)                                   │
│   1693 │   │   │                                                             │
│ ❱ 1694 │   │   │   response = await self._send_single_request(request)       │
│   1695 │   │   │   try:                                                      │
│   1696 │   │   │   │   for hook in self._event_hooks["response"]:            │
│   1697 │   │   │   │   │   await hook(response)                              │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │ follow_redirects = False                                           │       │
│ │          history = []                                              │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51bba09cd0>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1730 in             │
│ _send_single_request                                                         │
│                                                                              │
│   1727 │   │   │   )                                                         │
│   1728 │   │                                                                 │
│   1729 │   │   with request_context(request=request):                        │
│ ❱ 1730 │   │   │   response = await transport.handle_async_request(request)  │
│   1731 │   │                                                                 │
│   1732 │   │   assert isinstance(response.stream, AsyncByteStream)           │
│   1733 │   │   response.request = request                                    │
│                                                                              │
│ ╭──────────────────────────── locals ─────────────────────────────╮          │
│ │   request = <Request('PATCH', 'http://example.org/upload')>     │          │
│ │      self = <httpx.AsyncClient object at 0x7f51bba09cd0>        │          │
│ │     start = 154.326372958                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51bba63a90> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/__init__.py:56 in       │
│ mocked_handle_async_request                                                  │
│                                                                              │
│   53 │   │   transport: httpx.AsyncHTTPTransport, request: httpx.Request     │
│   54 │   ) -> httpx.Response:                                                │
│   55 │   │   if options.should_mock(request):                                │
│ ❱ 56 │   │   │   return await mock._handle_async_request(transport, request) │
│   57 │   │   return await real_handle_async_request(transport, request)      │
│   58 │                                                                       │
│   59 │   monkeypatch.setattr(                                                │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │      mock = <pytest_httpx._httpx_mock.HTTPXMock object at                │ │
│ │             0x7f51bba09fd0>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f51bba09090>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51bba63a90>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:183 in   │
│ _handle_async_request                                                        │
│                                                                              │
│   180 │   │   │   │   │   response = await response                          │
│   181 │   │   │   │   return _unread(response)                               │
│   182 │   │                                                                  │
│ ❱ 183 │   │   self._request_not_matched(real_transport, request)             │
│   184 │                                                                      │
│   185 │   def _request_not_matched(                                          │
│   186 │   │   self,                                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       callback = None                                                    │ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51bba63a90>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51bba09fd0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:191 in   │
│ _request_not_matched                                                         │
│                                                                              │
│   188 │   │   request: httpx.Request,                                        │
│   189 │   ) -> NoReturn:                                                     │
│   190 │   │   self._requests_not_matched.append(request)                     │
│ ❱ 191 │   │   raise httpx.TimeoutException(                                  │
│   192 │   │   │   self._explain_that_no_response_was_found(real_transport, r │
│   193 │   │   │   request=request,                                           │
│   194 │   │   )                                                              │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51bba63a90>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51bba09fd0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
TimeoutException: No response can be found for PATCH request on 
http://example.org/upload with {'Patch-Content-Range': 'bytes 
524288-1048575/4194304', 'Content-Length': '524288'} headers amongst:
- Match any request with {'Patch-Content-Range': 'bytes 
2621440-3145727/4194304'} headers
- Already matched any request with {'Content-Length': '524288'} headers

If you wanted to reuse an already matched response instead of registering it 
again, refer to 
https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-
a-response-for-more-than-one-request

2025-01-02 09:54:54 [debug    ] patching                       attempt=4 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 09:54:54 [error    ] retrying                       attempt=4
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /builds/infrastructure/obs-proxy/obs_proxy/chunked_uploads/client.py:84 in   │
│ upload_chunked                                                               │
│                                                                              │
│    81 │   │   │   for attempt in range(MAX_ATTEMPTS):                        │
│    82 │   │   │   │   try:                                                   │
│    83 │   │   │   │   │   logger.debug("patching", uri=uri, size=len(chunk), │
│ ❱  84 │   │   │   │   │   r = await client.patch(                            │
│    85 │   │   │   │   │   │   uri,                                           │
│    86 │   │   │   │   │   │   content=chunk,                                 │
│    87 │   │   │   │   │   │   headers=chunk_headers,                         │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       attempt = 4                                                        │ │
│ │         chunk = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\… │ │
│ │ chunk_headers = {                                                        │ │
│ │                 │   'Patch-Content-Range': 'bytes                        │ │
│ │                 524288-1048575/4194304',                                 │ │
│ │                 │   'Content-Length': '524288'                           │ │
│ │                 }                                                        │ │
│ │    chunk_size = 524288                                                   │ │
│ │        client = <httpx.AsyncClient object at 0x7f51bba09cd0>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f51bba61e10> wrapping <_io.BufferedReader          │ │
│ │                 name='/tmp/pytest-of-root/pytest-0/test_upload_chunked_… │ │
│ │             e = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Patch-Content-Range': 'bytes 524288-1048575/4194304',  │ │
│ │                 'Content-Length': '524288'} headers amongst:\n- Match    │ │
│ │                 any request with {'Patch-Content-Range': 'bytes          │ │
│ │                 2621440-3145727/4194304'} headers\n- Already matched any │ │
│ │                 request with {'Content-Length': '524288'} headers\n\nIf  │ │
│ │                 you wanted to reuse an already matched response instead  │ │
│ │                 of registering it again, refer to                        │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │           exc = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Patch-Content-Range': 'bytes 524288-1048575/4194304',  │ │
│ │                 'Content-Length': '524288'} headers amongst:\n- Match    │ │
│ │                 any request with {'Patch-Content-Range': 'bytes          │ │
│ │                 2621440-3145727/4194304'} headers\n- Already matched any │ │
│ │                 request with {'Content-Length': '524288'} headers\n\nIf  │ │
│ │                 you wanted to reuse an already matched response instead  │ │
│ │                 of registering it again, refer to                        │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │   file_hasher = <md5 _hashlib.HASH object @ 0x7f51bb902810>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1933 in patch       │
│                                                                              │
│   1930 │   │                                                                 │
│   1931 │   │   **Parameters**: See `httpx.request`.                          │
│   1932 │   │   """                                                           │
│ ❱ 1933 │   │   return await self.request(                                    │
│   1934 │   │   │   "PATCH",                                                  │
│   1935 │   │   │   url,                                                      │
│   1936 │   │   │   content=content,                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bba09cd0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1540 in request     │
│                                                                              │
│   1537 │   │   │   timeout=timeout,                                          │
│   1538 │   │   │   extensions=extensions,                                    │
│   1539 │   │   )                                                             │
│ ❱ 1540 │   │   return await self.send(request, auth=auth, follow_redirects=f │
│   1541 │                                                                     │
│   1542 │   @asynccontextmanager                                              │
│   1543 │   async def stream(                                                 │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           method = 'PATCH'                                               │ │
│ │           params = None                                                  │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bba09cd0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1629 in send        │
│                                                                              │
│   1626 │   │                                                                 │
│   1627 │   │   auth = self._build_request_auth(request, auth)                │
│   1628 │   │                                                                 │
│ ❱ 1629 │   │   response = await self._send_handling_auth(                    │
│   1630 │   │   │   request,                                                  │
│   1631 │   │   │   auth=auth,                                                │
│   1632 │   │   │   follow_redirects=follow_redirects,                        │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │             auth = <httpx.Auth object at 0x7f51bbba81d0>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51bba09cd0>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1657 in             │
│ _send_handling_auth                                                          │
│                                                                              │
│   1654 │   │   │   request = await auth_flow.__anext__()                     │
│   1655 │   │   │                                                             │
│   1656 │   │   │   while True:                                               │
│ ❱ 1657 │   │   │   │   response = await self._send_handling_redirects(       │
│   1658 │   │   │   │   │   request,                                          │
│   1659 │   │   │   │   │   follow_redirects=follow_redirects,                │
│   1660 │   │   │   │   │   history=history,                                  │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx.Auth object at 0x7f51bbba81d0>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f51bc2f73d0>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bba09cd0>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1694 in             │
│ _send_handling_redirects                                                     │
│                                                                              │
│   1691 │   │   │   for hook in self._event_hooks["request"]:                 │
│   1692 │   │   │   │   await hook(request)                                   │
│   1693 │   │   │                                                             │
│ ❱ 1694 │   │   │   response = await self._send_single_request(request)       │
│   1695 │   │   │   try:                                                      │
│   1696 │   │   │   │   for hook in self._event_hooks["response"]:            │
│   1697 │   │   │   │   │   await hook(response)                              │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │ follow_redirects = False                                           │       │
│ │          history = []                                              │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51bba09cd0>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1730 in             │
│ _send_single_request                                                         │
│                                                                              │
│   1727 │   │   │   )                                                         │
│   1728 │   │                                                                 │
│   1729 │   │   with request_context(request=request):                        │
│ ❱ 1730 │   │   │   response = await transport.handle_async_request(request)  │
│   1731 │   │                                                                 │
│   1732 │   │   assert isinstance(response.stream, AsyncByteStream)           │
│   1733 │   │   response.request = request                                    │
│                                                                              │
│ ╭──────────────────────────── locals ─────────────────────────────╮          │
│ │   request = <Request('PATCH', 'http://example.org/upload')>     │          │
│ │      self = <httpx.AsyncClient object at 0x7f51bba09cd0>        │          │
│ │     start = 155.505518671                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51bba63a90> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/__init__.py:56 in       │
│ mocked_handle_async_request                                                  │
│                                                                              │
│   53 │   │   transport: httpx.AsyncHTTPTransport, request: httpx.Request     │
│   54 │   ) -> httpx.Response:                                                │
│   55 │   │   if options.should_mock(request):                                │
│ ❱ 56 │   │   │   return await mock._handle_async_request(transport, request) │
│   57 │   │   return await real_handle_async_request(transport, request)      │
│   58 │                                                                       │
│   59 │   monkeypatch.setattr(                                                │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │      mock = <pytest_httpx._httpx_mock.HTTPXMock object at                │ │
│ │             0x7f51bba09fd0>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f51bba09090>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51bba63a90>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:183 in   │
│ _handle_async_request                                                        │
│                                                                              │
│   180 │   │   │   │   │   response = await response                          │
│   181 │   │   │   │   return _unread(response)                               │
│   182 │   │                                                                  │
│ ❱ 183 │   │   self._request_not_matched(real_transport, request)             │
│   184 │                                                                      │
│   185 │   def _request_not_matched(                                          │
│   186 │   │   self,                                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       callback = None                                                    │ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51bba63a90>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51bba09fd0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:191 in   │
│ _request_not_matched                                                         │
│                                                                              │
│   188 │   │   request: httpx.Request,                                        │
│   189 │   ) -> NoReturn:                                                     │
│   190 │   │   self._requests_not_matched.append(request)                     │
│ ❱ 191 │   │   raise httpx.TimeoutException(                                  │
│   192 │   │   │   self._explain_that_no_response_was_found(real_transport, r │
│   193 │   │   │   request=request,                                           │
│   194 │   │   )                                                              │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51bba63a90>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51bba09fd0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
TimeoutException: No response can be found for PATCH request on 
http://example.org/upload with {'Patch-Content-Range': 'bytes 
524288-1048575/4194304', 'Content-Length': '524288'} headers amongst:
- Match any request with {'Patch-Content-Range': 'bytes 
2621440-3145727/4194304'} headers
- Already matched any request with {'Content-Length': '524288'} headers

If you wanted to reuse an already matched response instead of registering it 
again, refer to 
https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-
a-response-for-more-than-one-request

______________ ERROR at teardown of test_upload_chunked_complete _______________

monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7f51bae125d0>
request = <SubRequest 'httpx_mock' for <Coroutine test_upload_chunked_complete>>

    @pytest.fixture
    def httpx_mock(
        monkeypatch: MonkeyPatch,
        request: FixtureRequest,
    ) -> Generator[HTTPXMock, None, None]:
        options = {}
        for marker in request.node.iter_markers("httpx_mock"):
            options = marker.kwargs | options
        __tracebackhide__ = methodcaller("errisinstance", TypeError)
        options = _HTTPXMockOptions(**options)
    
        mock = HTTPXMock(options)
    
        # Mock synchronous requests
        real_handle_request = httpx.HTTPTransport.handle_request
    
        def mocked_handle_request(
            transport: httpx.HTTPTransport, request: httpx.Request
        ) -> httpx.Response:
            if options.should_mock(request):
                return mock._handle_request(transport, request)
            return real_handle_request(transport, request)
    
        monkeypatch.setattr(
            httpx.HTTPTransport,
            "handle_request",
            mocked_handle_request,
        )
    
        # Mock asynchronous requests
        real_handle_async_request = httpx.AsyncHTTPTransport.handle_async_request
    
        async def mocked_handle_async_request(
            transport: httpx.AsyncHTTPTransport, request: httpx.Request
        ) -> httpx.Response:
            if options.should_mock(request):
                return await mock._handle_async_request(transport, request)
            return await real_handle_async_request(transport, request)
    
        monkeypatch.setattr(
            httpx.AsyncHTTPTransport,
            "handle_async_request",
            mocked_handle_async_request,
        )
    
        yield mock
        try:
>           mock._assert_options()

/usr/local/lib/python3.11/site-packages/pytest_httpx/__init__.py:67: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <pytest_httpx._httpx_mock.HTTPXMock object at 0x7f51bae10c10>

    def _assert_options(self) -> None:
        callbacks_not_executed = [
            matcher for matcher, _ in self._callbacks if matcher.should_have_matched()
        ]
        matchers_description = "\n".join(
            [f"- {matcher}" for matcher in callbacks_not_executed]
        )
    
>       assert not callbacks_not_executed, (
            "The following responses are mocked but not requested:\n"
            f"{matchers_description}\n"
            "\n"
            "If this is on purpose, refer to https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-more-responses-than-what-will-be-requested"
        )
E       AssertionError: The following responses are mocked but not requested:
E         - Match HEAD request
E         
E         If this is on purpose, refer to https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-more-responses-than-what-will-be-requested
E       assert not [<pytest_httpx._request_matcher._RequestMatcher object at 0x7f51bae13dd0>]

/usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:319: AssertionError
----------------------------- Captured stdout call -----------------------------
2025-01-02 09:54:55 [debug    ] patching                       attempt=0 content_range=<ContentRange 'bytes 0-524287/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 09:54:55 [debug    ] patch result                   result=<Response [200 OK]>
2025-01-02 09:54:55 [debug    ] patching                       attempt=0 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 09:54:55 [error    ] retrying                       attempt=0
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /builds/infrastructure/obs-proxy/obs_proxy/chunked_uploads/client.py:84 in   │
│ upload_chunked                                                               │
│                                                                              │
│    81 │   │   │   for attempt in range(MAX_ATTEMPTS):                        │
│    82 │   │   │   │   try:                                                   │
│    83 │   │   │   │   │   logger.debug("patching", uri=uri, size=len(chunk), │
│ ❱  84 │   │   │   │   │   r = await client.patch(                            │
│    85 │   │   │   │   │   │   uri,                                           │
│    86 │   │   │   │   │   │   content=chunk,                                 │
│    87 │   │   │   │   │   │   headers=chunk_headers,                         │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       attempt = 0                                                        │ │
│ │         chunk = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\… │ │
│ │ chunk_headers = {                                                        │ │
│ │                 │   'Patch-Content-Range': 'bytes                        │ │
│ │                 524288-1048575/4194304',                                 │ │
│ │                 │   'Content-Length': '524288'                           │ │
│ │                 }                                                        │ │
│ │    chunk_size = 524288                                                   │ │
│ │        client = <httpx.AsyncClient object at 0x7f51bae11390>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f51bae11250> wrapping <_io.BufferedReader          │ │
│ │                 name='/tmp/pytest-of-root/pytest-0/test_upload_chunked_… │ │
│ │             e = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Content-Length': '524288'} headers amongst:\n- Match   │ │
│ │                 HEAD request\n- Already matched any request with         │ │
│ │                 {'Content-Length': '524288'} headers\n\nIf you wanted to │ │
│ │                 reuse an already matched response instead of registering │ │
│ │                 it again, refer to                                       │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │           exc = None                                                     │ │
│ │   file_hasher = <md5 _hashlib.HASH object @ 0x7f51baa7aeb0>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1933 in patch       │
│                                                                              │
│   1930 │   │                                                                 │
│   1931 │   │   **Parameters**: See `httpx.request`.                          │
│   1932 │   │   """                                                           │
│ ❱ 1933 │   │   return await self.request(                                    │
│   1934 │   │   │   "PATCH",                                                  │
│   1935 │   │   │   url,                                                      │
│   1936 │   │   │   content=content,                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bae11390>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1540 in request     │
│                                                                              │
│   1537 │   │   │   timeout=timeout,                                          │
│   1538 │   │   │   extensions=extensions,                                    │
│   1539 │   │   )                                                             │
│ ❱ 1540 │   │   return await self.send(request, auth=auth, follow_redirects=f │
│   1541 │                                                                     │
│   1542 │   @asynccontextmanager                                              │
│   1543 │   async def stream(                                                 │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           method = 'PATCH'                                               │ │
│ │           params = None                                                  │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bae11390>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1629 in send        │
│                                                                              │
│   1626 │   │                                                                 │
│   1627 │   │   auth = self._build_request_auth(request, auth)                │
│   1628 │   │                                                                 │
│ ❱ 1629 │   │   response = await self._send_handling_auth(                    │
│   1630 │   │   │   request,                                                  │
│   1631 │   │   │   auth=auth,                                                │
│   1632 │   │   │   follow_redirects=follow_redirects,                        │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │             auth = <httpx.Auth object at 0x7f51bae112d0>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51bae11390>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1657 in             │
│ _send_handling_auth                                                          │
│                                                                              │
│   1654 │   │   │   request = await auth_flow.__anext__()                     │
│   1655 │   │   │                                                             │
│   1656 │   │   │   while True:                                               │
│ ❱ 1657 │   │   │   │   response = await self._send_handling_redirects(       │
│   1658 │   │   │   │   │   request,                                          │
│   1659 │   │   │   │   │   follow_redirects=follow_redirects,                │
│   1660 │   │   │   │   │   history=history,                                  │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx.Auth object at 0x7f51bae112d0>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f51bba38040>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bae11390>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1694 in             │
│ _send_handling_redirects                                                     │
│                                                                              │
│   1691 │   │   │   for hook in self._event_hooks["request"]:                 │
│   1692 │   │   │   │   await hook(request)                                   │
│   1693 │   │   │                                                             │
│ ❱ 1694 │   │   │   response = await self._send_single_request(request)       │
│   1695 │   │   │   try:                                                      │
│   1696 │   │   │   │   for hook in self._event_hooks["response"]:            │
│   1697 │   │   │   │   │   await hook(response)                              │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │ follow_redirects = False                                           │       │
│ │          history = []                                              │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51bae11390>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1730 in             │
│ _send_single_request                                                         │
│                                                                              │
│   1727 │   │   │   )                                                         │
│   1728 │   │                                                                 │
│   1729 │   │   with request_context(request=request):                        │
│ ❱ 1730 │   │   │   response = await transport.handle_async_request(request)  │
│   1731 │   │                                                                 │
│   1732 │   │   assert isinstance(response.stream, AsyncByteStream)           │
│   1733 │   │   response.request = request                                    │
│                                                                              │
│ ╭──────────────────────────── locals ─────────────────────────────╮          │
│ │   request = <Request('PATCH', 'http://example.org/upload')>     │          │
│ │      self = <httpx.AsyncClient object at 0x7f51bae11390>        │          │
│ │     start = 156.62537686                                        │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51bae12b10> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/__init__.py:56 in       │
│ mocked_handle_async_request                                                  │
│                                                                              │
│   53 │   │   transport: httpx.AsyncHTTPTransport, request: httpx.Request     │
│   54 │   ) -> httpx.Response:                                                │
│   55 │   │   if options.should_mock(request):                                │
│ ❱ 56 │   │   │   return await mock._handle_async_request(transport, request) │
│   57 │   │   return await real_handle_async_request(transport, request)      │
│   58 │                                                                       │
│   59 │   monkeypatch.setattr(                                                │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │      mock = <pytest_httpx._httpx_mock.HTTPXMock object at                │ │
│ │             0x7f51bae10c10>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f51bae11110>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51bae12b10>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:183 in   │
│ _handle_async_request                                                        │
│                                                                              │
│   180 │   │   │   │   │   response = await response                          │
│   181 │   │   │   │   return _unread(response)                               │
│   182 │   │                                                                  │
│ ❱ 183 │   │   self._request_not_matched(real_transport, request)             │
│   184 │                                                                      │
│   185 │   def _request_not_matched(                                          │
│   186 │   │   self,                                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       callback = None                                                    │ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51bae12b10>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51bae10c10>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:191 in   │
│ _request_not_matched                                                         │
│                                                                              │
│   188 │   │   request: httpx.Request,                                        │
│   189 │   ) -> NoReturn:                                                     │
│   190 │   │   self._requests_not_matched.append(request)                     │
│ ❱ 191 │   │   raise httpx.TimeoutException(                                  │
│   192 │   │   │   self._explain_that_no_response_was_found(real_transport, r │
│   193 │   │   │   request=request,                                           │
│   194 │   │   )                                                              │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51bae12b10>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51bae10c10>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
TimeoutException: No response can be found for PATCH request on 
http://example.org/upload with {'Content-Length': '524288'} headers amongst:
- Match HEAD request
- Already matched any request with {'Content-Length': '524288'} headers

If you wanted to reuse an already matched response instead of registering it 
again, refer to 
https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-
a-response-for-more-than-one-request

2025-01-02 09:54:56 [debug    ] patching                       attempt=1 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 09:54:56 [error    ] retrying                       attempt=1
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /builds/infrastructure/obs-proxy/obs_proxy/chunked_uploads/client.py:84 in   │
│ upload_chunked                                                               │
│                                                                              │
│    81 │   │   │   for attempt in range(MAX_ATTEMPTS):                        │
│    82 │   │   │   │   try:                                                   │
│    83 │   │   │   │   │   logger.debug("patching", uri=uri, size=len(chunk), │
│ ❱  84 │   │   │   │   │   r = await client.patch(                            │
│    85 │   │   │   │   │   │   uri,                                           │
│    86 │   │   │   │   │   │   content=chunk,                                 │
│    87 │   │   │   │   │   │   headers=chunk_headers,                         │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       attempt = 1                                                        │ │
│ │         chunk = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\… │ │
│ │ chunk_headers = {                                                        │ │
│ │                 │   'Patch-Content-Range': 'bytes                        │ │
│ │                 524288-1048575/4194304',                                 │ │
│ │                 │   'Content-Length': '524288'                           │ │
│ │                 }                                                        │ │
│ │    chunk_size = 524288                                                   │ │
│ │        client = <httpx.AsyncClient object at 0x7f51bae11390>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f51bae11250> wrapping <_io.BufferedReader          │ │
│ │                 name='/tmp/pytest-of-root/pytest-0/test_upload_chunked_… │ │
│ │             e = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Content-Length': '524288'} headers amongst:\n- Match   │ │
│ │                 HEAD request\n- Already matched any request with         │ │
│ │                 {'Content-Length': '524288'} headers\n\nIf you wanted to │ │
│ │                 reuse an already matched response instead of registering │ │
│ │                 it again, refer to                                       │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │           exc = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Content-Length': '524288'} headers amongst:\n- Match   │ │
│ │                 HEAD request\n- Already matched any request with         │ │
│ │                 {'Content-Length': '524288'} headers\n\nIf you wanted to │ │
│ │                 reuse an already matched response instead of registering │ │
│ │                 it again, refer to                                       │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │   file_hasher = <md5 _hashlib.HASH object @ 0x7f51baa7aeb0>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1933 in patch       │
│                                                                              │
│   1930 │   │                                                                 │
│   1931 │   │   **Parameters**: See `httpx.request`.                          │
│   1932 │   │   """                                                           │
│ ❱ 1933 │   │   return await self.request(                                    │
│   1934 │   │   │   "PATCH",                                                  │
│   1935 │   │   │   url,                                                      │
│   1936 │   │   │   content=content,                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bae11390>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1540 in request     │
│                                                                              │
│   1537 │   │   │   timeout=timeout,                                          │
│   1538 │   │   │   extensions=extensions,                                    │
│   1539 │   │   )                                                             │
│ ❱ 1540 │   │   return await self.send(request, auth=auth, follow_redirects=f │
│   1541 │                                                                     │
│   1542 │   @asynccontextmanager                                              │
│   1543 │   async def stream(                                                 │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           method = 'PATCH'                                               │ │
│ │           params = None                                                  │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bae11390>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1629 in send        │
│                                                                              │
│   1626 │   │                                                                 │
│   1627 │   │   auth = self._build_request_auth(request, auth)                │
│   1628 │   │                                                                 │
│ ❱ 1629 │   │   response = await self._send_handling_auth(                    │
│   1630 │   │   │   request,                                                  │
│   1631 │   │   │   auth=auth,                                                │
│   1632 │   │   │   follow_redirects=follow_redirects,                        │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │             auth = <httpx.Auth object at 0x7f51bb9373d0>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51bae11390>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1657 in             │
│ _send_handling_auth                                                          │
│                                                                              │
│   1654 │   │   │   request = await auth_flow.__anext__()                     │
│   1655 │   │   │                                                             │
│   1656 │   │   │   while True:                                               │
│ ❱ 1657 │   │   │   │   response = await self._send_handling_redirects(       │
│   1658 │   │   │   │   │   request,                                          │
│   1659 │   │   │   │   │   follow_redirects=follow_redirects,                │
│   1660 │   │   │   │   │   history=history,                                  │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx.Auth object at 0x7f51bb9373d0>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f51bc2f73d0>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bae11390>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1694 in             │
│ _send_handling_redirects                                                     │
│                                                                              │
│   1691 │   │   │   for hook in self._event_hooks["request"]:                 │
│   1692 │   │   │   │   await hook(request)                                   │
│   1693 │   │   │                                                             │
│ ❱ 1694 │   │   │   response = await self._send_single_request(request)       │
│   1695 │   │   │   try:                                                      │
│   1696 │   │   │   │   for hook in self._event_hooks["response"]:            │
│   1697 │   │   │   │   │   await hook(response)                              │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │ follow_redirects = False                                           │       │
│ │          history = []                                              │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51bae11390>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1730 in             │
│ _send_single_request                                                         │
│                                                                              │
│   1727 │   │   │   )                                                         │
│   1728 │   │                                                                 │
│   1729 │   │   with request_context(request=request):                        │
│ ❱ 1730 │   │   │   response = await transport.handle_async_request(request)  │
│   1731 │   │                                                                 │
│   1732 │   │   assert isinstance(response.stream, AsyncByteStream)           │
│   1733 │   │   response.request = request                                    │
│                                                                              │
│ ╭──────────────────────────── locals ─────────────────────────────╮          │
│ │   request = <Request('PATCH', 'http://example.org/upload')>     │          │
│ │      self = <httpx.AsyncClient object at 0x7f51bae11390>        │          │
│ │     start = 157.768732116                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51bae12b10> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/__init__.py:56 in       │
│ mocked_handle_async_request                                                  │
│                                                                              │
│   53 │   │   transport: httpx.AsyncHTTPTransport, request: httpx.Request     │
│   54 │   ) -> httpx.Response:                                                │
│   55 │   │   if options.should_mock(request):                                │
│ ❱ 56 │   │   │   return await mock._handle_async_request(transport, request) │
│   57 │   │   return await real_handle_async_request(transport, request)      │
│   58 │                                                                       │
│   59 │   monkeypatch.setattr(                                                │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │      mock = <pytest_httpx._httpx_mock.HTTPXMock object at                │ │
│ │             0x7f51bae10c10>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f51bae11110>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51bae12b10>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:183 in   │
│ _handle_async_request                                                        │
│                                                                              │
│   180 │   │   │   │   │   response = await response                          │
│   181 │   │   │   │   return _unread(response)                               │
│   182 │   │                                                                  │
│ ❱ 183 │   │   self._request_not_matched(real_transport, request)             │
│   184 │                                                                      │
│   185 │   def _request_not_matched(                                          │
│   186 │   │   self,                                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       callback = None                                                    │ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51bae12b10>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51bae10c10>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:191 in   │
│ _request_not_matched                                                         │
│                                                                              │
│   188 │   │   request: httpx.Request,                                        │
│   189 │   ) -> NoReturn:                                                     │
│   190 │   │   self._requests_not_matched.append(request)                     │
│ ❱ 191 │   │   raise httpx.TimeoutException(                                  │
│   192 │   │   │   self._explain_that_no_response_was_found(real_transport, r │
│   193 │   │   │   request=request,                                           │
│   194 │   │   )                                                              │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51bae12b10>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51bae10c10>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
TimeoutException: No response can be found for PATCH request on 
http://example.org/upload with {'Content-Length': '524288'} headers amongst:
- Match HEAD request
- Already matched any request with {'Content-Length': '524288'} headers

If you wanted to reuse an already matched response instead of registering it 
again, refer to 
https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-
a-response-for-more-than-one-request

2025-01-02 09:54:57 [debug    ] patching                       attempt=2 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 09:54:57 [error    ] retrying                       attempt=2
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /builds/infrastructure/obs-proxy/obs_proxy/chunked_uploads/client.py:84 in   │
│ upload_chunked                                                               │
│                                                                              │
│    81 │   │   │   for attempt in range(MAX_ATTEMPTS):                        │
│    82 │   │   │   │   try:                                                   │
│    83 │   │   │   │   │   logger.debug("patching", uri=uri, size=len(chunk), │
│ ❱  84 │   │   │   │   │   r = await client.patch(                            │
│    85 │   │   │   │   │   │   uri,                                           │
│    86 │   │   │   │   │   │   content=chunk,                                 │
│    87 │   │   │   │   │   │   headers=chunk_headers,                         │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       attempt = 2                                                        │ │
│ │         chunk = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\… │ │
│ │ chunk_headers = {                                                        │ │
│ │                 │   'Patch-Content-Range': 'bytes                        │ │
│ │                 524288-1048575/4194304',                                 │ │
│ │                 │   'Content-Length': '524288'                           │ │
│ │                 }                                                        │ │
│ │    chunk_size = 524288                                                   │ │
│ │        client = <httpx.AsyncClient object at 0x7f51bae11390>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f51bae11250> wrapping <_io.BufferedReader          │ │
│ │                 name='/tmp/pytest-of-root/pytest-0/test_upload_chunked_… │ │
│ │             e = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Content-Length': '524288'} headers amongst:\n- Match   │ │
│ │                 HEAD request\n- Already matched any request with         │ │
│ │                 {'Content-Length': '524288'} headers\n\nIf you wanted to │ │
│ │                 reuse an already matched response instead of registering │ │
│ │                 it again, refer to                                       │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │           exc = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Content-Length': '524288'} headers amongst:\n- Match   │ │
│ │                 HEAD request\n- Already matched any request with         │ │
│ │                 {'Content-Length': '524288'} headers\n\nIf you wanted to │ │
│ │                 reuse an already matched response instead of registering │ │
│ │                 it again, refer to                                       │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │   file_hasher = <md5 _hashlib.HASH object @ 0x7f51baa7aeb0>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1933 in patch       │
│                                                                              │
│   1930 │   │                                                                 │
│   1931 │   │   **Parameters**: See `httpx.request`.                          │
│   1932 │   │   """                                                           │
│ ❱ 1933 │   │   return await self.request(                                    │
│   1934 │   │   │   "PATCH",                                                  │
│   1935 │   │   │   url,                                                      │
│   1936 │   │   │   content=content,                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bae11390>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1540 in request     │
│                                                                              │
│   1537 │   │   │   timeout=timeout,                                          │
│   1538 │   │   │   extensions=extensions,                                    │
│   1539 │   │   )                                                             │
│ ❱ 1540 │   │   return await self.send(request, auth=auth, follow_redirects=f │
│   1541 │                                                                     │
│   1542 │   @asynccontextmanager                                              │
│   1543 │   async def stream(                                                 │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           method = 'PATCH'                                               │ │
│ │           params = None                                                  │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bae11390>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1629 in send        │
│                                                                              │
│   1626 │   │                                                                 │
│   1627 │   │   auth = self._build_request_auth(request, auth)                │
│   1628 │   │                                                                 │
│ ❱ 1629 │   │   response = await self._send_handling_auth(                    │
│   1630 │   │   │   request,                                                  │
│   1631 │   │   │   auth=auth,                                                │
│   1632 │   │   │   follow_redirects=follow_redirects,                        │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │             auth = <httpx.Auth object at 0x7f51bb937450>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51bae11390>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1657 in             │
│ _send_handling_auth                                                          │
│                                                                              │
│   1654 │   │   │   request = await auth_flow.__anext__()                     │
│   1655 │   │   │                                                             │
│   1656 │   │   │   while True:                                               │
│ ❱ 1657 │   │   │   │   response = await self._send_handling_redirects(       │
│   1658 │   │   │   │   │   request,                                          │
│   1659 │   │   │   │   │   follow_redirects=follow_redirects,                │
│   1660 │   │   │   │   │   history=history,                                  │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx.Auth object at 0x7f51bb937450>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f51bbb7df30>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bae11390>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1694 in             │
│ _send_handling_redirects                                                     │
│                                                                              │
│   1691 │   │   │   for hook in self._event_hooks["request"]:                 │
│   1692 │   │   │   │   await hook(request)                                   │
│   1693 │   │   │                                                             │
│ ❱ 1694 │   │   │   response = await self._send_single_request(request)       │
│   1695 │   │   │   try:                                                      │
│   1696 │   │   │   │   for hook in self._event_hooks["response"]:            │
│   1697 │   │   │   │   │   await hook(response)                              │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │ follow_redirects = False                                           │       │
│ │          history = []                                              │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51bae11390>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1730 in             │
│ _send_single_request                                                         │
│                                                                              │
│   1727 │   │   │   )                                                         │
│   1728 │   │                                                                 │
│   1729 │   │   with request_context(request=request):                        │
│ ❱ 1730 │   │   │   response = await transport.handle_async_request(request)  │
│   1731 │   │                                                                 │
│   1732 │   │   assert isinstance(response.stream, AsyncByteStream)           │
│   1733 │   │   response.request = request                                    │
│                                                                              │
│ ╭──────────────────────────── locals ─────────────────────────────╮          │
│ │   request = <Request('PATCH', 'http://example.org/upload')>     │          │
│ │      self = <httpx.AsyncClient object at 0x7f51bae11390>        │          │
│ │     start = 159.003350649                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51bae12b10> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/__init__.py:56 in       │
│ mocked_handle_async_request                                                  │
│                                                                              │
│   53 │   │   transport: httpx.AsyncHTTPTransport, request: httpx.Request     │
│   54 │   ) -> httpx.Response:                                                │
│   55 │   │   if options.should_mock(request):                                │
│ ❱ 56 │   │   │   return await mock._handle_async_request(transport, request) │
│   57 │   │   return await real_handle_async_request(transport, request)      │
│   58 │                                                                       │
│   59 │   monkeypatch.setattr(                                                │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │      mock = <pytest_httpx._httpx_mock.HTTPXMock object at                │ │
│ │             0x7f51bae10c10>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f51bae11110>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51bae12b10>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:183 in   │
│ _handle_async_request                                                        │
│                                                                              │
│   180 │   │   │   │   │   response = await response                          │
│   181 │   │   │   │   return _unread(response)                               │
│   182 │   │                                                                  │
│ ❱ 183 │   │   self._request_not_matched(real_transport, request)             │
│   184 │                                                                      │
│   185 │   def _request_not_matched(                                          │
│   186 │   │   self,                                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       callback = None                                                    │ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51bae12b10>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51bae10c10>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:191 in   │
│ _request_not_matched                                                         │
│                                                                              │
│   188 │   │   request: httpx.Request,                                        │
│   189 │   ) -> NoReturn:                                                     │
│   190 │   │   self._requests_not_matched.append(request)                     │
│ ❱ 191 │   │   raise httpx.TimeoutException(                                  │
│   192 │   │   │   self._explain_that_no_response_was_found(real_transport, r │
│   193 │   │   │   request=request,                                           │
│   194 │   │   )                                                              │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51bae12b10>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51bae10c10>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
TimeoutException: No response can be found for PATCH request on 
http://example.org/upload with {'Content-Length': '524288'} headers amongst:
- Match HEAD request
- Already matched any request with {'Content-Length': '524288'} headers

If you wanted to reuse an already matched response instead of registering it 
again, refer to 
https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-
a-response-for-more-than-one-request

2025-01-02 09:54:58 [debug    ] patching                       attempt=3 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 09:54:58 [error    ] retrying                       attempt=3
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /builds/infrastructure/obs-proxy/obs_proxy/chunked_uploads/client.py:84 in   │
│ upload_chunked                                                               │
│                                                                              │
│    81 │   │   │   for attempt in range(MAX_ATTEMPTS):                        │
│    82 │   │   │   │   try:                                                   │
│    83 │   │   │   │   │   logger.debug("patching", uri=uri, size=len(chunk), │
│ ❱  84 │   │   │   │   │   r = await client.patch(                            │
│    85 │   │   │   │   │   │   uri,                                           │
│    86 │   │   │   │   │   │   content=chunk,                                 │
│    87 │   │   │   │   │   │   headers=chunk_headers,                         │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       attempt = 3                                                        │ │
│ │         chunk = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\… │ │
│ │ chunk_headers = {                                                        │ │
│ │                 │   'Patch-Content-Range': 'bytes                        │ │
│ │                 524288-1048575/4194304',                                 │ │
│ │                 │   'Content-Length': '524288'                           │ │
│ │                 }                                                        │ │
│ │    chunk_size = 524288                                                   │ │
│ │        client = <httpx.AsyncClient object at 0x7f51bae11390>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f51bae11250> wrapping <_io.BufferedReader          │ │
│ │                 name='/tmp/pytest-of-root/pytest-0/test_upload_chunked_… │ │
│ │             e = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Content-Length': '524288'} headers amongst:\n- Match   │ │
│ │                 HEAD request\n- Already matched any request with         │ │
│ │                 {'Content-Length': '524288'} headers\n\nIf you wanted to │ │
│ │                 reuse an already matched response instead of registering │ │
│ │                 it again, refer to                                       │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │           exc = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Content-Length': '524288'} headers amongst:\n- Match   │ │
│ │                 HEAD request\n- Already matched any request with         │ │
│ │                 {'Content-Length': '524288'} headers\n\nIf you wanted to │ │
│ │                 reuse an already matched response instead of registering │ │
│ │                 it again, refer to                                       │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │   file_hasher = <md5 _hashlib.HASH object @ 0x7f51baa7aeb0>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1933 in patch       │
│                                                                              │
│   1930 │   │                                                                 │
│   1931 │   │   **Parameters**: See `httpx.request`.                          │
│   1932 │   │   """                                                           │
│ ❱ 1933 │   │   return await self.request(                                    │
│   1934 │   │   │   "PATCH",                                                  │
│   1935 │   │   │   url,                                                      │
│   1936 │   │   │   content=content,                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bae11390>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1540 in request     │
│                                                                              │
│   1537 │   │   │   timeout=timeout,                                          │
│   1538 │   │   │   extensions=extensions,                                    │
│   1539 │   │   )                                                             │
│ ❱ 1540 │   │   return await self.send(request, auth=auth, follow_redirects=f │
│   1541 │                                                                     │
│   1542 │   @asynccontextmanager                                              │
│   1543 │   async def stream(                                                 │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           method = 'PATCH'                                               │ │
│ │           params = None                                                  │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bae11390>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1629 in send        │
│                                                                              │
│   1626 │   │                                                                 │
│   1627 │   │   auth = self._build_request_auth(request, auth)                │
│   1628 │   │                                                                 │
│ ❱ 1629 │   │   response = await self._send_handling_auth(                    │
│   1630 │   │   │   request,                                                  │
│   1631 │   │   │   auth=auth,                                                │
│   1632 │   │   │   follow_redirects=follow_redirects,                        │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │             auth = <httpx.Auth object at 0x7f51bc2677d0>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51bae11390>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1657 in             │
│ _send_handling_auth                                                          │
│                                                                              │
│   1654 │   │   │   request = await auth_flow.__anext__()                     │
│   1655 │   │   │                                                             │
│   1656 │   │   │   while True:                                               │
│ ❱ 1657 │   │   │   │   response = await self._send_handling_redirects(       │
│   1658 │   │   │   │   │   request,                                          │
│   1659 │   │   │   │   │   follow_redirects=follow_redirects,                │
│   1660 │   │   │   │   │   history=history,                                  │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx.Auth object at 0x7f51bc2677d0>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f51bba38040>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bae11390>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1694 in             │
│ _send_handling_redirects                                                     │
│                                                                              │
│   1691 │   │   │   for hook in self._event_hooks["request"]:                 │
│   1692 │   │   │   │   await hook(request)                                   │
│   1693 │   │   │                                                             │
│ ❱ 1694 │   │   │   response = await self._send_single_request(request)       │
│   1695 │   │   │   try:                                                      │
│   1696 │   │   │   │   for hook in self._event_hooks["response"]:            │
│   1697 │   │   │   │   │   await hook(response)                              │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │ follow_redirects = False                                           │       │
│ │          history = []                                              │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51bae11390>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1730 in             │
│ _send_single_request                                                         │
│                                                                              │
│   1727 │   │   │   )                                                         │
│   1728 │   │                                                                 │
│   1729 │   │   with request_context(request=request):                        │
│ ❱ 1730 │   │   │   response = await transport.handle_async_request(request)  │
│   1731 │   │                                                                 │
│   1732 │   │   assert isinstance(response.stream, AsyncByteStream)           │
│   1733 │   │   response.request = request                                    │
│                                                                              │
│ ╭──────────────────────────── locals ─────────────────────────────╮          │
│ │   request = <Request('PATCH', 'http://example.org/upload')>     │          │
│ │      self = <httpx.AsyncClient object at 0x7f51bae11390>        │          │
│ │     start = 160.398138824                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51bae12b10> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/__init__.py:56 in       │
│ mocked_handle_async_request                                                  │
│                                                                              │
│   53 │   │   transport: httpx.AsyncHTTPTransport, request: httpx.Request     │
│   54 │   ) -> httpx.Response:                                                │
│   55 │   │   if options.should_mock(request):                                │
│ ❱ 56 │   │   │   return await mock._handle_async_request(transport, request) │
│   57 │   │   return await real_handle_async_request(transport, request)      │
│   58 │                                                                       │
│   59 │   monkeypatch.setattr(                                                │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │      mock = <pytest_httpx._httpx_mock.HTTPXMock object at                │ │
│ │             0x7f51bae10c10>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f51bae11110>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51bae12b10>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:183 in   │
│ _handle_async_request                                                        │
│                                                                              │
│   180 │   │   │   │   │   response = await response                          │
│   181 │   │   │   │   return _unread(response)                               │
│   182 │   │                                                                  │
│ ❱ 183 │   │   self._request_not_matched(real_transport, request)             │
│   184 │                                                                      │
│   185 │   def _request_not_matched(                                          │
│   186 │   │   self,                                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       callback = None                                                    │ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51bae12b10>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51bae10c10>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:191 in   │
│ _request_not_matched                                                         │
│                                                                              │
│   188 │   │   request: httpx.Request,                                        │
│   189 │   ) -> NoReturn:                                                     │
│   190 │   │   self._requests_not_matched.append(request)                     │
│ ❱ 191 │   │   raise httpx.TimeoutException(                                  │
│   192 │   │   │   self._explain_that_no_response_was_found(real_transport, r │
│   193 │   │   │   request=request,                                           │
│   194 │   │   )                                                              │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51bae12b10>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51bae10c10>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
TimeoutException: No response can be found for PATCH request on 
http://example.org/upload with {'Content-Length': '524288'} headers amongst:
- Match HEAD request
- Already matched any request with {'Content-Length': '524288'} headers

If you wanted to reuse an already matched response instead of registering it 
again, refer to 
https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-
a-response-for-more-than-one-request

2025-01-02 09:55:00 [debug    ] patching                       attempt=4 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 09:55:00 [error    ] retrying                       attempt=4
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /builds/infrastructure/obs-proxy/obs_proxy/chunked_uploads/client.py:84 in   │
│ upload_chunked                                                               │
│                                                                              │
│    81 │   │   │   for attempt in range(MAX_ATTEMPTS):                        │
│    82 │   │   │   │   try:                                                   │
│    83 │   │   │   │   │   logger.debug("patching", uri=uri, size=len(chunk), │
│ ❱  84 │   │   │   │   │   r = await client.patch(                            │
│    85 │   │   │   │   │   │   uri,                                           │
│    86 │   │   │   │   │   │   content=chunk,                                 │
│    87 │   │   │   │   │   │   headers=chunk_headers,                         │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       attempt = 4                                                        │ │
│ │         chunk = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\… │ │
│ │ chunk_headers = {                                                        │ │
│ │                 │   'Patch-Content-Range': 'bytes                        │ │
│ │                 524288-1048575/4194304',                                 │ │
│ │                 │   'Content-Length': '524288'                           │ │
│ │                 }                                                        │ │
│ │    chunk_size = 524288                                                   │ │
│ │        client = <httpx.AsyncClient object at 0x7f51bae11390>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f51bae11250> wrapping <_io.BufferedReader          │ │
│ │                 name='/tmp/pytest-of-root/pytest-0/test_upload_chunked_… │ │
│ │             e = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Content-Length': '524288'} headers amongst:\n- Match   │ │
│ │                 HEAD request\n- Already matched any request with         │ │
│ │                 {'Content-Length': '524288'} headers\n\nIf you wanted to │ │
│ │                 reuse an already matched response instead of registering │ │
│ │                 it again, refer to                                       │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │           exc = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Content-Length': '524288'} headers amongst:\n- Match   │ │
│ │                 HEAD request\n- Already matched any request with         │ │
│ │                 {'Content-Length': '524288'} headers\n\nIf you wanted to │ │
│ │                 reuse an already matched response instead of registering │ │
│ │                 it again, refer to                                       │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │   file_hasher = <md5 _hashlib.HASH object @ 0x7f51baa7aeb0>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1933 in patch       │
│                                                                              │
│   1930 │   │                                                                 │
│   1931 │   │   **Parameters**: See `httpx.request`.                          │
│   1932 │   │   """                                                           │
│ ❱ 1933 │   │   return await self.request(                                    │
│   1934 │   │   │   "PATCH",                                                  │
│   1935 │   │   │   url,                                                      │
│   1936 │   │   │   content=content,                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bae11390>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1540 in request     │
│                                                                              │
│   1537 │   │   │   timeout=timeout,                                          │
│   1538 │   │   │   extensions=extensions,                                    │
│   1539 │   │   )                                                             │
│ ❱ 1540 │   │   return await self.send(request, auth=auth, follow_redirects=f │
│   1541 │                                                                     │
│   1542 │   @asynccontextmanager                                              │
│   1543 │   async def stream(                                                 │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           method = 'PATCH'                                               │ │
│ │           params = None                                                  │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bae11390>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1629 in send        │
│                                                                              │
│   1626 │   │                                                                 │
│   1627 │   │   auth = self._build_request_auth(request, auth)                │
│   1628 │   │                                                                 │
│ ❱ 1629 │   │   response = await self._send_handling_auth(                    │
│   1630 │   │   │   request,                                                  │
│   1631 │   │   │   auth=auth,                                                │
│   1632 │   │   │   follow_redirects=follow_redirects,                        │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │             auth = <httpx.Auth object at 0x7f51bbb15990>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51bae11390>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1657 in             │
│ _send_handling_auth                                                          │
│                                                                              │
│   1654 │   │   │   request = await auth_flow.__anext__()                     │
│   1655 │   │   │                                                             │
│   1656 │   │   │   while True:                                               │
│ ❱ 1657 │   │   │   │   response = await self._send_handling_redirects(       │
│   1658 │   │   │   │   │   request,                                          │
│   1659 │   │   │   │   │   follow_redirects=follow_redirects,                │
│   1660 │   │   │   │   │   history=history,                                  │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx.Auth object at 0x7f51bbb15990>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f51bc2f73d0>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bae11390>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1694 in             │
│ _send_handling_redirects                                                     │
│                                                                              │
│   1691 │   │   │   for hook in self._event_hooks["request"]:                 │
│   1692 │   │   │   │   await hook(request)                                   │
│   1693 │   │   │                                                             │
│ ❱ 1694 │   │   │   response = await self._send_single_request(request)       │
│   1695 │   │   │   try:                                                      │
│   1696 │   │   │   │   for hook in self._event_hooks["response"]:            │
│   1697 │   │   │   │   │   await hook(response)                              │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │ follow_redirects = False                                           │       │
│ │          history = []                                              │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51bae11390>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1730 in             │
│ _send_single_request                                                         │
│                                                                              │
│   1727 │   │   │   )                                                         │
│   1728 │   │                                                                 │
│   1729 │   │   with request_context(request=request):                        │
│ ❱ 1730 │   │   │   response = await transport.handle_async_request(request)  │
│   1731 │   │                                                                 │
│   1732 │   │   assert isinstance(response.stream, AsyncByteStream)           │
│   1733 │   │   response.request = request                                    │
│                                                                              │
│ ╭──────────────────────────── locals ─────────────────────────────╮          │
│ │   request = <Request('PATCH', 'http://example.org/upload')>     │          │
│ │      self = <httpx.AsyncClient object at 0x7f51bae11390>        │          │
│ │     start = 161.646384035                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51bae12b10> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/__init__.py:56 in       │
│ mocked_handle_async_request                                                  │
│                                                                              │
│   53 │   │   transport: httpx.AsyncHTTPTransport, request: httpx.Request     │
│   54 │   ) -> httpx.Response:                                                │
│   55 │   │   if options.should_mock(request):                                │
│ ❱ 56 │   │   │   return await mock._handle_async_request(transport, request) │
│   57 │   │   return await real_handle_async_request(transport, request)      │
│   58 │                                                                       │
│   59 │   monkeypatch.setattr(                                                │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │      mock = <pytest_httpx._httpx_mock.HTTPXMock object at                │ │
│ │             0x7f51bae10c10>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f51bae11110>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51bae12b10>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:183 in   │
│ _handle_async_request                                                        │
│                                                                              │
│   180 │   │   │   │   │   response = await response                          │
│   181 │   │   │   │   return _unread(response)                               │
│   182 │   │                                                                  │
│ ❱ 183 │   │   self._request_not_matched(real_transport, request)             │
│   184 │                                                                      │
│   185 │   def _request_not_matched(                                          │
│   186 │   │   self,                                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       callback = None                                                    │ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51bae12b10>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51bae10c10>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:191 in   │
│ _request_not_matched                                                         │
│                                                                              │
│   188 │   │   request: httpx.Request,                                        │
│   189 │   ) -> NoReturn:                                                     │
│   190 │   │   self._requests_not_matched.append(request)                     │
│ ❱ 191 │   │   raise httpx.TimeoutException(                                  │
│   192 │   │   │   self._explain_that_no_response_was_found(real_transport, r │
│   193 │   │   │   request=request,                                           │
│   194 │   │   )                                                              │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51bae12b10>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51bae10c10>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
TimeoutException: No response can be found for PATCH request on 
http://example.org/upload with {'Content-Length': '524288'} headers amongst:
- Match HEAD request
- Already matched any request with {'Content-Length': '524288'} headers

If you wanted to reuse an already matched response instead of registering it 
again, refer to 
https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-
a-response-for-more-than-one-request

=================================== FAILURES ===================================
_________________________ test_upload_chunked_timeout __________________________

client = <httpx.AsyncClient object at 0x7f51bba19110>
uri = 'http://example.org/upload'
data = <aiofiles.threadpool.binary.AsyncBufferedReader object at 0x7f51bba1b0d0> wrapping <_io.BufferedReader name='/tmp/pytest-of-root/pytest-0/test_upload_chunked_timeout0/tempfile'>
size = 4194304, chunk_size = 524288, headers = {}, kv = {}
content_range = <ContentRange 'bytes 524288-1048575/4194304'>, attempt = 4
file_hasher = <md5 _hashlib.HASH object @ 0x7f51bbaadd10>
chunk_headers = {'Content-Length': '524288', 'Patch-Content-Range': 'bytes 524288-1048575/4194304'}
offset = 524288
chunk = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00...00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
pos = 1048576

    async def upload_chunked(
            client: httpx.AsyncClient,
            uri: str,
            data: AsyncFileIO,
            size: int,
            chunk_size: int = UPLOAD_CHUNK_SIZE,
            headers=None,
            **kv,
    ):
        if not headers:
            headers = {}
    
        content_range = None
        attempt = 0
        file_hasher = hashlib.md5()
        try:
            chunk_headers = headers.copy()
            await data.seek(0)
            while True:
                offset = await data.tell()
                chunk = await data.read(chunk_size)
                if not chunk:
                    break
                pos = await data.tell()
    
                file_hasher.update(chunk)
    
                content_range = ContentRange(
                    start=offset,
                    stop=pos,
                    length=size,
                    units="bytes",
                )
                chunk_headers["Patch-Content-Range"] = content_range.to_header()
                chunk_headers["Content-Length"] = str(len(chunk))
                exc = None
                for attempt in range(MAX_ATTEMPTS):
                    try:
                        logger.debug("patching", uri=uri, size=len(chunk), content_range=content_range, attempt=attempt)
                        r = await client.patch(
                            uri,
                            content=chunk,
                            headers=chunk_headers,
                            **kv,
                        )
                        logger.debug("patch result", result=r)
                        if r.is_success:
                            break
                        else:
                            r.raise_for_status()
                    except httpx.HTTPStatusError as e:
                        if not e.response.is_server_error:
                            logger.debug("not server error, not retrying", resp=e.response)
                            raise
                        logger.exception("retrying", attempt=attempt)
                        exc = e
                    except httpx.HTTPError as e:
                        logger.exception("retrying", attempt=attempt)
                        exc = e
                else:
>                   raise exc

obs_proxy/chunked_uploads/client.py:105: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
obs_proxy/chunked_uploads/client.py:84: in upload_chunked
    r = await client.patch(
/usr/local/lib/python3.11/site-packages/httpx/_client.py:1933: in patch
    return await self.request(
/usr/local/lib/python3.11/site-packages/httpx/_client.py:1540: in request
    return await self.send(request, auth=auth, follow_redirects=follow_redirects)
/usr/local/lib/python3.11/site-packages/httpx/_client.py:1629: in send
    response = await self._send_handling_auth(
/usr/local/lib/python3.11/site-packages/httpx/_client.py:1657: in _send_handling_auth
    response = await self._send_handling_redirects(
/usr/local/lib/python3.11/site-packages/httpx/_client.py:1694: in _send_handling_redirects
    response = await self._send_single_request(request)
/usr/local/lib/python3.11/site-packages/httpx/_client.py:1730: in _send_single_request
    response = await transport.handle_async_request(request)
/usr/local/lib/python3.11/site-packages/pytest_httpx/__init__.py:56: in mocked_handle_async_request
    return await mock._handle_async_request(transport, request)
/usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:183: in _handle_async_request
    self._request_not_matched(real_transport, request)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <pytest_httpx._httpx_mock.HTTPXMock object at 0x7f51bba1bf10>
real_transport = <httpx.AsyncHTTPTransport object at 0x7f51bba18650>
request = <Request('PATCH', 'http://example.org/upload')>

    def _request_not_matched(
        self,
        real_transport: Union[httpx.AsyncHTTPTransport, httpx.HTTPTransport],
        request: httpx.Request,
    ) -> NoReturn:
        self._requests_not_matched.append(request)
>       raise httpx.TimeoutException(
            self._explain_that_no_response_was_found(real_transport, request),
            request=request,
        )
E       httpx.TimeoutException: No response can be found for PATCH request on http://example.org/upload with {'Patch-Content-Range': 'bytes 524288-1048575/4194304', 'Content-Length': '524288'} headers amongst:
E       - Match any request with {'Patch-Content-Range': 'bytes 2621440-3145727/4194304'} headers
E       - Already matched any request with {'Content-Length': '524288'} headers
E       
E       If you wanted to reuse an already matched response instead of registering it again, refer to https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-a-response-for-more-than-one-request

/usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:191: TimeoutException

The above exception was the direct cause of the following exception:

tmp_path = PosixPath('/tmp/pytest-of-root/pytest-0/test_upload_chunked_timeout0')
httpx_mock = <pytest_httpx._httpx_mock.HTTPXMock object at 0x7f51bba1bf10>

    @pytest.mark.asyncio
    async def test_upload_chunked_timeout(
            tmp_path: Path,
            httpx_mock: HTTPXMock,
    ):
        """Verify that protocol errors are handled properly.
    
        Check that timeouts and other protocol errors cause the failed chunk to be repeatedly
        re-uploaded, and, failing that, ultimately raise an appropriate exception allowing
        the issue to be reported.
        """
        httpx_mock.add_response(
            match_headers={
                "Content-Length": str(CHUNK_SIZE),
            },
        )
    
        break_at_chunk = 5
        break_at = "bytes %d-%d/%d" % (
            break_at_chunk * CHUNK_SIZE,
            (break_at_chunk + 1) * CHUNK_SIZE - 1,
            SIZE,
        )
    
        httpx_mock.add_exception(
            httpx.ReadTimeout("Simulated timeout"),
            match_headers={
                "Patch-Content-Range": break_at,
            },
        )
    
        tmp_file = tmp_path / "tempfile"
        with tmp_file.open("wb") as f:
            f.truncate(SIZE)
    
        async with httpx.AsyncClient() as client:
            file = await aiofiles.open(tmp_file, 'rb')
            with pytest.raises(
                    ChunkedUploadError,
                    match=f"Upload error at range {break_at} .attempt 4.: Simulated timeout",
            ) as excinfo:
>               await upload_chunked(
                    client,
                    "http://example.org/upload",
                    data=file,
                    size=SIZE,
                    chunk_size=CHUNK_SIZE,
                )

tests/chunked_uploads/test_upload_chunked.py:60: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

client = <httpx.AsyncClient object at 0x7f51bba19110>
uri = 'http://example.org/upload'
data = <aiofiles.threadpool.binary.AsyncBufferedReader object at 0x7f51bba1b0d0> wrapping <_io.BufferedReader name='/tmp/pytest-of-root/pytest-0/test_upload_chunked_timeout0/tempfile'>
size = 4194304, chunk_size = 524288, headers = {}, kv = {}
content_range = <ContentRange 'bytes 524288-1048575/4194304'>, attempt = 4
file_hasher = <md5 _hashlib.HASH object @ 0x7f51bbaadd10>
chunk_headers = {'Content-Length': '524288', 'Patch-Content-Range': 'bytes 524288-1048575/4194304'}
offset = 524288
chunk = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00...00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
pos = 1048576

    async def upload_chunked(
            client: httpx.AsyncClient,
            uri: str,
            data: AsyncFileIO,
            size: int,
            chunk_size: int = UPLOAD_CHUNK_SIZE,
            headers=None,
            **kv,
    ):
        if not headers:
            headers = {}
    
        content_range = None
        attempt = 0
        file_hasher = hashlib.md5()
        try:
            chunk_headers = headers.copy()
            await data.seek(0)
            while True:
                offset = await data.tell()
                chunk = await data.read(chunk_size)
                if not chunk:
                    break
                pos = await data.tell()
    
                file_hasher.update(chunk)
    
                content_range = ContentRange(
                    start=offset,
                    stop=pos,
                    length=size,
                    units="bytes",
                )
                chunk_headers["Patch-Content-Range"] = content_range.to_header()
                chunk_headers["Content-Length"] = str(len(chunk))
                exc = None
                for attempt in range(MAX_ATTEMPTS):
                    try:
                        logger.debug("patching", uri=uri, size=len(chunk), content_range=content_range, attempt=attempt)
                        r = await client.patch(
                            uri,
                            content=chunk,
                            headers=chunk_headers,
                            **kv,
                        )
                        logger.debug("patch result", result=r)
                        if r.is_success:
                            break
                        else:
                            r.raise_for_status()
                    except httpx.HTTPStatusError as e:
                        if not e.response.is_server_error:
                            logger.debug("not server error, not retrying", resp=e.response)
                            raise
                        logger.exception("retrying", attempt=attempt)
                        exc = e
                    except httpx.HTTPError as e:
                        logger.exception("retrying", attempt=attempt)
                        exc = e
                else:
                    raise exc
    
            logger.debug("get etag", uri=uri)
            # now verify the hash
            r = await client.head(
                uri,
                headers=headers,
            )
            calculated_hash = file_hasher.hexdigest()
            etag, _ = unquote_etag(r.headers.get("etag"))
    
            logger.debug("check upload", etag=etag, calculated_hash=calculated_hash)
    
            if etag != calculated_hash:
                raise ChunkedUploadVerificationError(
                    expected=calculated_hash,
                    actual=etag,
                )
    
        except httpx.HTTPError as e:
>           raise ChunkedUploadError(
                content_range=content_range,
                attempt=attempt,
            ) from e
E           obs_proxy.chunked_uploads.client.ChunkedUploadError: Upload error at range bytes 524288-1048575/4194304 (attempt 4): No response can be found for PATCH request on http://example.org/upload with {'Patch-Content-Range': 'bytes 524288-1048575/4194304', 'Content-Length': '524288'} headers amongst:
E           - Match any request with {'Patch-Content-Range': 'bytes 2621440-3145727/4194304'} headers
E           - Already matched any request with {'Content-Length': '524288'} headers
E           
E           If you wanted to reuse an already matched response instead of registering it again, refer to https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-a-response-for-more-than-one-request

obs_proxy/chunked_uploads/client.py:125: ChunkedUploadError

During handling of the above exception, another exception occurred:

tmp_path = PosixPath('/tmp/pytest-of-root/pytest-0/test_upload_chunked_timeout0')
httpx_mock = <pytest_httpx._httpx_mock.HTTPXMock object at 0x7f51bba1bf10>

    @pytest.mark.asyncio
    async def test_upload_chunked_timeout(
            tmp_path: Path,
            httpx_mock: HTTPXMock,
    ):
        """Verify that protocol errors are handled properly.
    
        Check that timeouts and other protocol errors cause the failed chunk to be repeatedly
        re-uploaded, and, failing that, ultimately raise an appropriate exception allowing
        the issue to be reported.
        """
        httpx_mock.add_response(
            match_headers={
                "Content-Length": str(CHUNK_SIZE),
            },
        )
    
        break_at_chunk = 5
        break_at = "bytes %d-%d/%d" % (
            break_at_chunk * CHUNK_SIZE,
            (break_at_chunk + 1) * CHUNK_SIZE - 1,
            SIZE,
        )
    
        httpx_mock.add_exception(
            httpx.ReadTimeout("Simulated timeout"),
            match_headers={
                "Patch-Content-Range": break_at,
            },
        )
    
        tmp_file = tmp_path / "tempfile"
        with tmp_file.open("wb") as f:
            f.truncate(SIZE)
    
        async with httpx.AsyncClient() as client:
            file = await aiofiles.open(tmp_file, 'rb')
>           with pytest.raises(
                    ChunkedUploadError,
                    match=f"Upload error at range {break_at} .attempt 4.: Simulated timeout",
            ) as excinfo:
E           AssertionError: Regex pattern did not match.
E            Regex: 'Upload error at range bytes 2621440-3145727/4194304 .attempt 4.: Simulated timeout'
E            Input: "Upload error at range bytes 524288-1048575/4194304 (attempt 4): No response can be found for PATCH request on http://example.org/upload with {'Patch-Content-Range': 'bytes 524288-1048575/4194304', 'Content-Length': '524288'} headers amongst:\n- Match any request with {'Patch-Content-Range': 'bytes 2621440-3145727/4194304'} headers\n- Already matched any request with {'Content-Length': '524288'} headers\n\nIf you wanted to reuse an already matched response instead of registering it again, refer to https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-a-response-for-more-than-one-request"

tests/chunked_uploads/test_upload_chunked.py:56: AssertionError
----------------------------- Captured stdout call -----------------------------
2025-01-02 09:54:35 [debug    ] patching                       attempt=0 content_range=<ContentRange 'bytes 0-524287/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 09:54:35 [debug    ] patch result                   result=<Response [200 OK]>
2025-01-02 09:54:35 [debug    ] patching                       attempt=0 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 09:54:35 [error    ] retrying                       attempt=0
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /builds/infrastructure/obs-proxy/obs_proxy/chunked_uploads/client.py:84 in   │
│ upload_chunked                                                               │
│                                                                              │
│    81 │   │   │   for attempt in range(MAX_ATTEMPTS):                        │
│    82 │   │   │   │   try:                                                   │
│    83 │   │   │   │   │   logger.debug("patching", uri=uri, size=len(chunk), │
│ ❱  84 │   │   │   │   │   r = await client.patch(                            │
│    85 │   │   │   │   │   │   uri,                                           │
│    86 │   │   │   │   │   │   content=chunk,                                 │
│    87 │   │   │   │   │   │   headers=chunk_headers,                         │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       attempt = 0                                                        │ │
│ │         chunk = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\… │ │
│ │ chunk_headers = {                                                        │ │
│ │                 │   'Patch-Content-Range': 'bytes                        │ │
│ │                 524288-1048575/4194304',                                 │ │
│ │                 │   'Content-Length': '524288'                           │ │
│ │                 }                                                        │ │
│ │    chunk_size = 524288                                                   │ │
│ │        client = <httpx.AsyncClient object at 0x7f51bba19110>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f51bba1b0d0> wrapping <_io.BufferedReader          │ │
│ │                 name='/tmp/pytest-of-root/pytest-0/test_upload_chunked_… │ │
│ │             e = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Patch-Content-Range': 'bytes 524288-1048575/4194304',  │ │
│ │                 'Content-Length': '524288'} headers amongst:\n- Match    │ │
│ │                 any request with {'Patch-Content-Range': 'bytes          │ │
│ │                 2621440-3145727/4194304'} headers\n- Already matched any │ │
│ │                 request with {'Content-Length': '524288'} headers\n\nIf  │ │
│ │                 you wanted to reuse an already matched response instead  │ │
│ │                 of registering it again, refer to                        │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │           exc = None                                                     │ │
│ │   file_hasher = <md5 _hashlib.HASH object @ 0x7f51bbaadd10>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1933 in patch       │
│                                                                              │
│   1930 │   │                                                                 │
│   1931 │   │   **Parameters**: See `httpx.request`.                          │
│   1932 │   │   """                                                           │
│ ❱ 1933 │   │   return await self.request(                                    │
│   1934 │   │   │   "PATCH",                                                  │
│   1935 │   │   │   url,                                                      │
│   1936 │   │   │   content=content,                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bba19110>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1540 in request     │
│                                                                              │
│   1537 │   │   │   timeout=timeout,                                          │
│   1538 │   │   │   extensions=extensions,                                    │
│   1539 │   │   )                                                             │
│ ❱ 1540 │   │   return await self.send(request, auth=auth, follow_redirects=f │
│   1541 │                                                                     │
│   1542 │   @asynccontextmanager                                              │
│   1543 │   async def stream(                                                 │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           method = 'PATCH'                                               │ │
│ │           params = None                                                  │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bba19110>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1629 in send        │
│                                                                              │
│   1626 │   │                                                                 │
│   1627 │   │   auth = self._build_request_auth(request, auth)                │
│   1628 │   │                                                                 │
│ ❱ 1629 │   │   response = await self._send_handling_auth(                    │
│   1630 │   │   │   request,                                                  │
│   1631 │   │   │   auth=auth,                                                │
│   1632 │   │   │   follow_redirects=follow_redirects,                        │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │             auth = <httpx.Auth object at 0x7f51bba1a2d0>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51bba19110>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1657 in             │
│ _send_handling_auth                                                          │
│                                                                              │
│   1654 │   │   │   request = await auth_flow.__anext__()                     │
│   1655 │   │   │                                                             │
│   1656 │   │   │   while True:                                               │
│ ❱ 1657 │   │   │   │   response = await self._send_handling_redirects(       │
│   1658 │   │   │   │   │   request,                                          │
│   1659 │   │   │   │   │   follow_redirects=follow_redirects,                │
│   1660 │   │   │   │   │   history=history,                                  │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx.Auth object at 0x7f51bba1a2d0>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f51bbb7e200>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bba19110>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1694 in             │
│ _send_handling_redirects                                                     │
│                                                                              │
│   1691 │   │   │   for hook in self._event_hooks["request"]:                 │
│   1692 │   │   │   │   await hook(request)                                   │
│   1693 │   │   │                                                             │
│ ❱ 1694 │   │   │   response = await self._send_single_request(request)       │
│   1695 │   │   │   try:                                                      │
│   1696 │   │   │   │   for hook in self._event_hooks["response"]:            │
│   1697 │   │   │   │   │   await hook(response)                              │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │ follow_redirects = False                                           │       │
│ │          history = []                                              │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51bba19110>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1730 in             │
│ _send_single_request                                                         │
│                                                                              │
│   1727 │   │   │   )                                                         │
│   1728 │   │                                                                 │
│   1729 │   │   with request_context(request=request):                        │
│ ❱ 1730 │   │   │   response = await transport.handle_async_request(request)  │
│   1731 │   │                                                                 │
│   1732 │   │   assert isinstance(response.stream, AsyncByteStream)           │
│   1733 │   │   response.request = request                                    │
│                                                                              │
│ ╭──────────────────────────── locals ─────────────────────────────╮          │
│ │   request = <Request('PATCH', 'http://example.org/upload')>     │          │
│ │      self = <httpx.AsyncClient object at 0x7f51bba19110>        │          │
│ │     start = 136.800514143                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51bba18650> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/__init__.py:56 in       │
│ mocked_handle_async_request                                                  │
│                                                                              │
│   53 │   │   transport: httpx.AsyncHTTPTransport, request: httpx.Request     │
│   54 │   ) -> httpx.Response:                                                │
│   55 │   │   if options.should_mock(request):                                │
│ ❱ 56 │   │   │   return await mock._handle_async_request(transport, request) │
│   57 │   │   return await real_handle_async_request(transport, request)      │
│   58 │                                                                       │
│   59 │   monkeypatch.setattr(                                                │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │      mock = <pytest_httpx._httpx_mock.HTTPXMock object at                │ │
│ │             0x7f51bba1bf10>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f51bba1b790>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51bba18650>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:183 in   │
│ _handle_async_request                                                        │
│                                                                              │
│   180 │   │   │   │   │   response = await response                          │
│   181 │   │   │   │   return _unread(response)                               │
│   182 │   │                                                                  │
│ ❱ 183 │   │   self._request_not_matched(real_transport, request)             │
│   184 │                                                                      │
│   185 │   def _request_not_matched(                                          │
│   186 │   │   self,                                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       callback = None                                                    │ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51bba18650>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51bba1bf10>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:191 in   │
│ _request_not_matched                                                         │
│                                                                              │
│   188 │   │   request: httpx.Request,                                        │
│   189 │   ) -> NoReturn:                                                     │
│   190 │   │   self._requests_not_matched.append(request)                     │
│ ❱ 191 │   │   raise httpx.TimeoutException(                                  │
│   192 │   │   │   self._explain_that_no_response_was_found(real_transport, r │
│   193 │   │   │   request=request,                                           │
│   194 │   │   )                                                              │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51bba18650>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51bba1bf10>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
TimeoutException: No response can be found for PATCH request on 
http://example.org/upload with {'Patch-Content-Range': 'bytes 
524288-1048575/4194304', 'Content-Length': '524288'} headers amongst:
- Match any request with {'Patch-Content-Range': 'bytes 
2621440-3145727/4194304'} headers
- Already matched any request with {'Content-Length': '524288'} headers

If you wanted to reuse an already matched response instead of registering it 
again, refer to 
https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-
a-response-for-more-than-one-request

2025-01-02 09:54:36 [debug    ] patching                       attempt=1 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 09:54:36 [error    ] retrying                       attempt=1
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /builds/infrastructure/obs-proxy/obs_proxy/chunked_uploads/client.py:84 in   │
│ upload_chunked                                                               │
│                                                                              │
│    81 │   │   │   for attempt in range(MAX_ATTEMPTS):                        │
│    82 │   │   │   │   try:                                                   │
│    83 │   │   │   │   │   logger.debug("patching", uri=uri, size=len(chunk), │
│ ❱  84 │   │   │   │   │   r = await client.patch(                            │
│    85 │   │   │   │   │   │   uri,                                           │
│    86 │   │   │   │   │   │   content=chunk,                                 │
│    87 │   │   │   │   │   │   headers=chunk_headers,                         │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       attempt = 1                                                        │ │
│ │         chunk = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\… │ │
│ │ chunk_headers = {                                                        │ │
│ │                 │   'Patch-Content-Range': 'bytes                        │ │
│ │                 524288-1048575/4194304',                                 │ │
│ │                 │   'Content-Length': '524288'                           │ │
│ │                 }                                                        │ │
│ │    chunk_size = 524288                                                   │ │
│ │        client = <httpx.AsyncClient object at 0x7f51bba19110>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f51bba1b0d0> wrapping <_io.BufferedReader          │ │
│ │                 name='/tmp/pytest-of-root/pytest-0/test_upload_chunked_… │ │
│ │             e = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Patch-Content-Range': 'bytes 524288-1048575/4194304',  │ │
│ │                 'Content-Length': '524288'} headers amongst:\n- Match    │ │
│ │                 any request with {'Patch-Content-Range': 'bytes          │ │
│ │                 2621440-3145727/4194304'} headers\n- Already matched any │ │
│ │                 request with {'Content-Length': '524288'} headers\n\nIf  │ │
│ │                 you wanted to reuse an already matched response instead  │ │
│ │                 of registering it again, refer to                        │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │           exc = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Patch-Content-Range': 'bytes 524288-1048575/4194304',  │ │
│ │                 'Content-Length': '524288'} headers amongst:\n- Match    │ │
│ │                 any request with {'Patch-Content-Range': 'bytes          │ │
│ │                 2621440-3145727/4194304'} headers\n- Already matched any │ │
│ │                 request with {'Content-Length': '524288'} headers\n\nIf  │ │
│ │                 you wanted to reuse an already matched response instead  │ │
│ │                 of registering it again, refer to                        │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │   file_hasher = <md5 _hashlib.HASH object @ 0x7f51bbaadd10>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1933 in patch       │
│                                                                              │
│   1930 │   │                                                                 │
│   1931 │   │   **Parameters**: See `httpx.request`.                          │
│   1932 │   │   """                                                           │
│ ❱ 1933 │   │   return await self.request(                                    │
│   1934 │   │   │   "PATCH",                                                  │
│   1935 │   │   │   url,                                                      │
│   1936 │   │   │   content=content,                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bba19110>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1540 in request     │
│                                                                              │
│   1537 │   │   │   timeout=timeout,                                          │
│   1538 │   │   │   extensions=extensions,                                    │
│   1539 │   │   )                                                             │
│ ❱ 1540 │   │   return await self.send(request, auth=auth, follow_redirects=f │
│   1541 │                                                                     │
│   1542 │   @asynccontextmanager                                              │
│   1543 │   async def stream(                                                 │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           method = 'PATCH'                                               │ │
│ │           params = None                                                  │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bba19110>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1629 in send        │
│                                                                              │
│   1626 │   │                                                                 │
│   1627 │   │   auth = self._build_request_auth(request, auth)                │
│   1628 │   │                                                                 │
│ ❱ 1629 │   │   response = await self._send_handling_auth(                    │
│   1630 │   │   │   request,                                                  │
│   1631 │   │   │   auth=auth,                                                │
│   1632 │   │   │   follow_redirects=follow_redirects,                        │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │             auth = <httpx.Auth object at 0x7f51bbb06ad0>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51bba19110>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1657 in             │
│ _send_handling_auth                                                          │
│                                                                              │
│   1654 │   │   │   request = await auth_flow.__anext__()                     │
│   1655 │   │   │                                                             │
│   1656 │   │   │   while True:                                               │
│ ❱ 1657 │   │   │   │   response = await self._send_handling_redirects(       │
│   1658 │   │   │   │   │   request,                                          │
│   1659 │   │   │   │   │   follow_redirects=follow_redirects,                │
│   1660 │   │   │   │   │   history=history,                                  │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx.Auth object at 0x7f51bbb06ad0>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f51bba38310>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bba19110>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1694 in             │
│ _send_handling_redirects                                                     │
│                                                                              │
│   1691 │   │   │   for hook in self._event_hooks["request"]:                 │
│   1692 │   │   │   │   await hook(request)                                   │
│   1693 │   │   │                                                             │
│ ❱ 1694 │   │   │   response = await self._send_single_request(request)       │
│   1695 │   │   │   try:                                                      │
│   1696 │   │   │   │   for hook in self._event_hooks["response"]:            │
│   1697 │   │   │   │   │   await hook(response)                              │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │ follow_redirects = False                                           │       │
│ │          history = []                                              │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51bba19110>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1730 in             │
│ _send_single_request                                                         │
│                                                                              │
│   1727 │   │   │   )                                                         │
│   1728 │   │                                                                 │
│   1729 │   │   with request_context(request=request):                        │
│ ❱ 1730 │   │   │   response = await transport.handle_async_request(request)  │
│   1731 │   │                                                                 │
│   1732 │   │   assert isinstance(response.stream, AsyncByteStream)           │
│   1733 │   │   response.request = request                                    │
│                                                                              │
│ ╭──────────────────────────── locals ─────────────────────────────╮          │
│ │   request = <Request('PATCH', 'http://example.org/upload')>     │          │
│ │      self = <httpx.AsyncClient object at 0x7f51bba19110>        │          │
│ │     start = 138.427616326                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51bba18650> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/__init__.py:56 in       │
│ mocked_handle_async_request                                                  │
│                                                                              │
│   53 │   │   transport: httpx.AsyncHTTPTransport, request: httpx.Request     │
│   54 │   ) -> httpx.Response:                                                │
│   55 │   │   if options.should_mock(request):                                │
│ ❱ 56 │   │   │   return await mock._handle_async_request(transport, request) │
│   57 │   │   return await real_handle_async_request(transport, request)      │
│   58 │                                                                       │
│   59 │   monkeypatch.setattr(                                                │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │      mock = <pytest_httpx._httpx_mock.HTTPXMock object at                │ │
│ │             0x7f51bba1bf10>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f51bba1b790>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51bba18650>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:183 in   │
│ _handle_async_request                                                        │
│                                                                              │
│   180 │   │   │   │   │   response = await response                          │
│   181 │   │   │   │   return _unread(response)                               │
│   182 │   │                                                                  │
│ ❱ 183 │   │   self._request_not_matched(real_transport, request)             │
│   184 │                                                                      │
│   185 │   def _request_not_matched(                                          │
│   186 │   │   self,                                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       callback = None                                                    │ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51bba18650>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51bba1bf10>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:191 in   │
│ _request_not_matched                                                         │
│                                                                              │
│   188 │   │   request: httpx.Request,                                        │
│   189 │   ) -> NoReturn:                                                     │
│   190 │   │   self._requests_not_matched.append(request)                     │
│ ❱ 191 │   │   raise httpx.TimeoutException(                                  │
│   192 │   │   │   self._explain_that_no_response_was_found(real_transport, r │
│   193 │   │   │   request=request,                                           │
│   194 │   │   )                                                              │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51bba18650>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51bba1bf10>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
TimeoutException: No response can be found for PATCH request on 
http://example.org/upload with {'Patch-Content-Range': 'bytes 
524288-1048575/4194304', 'Content-Length': '524288'} headers amongst:
- Match any request with {'Patch-Content-Range': 'bytes 
2621440-3145727/4194304'} headers
- Already matched any request with {'Content-Length': '524288'} headers

If you wanted to reuse an already matched response instead of registering it 
again, refer to 
https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-
a-response-for-more-than-one-request

2025-01-02 09:54:38 [debug    ] patching                       attempt=2 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 09:54:38 [error    ] retrying                       attempt=2
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /builds/infrastructure/obs-proxy/obs_proxy/chunked_uploads/client.py:84 in   │
│ upload_chunked                                                               │
│                                                                              │
│    81 │   │   │   for attempt in range(MAX_ATTEMPTS):                        │
│    82 │   │   │   │   try:                                                   │
│    83 │   │   │   │   │   logger.debug("patching", uri=uri, size=len(chunk), │
│ ❱  84 │   │   │   │   │   r = await client.patch(                            │
│    85 │   │   │   │   │   │   uri,                                           │
│    86 │   │   │   │   │   │   content=chunk,                                 │
│    87 │   │   │   │   │   │   headers=chunk_headers,                         │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       attempt = 2                                                        │ │
│ │         chunk = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\… │ │
│ │ chunk_headers = {                                                        │ │
│ │                 │   'Patch-Content-Range': 'bytes                        │ │
│ │                 524288-1048575/4194304',                                 │ │
│ │                 │   'Content-Length': '524288'                           │ │
│ │                 }                                                        │ │
│ │    chunk_size = 524288                                                   │ │
│ │        client = <httpx.AsyncClient object at 0x7f51bba19110>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f51bba1b0d0> wrapping <_io.BufferedReader          │ │
│ │                 name='/tmp/pytest-of-root/pytest-0/test_upload_chunked_… │ │
│ │             e = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Patch-Content-Range': 'bytes 524288-1048575/4194304',  │ │
│ │                 'Content-Length': '524288'} headers amongst:\n- Match    │ │
│ │                 any request with {'Patch-Content-Range': 'bytes          │ │
│ │                 2621440-3145727/4194304'} headers\n- Already matched any │ │
│ │                 request with {'Content-Length': '524288'} headers\n\nIf  │ │
│ │                 you wanted to reuse an already matched response instead  │ │
│ │                 of registering it again, refer to                        │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │           exc = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Patch-Content-Range': 'bytes 524288-1048575/4194304',  │ │
│ │                 'Content-Length': '524288'} headers amongst:\n- Match    │ │
│ │                 any request with {'Patch-Content-Range': 'bytes          │ │
│ │                 2621440-3145727/4194304'} headers\n- Already matched any │ │
│ │                 request with {'Content-Length': '524288'} headers\n\nIf  │ │
│ │                 you wanted to reuse an already matched response instead  │ │
│ │                 of registering it again, refer to                        │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │   file_hasher = <md5 _hashlib.HASH object @ 0x7f51bbaadd10>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1933 in patch       │
│                                                                              │
│   1930 │   │                                                                 │
│   1931 │   │   **Parameters**: See `httpx.request`.                          │
│   1932 │   │   """                                                           │
│ ❱ 1933 │   │   return await self.request(                                    │
│   1934 │   │   │   "PATCH",                                                  │
│   1935 │   │   │   url,                                                      │
│   1936 │   │   │   content=content,                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bba19110>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1540 in request     │
│                                                                              │
│   1537 │   │   │   timeout=timeout,                                          │
│   1538 │   │   │   extensions=extensions,                                    │
│   1539 │   │   )                                                             │
│ ❱ 1540 │   │   return await self.send(request, auth=auth, follow_redirects=f │
│   1541 │                                                                     │
│   1542 │   @asynccontextmanager                                              │
│   1543 │   async def stream(                                                 │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           method = 'PATCH'                                               │ │
│ │           params = None                                                  │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bba19110>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1629 in send        │
│                                                                              │
│   1626 │   │                                                                 │
│   1627 │   │   auth = self._build_request_auth(request, auth)                │
│   1628 │   │                                                                 │
│ ❱ 1629 │   │   response = await self._send_handling_auth(                    │
│   1630 │   │   │   request,                                                  │
│   1631 │   │   │   auth=auth,                                                │
│   1632 │   │   │   follow_redirects=follow_redirects,                        │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │             auth = <httpx.Auth object at 0x7f51bbacb750>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51bba19110>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1657 in             │
│ _send_handling_auth                                                          │
│                                                                              │
│   1654 │   │   │   request = await auth_flow.__anext__()                     │
│   1655 │   │   │                                                             │
│   1656 │   │   │   while True:                                               │
│ ❱ 1657 │   │   │   │   response = await self._send_handling_redirects(       │
│   1658 │   │   │   │   │   request,                                          │
│   1659 │   │   │   │   │   follow_redirects=follow_redirects,                │
│   1660 │   │   │   │   │   history=history,                                  │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx.Auth object at 0x7f51bbacb750>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f51bba389a0>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bba19110>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1694 in             │
│ _send_handling_redirects                                                     │
│                                                                              │
│   1691 │   │   │   for hook in self._event_hooks["request"]:                 │
│   1692 │   │   │   │   await hook(request)                                   │
│   1693 │   │   │                                                             │
│ ❱ 1694 │   │   │   response = await self._send_single_request(request)       │
│   1695 │   │   │   try:                                                      │
│   1696 │   │   │   │   for hook in self._event_hooks["response"]:            │
│   1697 │   │   │   │   │   await hook(response)                              │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │ follow_redirects = False                                           │       │
│ │          history = []                                              │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51bba19110>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1730 in             │
│ _send_single_request                                                         │
│                                                                              │
│   1727 │   │   │   )                                                         │
│   1728 │   │                                                                 │
│   1729 │   │   with request_context(request=request):                        │
│ ❱ 1730 │   │   │   response = await transport.handle_async_request(request)  │
│   1731 │   │                                                                 │
│   1732 │   │   assert isinstance(response.stream, AsyncByteStream)           │
│   1733 │   │   response.request = request                                    │
│                                                                              │
│ ╭──────────────────────────── locals ─────────────────────────────╮          │
│ │   request = <Request('PATCH', 'http://example.org/upload')>     │          │
│ │      self = <httpx.AsyncClient object at 0x7f51bba19110>        │          │
│ │     start = 139.984235736                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51bba18650> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/__init__.py:56 in       │
│ mocked_handle_async_request                                                  │
│                                                                              │
│   53 │   │   transport: httpx.AsyncHTTPTransport, request: httpx.Request     │
│   54 │   ) -> httpx.Response:                                                │
│   55 │   │   if options.should_mock(request):                                │
│ ❱ 56 │   │   │   return await mock._handle_async_request(transport, request) │
│   57 │   │   return await real_handle_async_request(transport, request)      │
│   58 │                                                                       │
│   59 │   monkeypatch.setattr(                                                │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │      mock = <pytest_httpx._httpx_mock.HTTPXMock object at                │ │
│ │             0x7f51bba1bf10>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f51bba1b790>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51bba18650>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:183 in   │
│ _handle_async_request                                                        │
│                                                                              │
│   180 │   │   │   │   │   response = await response                          │
│   181 │   │   │   │   return _unread(response)                               │
│   182 │   │                                                                  │
│ ❱ 183 │   │   self._request_not_matched(real_transport, request)             │
│   184 │                                                                      │
│   185 │   def _request_not_matched(                                          │
│   186 │   │   self,                                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       callback = None                                                    │ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51bba18650>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51bba1bf10>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:191 in   │
│ _request_not_matched                                                         │
│                                                                              │
│   188 │   │   request: httpx.Request,                                        │
│   189 │   ) -> NoReturn:                                                     │
│   190 │   │   self._requests_not_matched.append(request)                     │
│ ❱ 191 │   │   raise httpx.TimeoutException(                                  │
│   192 │   │   │   self._explain_that_no_response_was_found(real_transport, r │
│   193 │   │   │   request=request,                                           │
│   194 │   │   )                                                              │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51bba18650>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51bba1bf10>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
TimeoutException: No response can be found for PATCH request on 
http://example.org/upload with {'Patch-Content-Range': 'bytes 
524288-1048575/4194304', 'Content-Length': '524288'} headers amongst:
- Match any request with {'Patch-Content-Range': 'bytes 
2621440-3145727/4194304'} headers
- Already matched any request with {'Content-Length': '524288'} headers

If you wanted to reuse an already matched response instead of registering it 
again, refer to 
https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-
a-response-for-more-than-one-request

2025-01-02 09:54:40 [debug    ] patching                       attempt=3 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 09:54:40 [error    ] retrying                       attempt=3
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /builds/infrastructure/obs-proxy/obs_proxy/chunked_uploads/client.py:84 in   │
│ upload_chunked                                                               │
│                                                                              │
│    81 │   │   │   for attempt in range(MAX_ATTEMPTS):                        │
│    82 │   │   │   │   try:                                                   │
│    83 │   │   │   │   │   logger.debug("patching", uri=uri, size=len(chunk), │
│ ❱  84 │   │   │   │   │   r = await client.patch(                            │
│    85 │   │   │   │   │   │   uri,                                           │
│    86 │   │   │   │   │   │   content=chunk,                                 │
│    87 │   │   │   │   │   │   headers=chunk_headers,                         │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       attempt = 3                                                        │ │
│ │         chunk = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\… │ │
│ │ chunk_headers = {                                                        │ │
│ │                 │   'Patch-Content-Range': 'bytes                        │ │
│ │                 524288-1048575/4194304',                                 │ │
│ │                 │   'Content-Length': '524288'                           │ │
│ │                 }                                                        │ │
│ │    chunk_size = 524288                                                   │ │
│ │        client = <httpx.AsyncClient object at 0x7f51bba19110>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f51bba1b0d0> wrapping <_io.BufferedReader          │ │
│ │                 name='/tmp/pytest-of-root/pytest-0/test_upload_chunked_… │ │
│ │             e = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Patch-Content-Range': 'bytes 524288-1048575/4194304',  │ │
│ │                 'Content-Length': '524288'} headers amongst:\n- Match    │ │
│ │                 any request with {'Patch-Content-Range': 'bytes          │ │
│ │                 2621440-3145727/4194304'} headers\n- Already matched any │ │
│ │                 request with {'Content-Length': '524288'} headers\n\nIf  │ │
│ │                 you wanted to reuse an already matched response instead  │ │
│ │                 of registering it again, refer to                        │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │           exc = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Patch-Content-Range': 'bytes 524288-1048575/4194304',  │ │
│ │                 'Content-Length': '524288'} headers amongst:\n- Match    │ │
│ │                 any request with {'Patch-Content-Range': 'bytes          │ │
│ │                 2621440-3145727/4194304'} headers\n- Already matched any │ │
│ │                 request with {'Content-Length': '524288'} headers\n\nIf  │ │
│ │                 you wanted to reuse an already matched response instead  │ │
│ │                 of registering it again, refer to                        │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │   file_hasher = <md5 _hashlib.HASH object @ 0x7f51bbaadd10>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1933 in patch       │
│                                                                              │
│   1930 │   │                                                                 │
│   1931 │   │   **Parameters**: See `httpx.request`.                          │
│   1932 │   │   """                                                           │
│ ❱ 1933 │   │   return await self.request(                                    │
│   1934 │   │   │   "PATCH",                                                  │
│   1935 │   │   │   url,                                                      │
│   1936 │   │   │   content=content,                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bba19110>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1540 in request     │
│                                                                              │
│   1537 │   │   │   timeout=timeout,                                          │
│   1538 │   │   │   extensions=extensions,                                    │
│   1539 │   │   )                                                             │
│ ❱ 1540 │   │   return await self.send(request, auth=auth, follow_redirects=f │
│   1541 │                                                                     │
│   1542 │   @asynccontextmanager                                              │
│   1543 │   async def stream(                                                 │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           method = 'PATCH'                                               │ │
│ │           params = None                                                  │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bba19110>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1629 in send        │
│                                                                              │
│   1626 │   │                                                                 │
│   1627 │   │   auth = self._build_request_auth(request, auth)                │
│   1628 │   │                                                                 │
│ ❱ 1629 │   │   response = await self._send_handling_auth(                    │
│   1630 │   │   │   request,                                                  │
│   1631 │   │   │   auth=auth,                                                │
│   1632 │   │   │   follow_redirects=follow_redirects,                        │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │             auth = <httpx.Auth object at 0x7f51bbcb2ad0>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51bba19110>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1657 in             │
│ _send_handling_auth                                                          │
│                                                                              │
│   1654 │   │   │   request = await auth_flow.__anext__()                     │
│   1655 │   │   │                                                             │
│   1656 │   │   │   while True:                                               │
│ ❱ 1657 │   │   │   │   response = await self._send_handling_redirects(       │
│   1658 │   │   │   │   │   request,                                          │
│   1659 │   │   │   │   │   follow_redirects=follow_redirects,                │
│   1660 │   │   │   │   │   history=history,                                  │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx.Auth object at 0x7f51bbcb2ad0>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f51bba38d60>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bba19110>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1694 in             │
│ _send_handling_redirects                                                     │
│                                                                              │
│   1691 │   │   │   for hook in self._event_hooks["request"]:                 │
│   1692 │   │   │   │   await hook(request)                                   │
│   1693 │   │   │                                                             │
│ ❱ 1694 │   │   │   response = await self._send_single_request(request)       │
│   1695 │   │   │   try:                                                      │
│   1696 │   │   │   │   for hook in self._event_hooks["response"]:            │
│   1697 │   │   │   │   │   await hook(response)                              │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │ follow_redirects = False                                           │       │
│ │          history = []                                              │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51bba19110>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1730 in             │
│ _send_single_request                                                         │
│                                                                              │
│   1727 │   │   │   )                                                         │
│   1728 │   │                                                                 │
│   1729 │   │   with request_context(request=request):                        │
│ ❱ 1730 │   │   │   response = await transport.handle_async_request(request)  │
│   1731 │   │                                                                 │
│   1732 │   │   assert isinstance(response.stream, AsyncByteStream)           │
│   1733 │   │   response.request = request                                    │
│                                                                              │
│ ╭──────────────────────────── locals ─────────────────────────────╮          │
│ │   request = <Request('PATCH', 'http://example.org/upload')>     │          │
│ │      self = <httpx.AsyncClient object at 0x7f51bba19110>        │          │
│ │     start = 141.591669583                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51bba18650> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/__init__.py:56 in       │
│ mocked_handle_async_request                                                  │
│                                                                              │
│   53 │   │   transport: httpx.AsyncHTTPTransport, request: httpx.Request     │
│   54 │   ) -> httpx.Response:                                                │
│   55 │   │   if options.should_mock(request):                                │
│ ❱ 56 │   │   │   return await mock._handle_async_request(transport, request) │
│   57 │   │   return await real_handle_async_request(transport, request)      │
│   58 │                                                                       │
│   59 │   monkeypatch.setattr(                                                │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │      mock = <pytest_httpx._httpx_mock.HTTPXMock object at                │ │
│ │             0x7f51bba1bf10>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f51bba1b790>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51bba18650>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:183 in   │
│ _handle_async_request                                                        │
│                                                                              │
│   180 │   │   │   │   │   response = await response                          │
│   181 │   │   │   │   return _unread(response)                               │
│   182 │   │                                                                  │
│ ❱ 183 │   │   self._request_not_matched(real_transport, request)             │
│   184 │                                                                      │
│   185 │   def _request_not_matched(                                          │
│   186 │   │   self,                                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       callback = None                                                    │ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51bba18650>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51bba1bf10>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:191 in   │
│ _request_not_matched                                                         │
│                                                                              │
│   188 │   │   request: httpx.Request,                                        │
│   189 │   ) -> NoReturn:                                                     │
│   190 │   │   self._requests_not_matched.append(request)                     │
│ ❱ 191 │   │   raise httpx.TimeoutException(                                  │
│   192 │   │   │   self._explain_that_no_response_was_found(real_transport, r │
│   193 │   │   │   request=request,                                           │
│   194 │   │   )                                                              │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51bba18650>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51bba1bf10>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
TimeoutException: No response can be found for PATCH request on 
http://example.org/upload with {'Patch-Content-Range': 'bytes 
524288-1048575/4194304', 'Content-Length': '524288'} headers amongst:
- Match any request with {'Patch-Content-Range': 'bytes 
2621440-3145727/4194304'} headers
- Already matched any request with {'Content-Length': '524288'} headers

If you wanted to reuse an already matched response instead of registering it 
again, refer to 
https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-
a-response-for-more-than-one-request

2025-01-02 09:54:41 [debug    ] patching                       attempt=4 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 09:54:41 [error    ] retrying                       attempt=4
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /builds/infrastructure/obs-proxy/obs_proxy/chunked_uploads/client.py:84 in   │
│ upload_chunked                                                               │
│                                                                              │
│    81 │   │   │   for attempt in range(MAX_ATTEMPTS):                        │
│    82 │   │   │   │   try:                                                   │
│    83 │   │   │   │   │   logger.debug("patching", uri=uri, size=len(chunk), │
│ ❱  84 │   │   │   │   │   r = await client.patch(                            │
│    85 │   │   │   │   │   │   uri,                                           │
│    86 │   │   │   │   │   │   content=chunk,                                 │
│    87 │   │   │   │   │   │   headers=chunk_headers,                         │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       attempt = 4                                                        │ │
│ │         chunk = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\… │ │
│ │ chunk_headers = {                                                        │ │
│ │                 │   'Patch-Content-Range': 'bytes                        │ │
│ │                 524288-1048575/4194304',                                 │ │
│ │                 │   'Content-Length': '524288'                           │ │
│ │                 }                                                        │ │
│ │    chunk_size = 524288                                                   │ │
│ │        client = <httpx.AsyncClient object at 0x7f51bba19110>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f51bba1b0d0> wrapping <_io.BufferedReader          │ │
│ │                 name='/tmp/pytest-of-root/pytest-0/test_upload_chunked_… │ │
│ │             e = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Patch-Content-Range': 'bytes 524288-1048575/4194304',  │ │
│ │                 'Content-Length': '524288'} headers amongst:\n- Match    │ │
│ │                 any request with {'Patch-Content-Range': 'bytes          │ │
│ │                 2621440-3145727/4194304'} headers\n- Already matched any │ │
│ │                 request with {'Content-Length': '524288'} headers\n\nIf  │ │
│ │                 you wanted to reuse an already matched response instead  │ │
│ │                 of registering it again, refer to                        │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │           exc = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Patch-Content-Range': 'bytes 524288-1048575/4194304',  │ │
│ │                 'Content-Length': '524288'} headers amongst:\n- Match    │ │
│ │                 any request with {'Patch-Content-Range': 'bytes          │ │
│ │                 2621440-3145727/4194304'} headers\n- Already matched any │ │
│ │                 request with {'Content-Length': '524288'} headers\n\nIf  │ │
│ │                 you wanted to reuse an already matched response instead  │ │
│ │                 of registering it again, refer to                        │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │   file_hasher = <md5 _hashlib.HASH object @ 0x7f51bbaadd10>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1933 in patch       │
│                                                                              │
│   1930 │   │                                                                 │
│   1931 │   │   **Parameters**: See `httpx.request`.                          │
│   1932 │   │   """                                                           │
│ ❱ 1933 │   │   return await self.request(                                    │
│   1934 │   │   │   "PATCH",                                                  │
│   1935 │   │   │   url,                                                      │
│   1936 │   │   │   content=content,                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bba19110>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1540 in request     │
│                                                                              │
│   1537 │   │   │   timeout=timeout,                                          │
│   1538 │   │   │   extensions=extensions,                                    │
│   1539 │   │   )                                                             │
│ ❱ 1540 │   │   return await self.send(request, auth=auth, follow_redirects=f │
│   1541 │                                                                     │
│   1542 │   @asynccontextmanager                                              │
│   1543 │   async def stream(                                                 │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           method = 'PATCH'                                               │ │
│ │           params = None                                                  │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bba19110>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1629 in send        │
│                                                                              │
│   1626 │   │                                                                 │
│   1627 │   │   auth = self._build_request_auth(request, auth)                │
│   1628 │   │                                                                 │
│ ❱ 1629 │   │   response = await self._send_handling_auth(                    │
│   1630 │   │   │   request,                                                  │
│   1631 │   │   │   auth=auth,                                                │
│   1632 │   │   │   follow_redirects=follow_redirects,                        │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │             auth = <httpx.Auth object at 0x7f51bbc978d0>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51bba19110>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1657 in             │
│ _send_handling_auth                                                          │
│                                                                              │
│   1654 │   │   │   request = await auth_flow.__anext__()                     │
│   1655 │   │   │                                                             │
│   1656 │   │   │   while True:                                               │
│ ❱ 1657 │   │   │   │   response = await self._send_handling_redirects(       │
│   1658 │   │   │   │   │   request,                                          │
│   1659 │   │   │   │   │   follow_redirects=follow_redirects,                │
│   1660 │   │   │   │   │   history=history,                                  │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx.Auth object at 0x7f51bbc978d0>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f51bba38130>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bba19110>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1694 in             │
│ _send_handling_redirects                                                     │
│                                                                              │
│   1691 │   │   │   for hook in self._event_hooks["request"]:                 │
│   1692 │   │   │   │   await hook(request)                                   │
│   1693 │   │   │                                                             │
│ ❱ 1694 │   │   │   response = await self._send_single_request(request)       │
│   1695 │   │   │   try:                                                      │
│   1696 │   │   │   │   for hook in self._event_hooks["response"]:            │
│   1697 │   │   │   │   │   await hook(response)                              │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │ follow_redirects = False                                           │       │
│ │          history = []                                              │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51bba19110>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1730 in             │
│ _send_single_request                                                         │
│                                                                              │
│   1727 │   │   │   )                                                         │
│   1728 │   │                                                                 │
│   1729 │   │   with request_context(request=request):                        │
│ ❱ 1730 │   │   │   response = await transport.handle_async_request(request)  │
│   1731 │   │                                                                 │
│   1732 │   │   assert isinstance(response.stream, AsyncByteStream)           │
│   1733 │   │   response.request = request                                    │
│                                                                              │
│ ╭──────────────────────────── locals ─────────────────────────────╮          │
│ │   request = <Request('PATCH', 'http://example.org/upload')>     │          │
│ │      self = <httpx.AsyncClient object at 0x7f51bba19110>        │          │
│ │     start = 143.113264733                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51bba18650> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/__init__.py:56 in       │
│ mocked_handle_async_request                                                  │
│                                                                              │
│   53 │   │   transport: httpx.AsyncHTTPTransport, request: httpx.Request     │
│   54 │   ) -> httpx.Response:                                                │
│   55 │   │   if options.should_mock(request):                                │
│ ❱ 56 │   │   │   return await mock._handle_async_request(transport, request) │
│   57 │   │   return await real_handle_async_request(transport, request)      │
│   58 │                                                                       │
│   59 │   monkeypatch.setattr(                                                │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │      mock = <pytest_httpx._httpx_mock.HTTPXMock object at                │ │
│ │             0x7f51bba1bf10>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f51bba1b790>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51bba18650>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:183 in   │
│ _handle_async_request                                                        │
│                                                                              │
│   180 │   │   │   │   │   response = await response                          │
│   181 │   │   │   │   return _unread(response)                               │
│   182 │   │                                                                  │
│ ❱ 183 │   │   self._request_not_matched(real_transport, request)             │
│   184 │                                                                      │
│   185 │   def _request_not_matched(                                          │
│   186 │   │   self,                                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       callback = None                                                    │ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51bba18650>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51bba1bf10>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:191 in   │
│ _request_not_matched                                                         │
│                                                                              │
│   188 │   │   request: httpx.Request,                                        │
│   189 │   ) -> NoReturn:                                                     │
│   190 │   │   self._requests_not_matched.append(request)                     │
│ ❱ 191 │   │   raise httpx.TimeoutException(                                  │
│   192 │   │   │   self._explain_that_no_response_was_found(real_transport, r │
│   193 │   │   │   request=request,                                           │
│   194 │   │   )                                                              │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51bba18650>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51bba1bf10>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
TimeoutException: No response can be found for PATCH request on 
http://example.org/upload with {'Patch-Content-Range': 'bytes 
524288-1048575/4194304', 'Content-Length': '524288'} headers amongst:
- Match any request with {'Patch-Content-Range': 'bytes 
2621440-3145727/4194304'} headers
- Already matched any request with {'Content-Length': '524288'} headers

If you wanted to reuse an already matched response instead of registering it 
again, refer to 
https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-
a-response-for-more-than-one-request

______________________ test_upload_chunked_wrong_response ______________________

client = <httpx.AsyncClient object at 0x7f51badfb6d0>
uri = 'http://example.org/upload'
data = <aiofiles.threadpool.binary.AsyncBufferedReader object at 0x7f51badf8c90> wrapping <_io.BufferedReader name='/tmp/pytest-of-root/pytest-0/test_upload_chunked_wrong_resp0/tempfile'>
size = 4194304, chunk_size = 524288, headers = {}, kv = {}
content_range = <ContentRange 'bytes 524288-1048575/4194304'>, attempt = 4
file_hasher = <md5 _hashlib.HASH object @ 0x7f51bbaafd30>
chunk_headers = {'Content-Length': '524288', 'Patch-Content-Range': 'bytes 524288-1048575/4194304'}
offset = 524288
chunk = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00...00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
pos = 1048576

    async def upload_chunked(
            client: httpx.AsyncClient,
            uri: str,
            data: AsyncFileIO,
            size: int,
            chunk_size: int = UPLOAD_CHUNK_SIZE,
            headers=None,
            **kv,
    ):
        if not headers:
            headers = {}
    
        content_range = None
        attempt = 0
        file_hasher = hashlib.md5()
        try:
            chunk_headers = headers.copy()
            await data.seek(0)
            while True:
                offset = await data.tell()
                chunk = await data.read(chunk_size)
                if not chunk:
                    break
                pos = await data.tell()
    
                file_hasher.update(chunk)
    
                content_range = ContentRange(
                    start=offset,
                    stop=pos,
                    length=size,
                    units="bytes",
                )
                chunk_headers["Patch-Content-Range"] = content_range.to_header()
                chunk_headers["Content-Length"] = str(len(chunk))
                exc = None
                for attempt in range(MAX_ATTEMPTS):
                    try:
                        logger.debug("patching", uri=uri, size=len(chunk), content_range=content_range, attempt=attempt)
                        r = await client.patch(
                            uri,
                            content=chunk,
                            headers=chunk_headers,
                            **kv,
                        )
                        logger.debug("patch result", result=r)
                        if r.is_success:
                            break
                        else:
                            r.raise_for_status()
                    except httpx.HTTPStatusError as e:
                        if not e.response.is_server_error:
                            logger.debug("not server error, not retrying", resp=e.response)
                            raise
                        logger.exception("retrying", attempt=attempt)
                        exc = e
                    except httpx.HTTPError as e:
                        logger.exception("retrying", attempt=attempt)
                        exc = e
                else:
>                   raise exc

obs_proxy/chunked_uploads/client.py:105: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
obs_proxy/chunked_uploads/client.py:84: in upload_chunked
    r = await client.patch(
/usr/local/lib/python3.11/site-packages/httpx/_client.py:1933: in patch
    return await self.request(
/usr/local/lib/python3.11/site-packages/httpx/_client.py:1540: in request
    return await self.send(request, auth=auth, follow_redirects=follow_redirects)
/usr/local/lib/python3.11/site-packages/httpx/_client.py:1629: in send
    response = await self._send_handling_auth(
/usr/local/lib/python3.11/site-packages/httpx/_client.py:1657: in _send_handling_auth
    response = await self._send_handling_redirects(
/usr/local/lib/python3.11/site-packages/httpx/_client.py:1694: in _send_handling_redirects
    response = await self._send_single_request(request)
/usr/local/lib/python3.11/site-packages/httpx/_client.py:1730: in _send_single_request
    response = await transport.handle_async_request(request)
/usr/local/lib/python3.11/site-packages/pytest_httpx/__init__.py:56: in mocked_handle_async_request
    return await mock._handle_async_request(transport, request)
/usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:183: in _handle_async_request
    self._request_not_matched(real_transport, request)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <pytest_httpx._httpx_mock.HTTPXMock object at 0x7f51badf9f90>
real_transport = <httpx.AsyncHTTPTransport object at 0x7f51badf9d90>
request = <Request('PATCH', 'http://example.org/upload')>

    def _request_not_matched(
        self,
        real_transport: Union[httpx.AsyncHTTPTransport, httpx.HTTPTransport],
        request: httpx.Request,
    ) -> NoReturn:
        self._requests_not_matched.append(request)
>       raise httpx.TimeoutException(
            self._explain_that_no_response_was_found(real_transport, request),
            request=request,
        )
E       httpx.TimeoutException: No response can be found for PATCH request on http://example.org/upload with {'Patch-Content-Range': 'bytes 524288-1048575/4194304', 'Content-Length': '524288'} headers amongst:
E       - Match any request with {'Patch-Content-Range': 'bytes 2621440-3145727/4194304'} headers
E       - Already matched any request with {'Content-Length': '524288'} headers
E       
E       If you wanted to reuse an already matched response instead of registering it again, refer to https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-a-response-for-more-than-one-request

/usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:191: TimeoutException

The above exception was the direct cause of the following exception:

tmp_path = PosixPath('/tmp/pytest-of-root/pytest-0/test_upload_chunked_wrong_resp0')
httpx_mock = <pytest_httpx._httpx_mock.HTTPXMock object at 0x7f51badf9f90>

    @pytest.mark.asyncio
    async def test_upload_chunked_wrong_response(
            tmp_path: Path,
            httpx_mock: HTTPXMock,
    ):
        """Verify that unexpected HTTP responses interrupt the upload immediately and raise an exception"""
        httpx_mock.add_response(
            match_headers={
                "Content-Length": str(CHUNK_SIZE),
            },
        )
    
        break_at_chunk = 5
        break_at = "bytes %d-%d/%d" % (
            break_at_chunk * CHUNK_SIZE,
            (break_at_chunk + 1) * CHUNK_SIZE - 1,
            SIZE,
        )
    
        httpx_mock.add_response(
            status_code=418,
            match_headers={
                "Patch-Content-Range": break_at,
            },
        )
    
        tmp_file = tmp_path / "tempfile"
        with tmp_file.open("wb") as f:
            f.truncate(SIZE)
    
        async with httpx.AsyncClient() as client:
            file = await aiofiles.open(tmp_file, 'rb')
            with pytest.raises(
                    ChunkedUploadError,
                    match=f"Upload error at range {break_at} .attempt 0.: .*418 I'm a teapot.*",
            ) as excinfo:
>               await upload_chunked(
                    client,
                    "http://example.org/upload",
                    data=file,
                    size=SIZE,
                    chunk_size=CHUNK_SIZE,
                )

tests/chunked_uploads/test_upload_chunked.py:106: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

client = <httpx.AsyncClient object at 0x7f51badfb6d0>
uri = 'http://example.org/upload'
data = <aiofiles.threadpool.binary.AsyncBufferedReader object at 0x7f51badf8c90> wrapping <_io.BufferedReader name='/tmp/pytest-of-root/pytest-0/test_upload_chunked_wrong_resp0/tempfile'>
size = 4194304, chunk_size = 524288, headers = {}, kv = {}
content_range = <ContentRange 'bytes 524288-1048575/4194304'>, attempt = 4
file_hasher = <md5 _hashlib.HASH object @ 0x7f51bbaafd30>
chunk_headers = {'Content-Length': '524288', 'Patch-Content-Range': 'bytes 524288-1048575/4194304'}
offset = 524288
chunk = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00...00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
pos = 1048576

    async def upload_chunked(
            client: httpx.AsyncClient,
            uri: str,
            data: AsyncFileIO,
            size: int,
            chunk_size: int = UPLOAD_CHUNK_SIZE,
            headers=None,
            **kv,
    ):
        if not headers:
            headers = {}
    
        content_range = None
        attempt = 0
        file_hasher = hashlib.md5()
        try:
            chunk_headers = headers.copy()
            await data.seek(0)
            while True:
                offset = await data.tell()
                chunk = await data.read(chunk_size)
                if not chunk:
                    break
                pos = await data.tell()
    
                file_hasher.update(chunk)
    
                content_range = ContentRange(
                    start=offset,
                    stop=pos,
                    length=size,
                    units="bytes",
                )
                chunk_headers["Patch-Content-Range"] = content_range.to_header()
                chunk_headers["Content-Length"] = str(len(chunk))
                exc = None
                for attempt in range(MAX_ATTEMPTS):
                    try:
                        logger.debug("patching", uri=uri, size=len(chunk), content_range=content_range, attempt=attempt)
                        r = await client.patch(
                            uri,
                            content=chunk,
                            headers=chunk_headers,
                            **kv,
                        )
                        logger.debug("patch result", result=r)
                        if r.is_success:
                            break
                        else:
                            r.raise_for_status()
                    except httpx.HTTPStatusError as e:
                        if not e.response.is_server_error:
                            logger.debug("not server error, not retrying", resp=e.response)
                            raise
                        logger.exception("retrying", attempt=attempt)
                        exc = e
                    except httpx.HTTPError as e:
                        logger.exception("retrying", attempt=attempt)
                        exc = e
                else:
                    raise exc
    
            logger.debug("get etag", uri=uri)
            # now verify the hash
            r = await client.head(
                uri,
                headers=headers,
            )
            calculated_hash = file_hasher.hexdigest()
            etag, _ = unquote_etag(r.headers.get("etag"))
    
            logger.debug("check upload", etag=etag, calculated_hash=calculated_hash)
    
            if etag != calculated_hash:
                raise ChunkedUploadVerificationError(
                    expected=calculated_hash,
                    actual=etag,
                )
    
        except httpx.HTTPError as e:
>           raise ChunkedUploadError(
                content_range=content_range,
                attempt=attempt,
            ) from e
E           obs_proxy.chunked_uploads.client.ChunkedUploadError: Upload error at range bytes 524288-1048575/4194304 (attempt 4): No response can be found for PATCH request on http://example.org/upload with {'Patch-Content-Range': 'bytes 524288-1048575/4194304', 'Content-Length': '524288'} headers amongst:
E           - Match any request with {'Patch-Content-Range': 'bytes 2621440-3145727/4194304'} headers
E           - Already matched any request with {'Content-Length': '524288'} headers
E           
E           If you wanted to reuse an already matched response instead of registering it again, refer to https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-a-response-for-more-than-one-request

obs_proxy/chunked_uploads/client.py:125: ChunkedUploadError

During handling of the above exception, another exception occurred:

tmp_path = PosixPath('/tmp/pytest-of-root/pytest-0/test_upload_chunked_wrong_resp0')
httpx_mock = <pytest_httpx._httpx_mock.HTTPXMock object at 0x7f51badf9f90>

    @pytest.mark.asyncio
    async def test_upload_chunked_wrong_response(
            tmp_path: Path,
            httpx_mock: HTTPXMock,
    ):
        """Verify that unexpected HTTP responses interrupt the upload immediately and raise an exception"""
        httpx_mock.add_response(
            match_headers={
                "Content-Length": str(CHUNK_SIZE),
            },
        )
    
        break_at_chunk = 5
        break_at = "bytes %d-%d/%d" % (
            break_at_chunk * CHUNK_SIZE,
            (break_at_chunk + 1) * CHUNK_SIZE - 1,
            SIZE,
        )
    
        httpx_mock.add_response(
            status_code=418,
            match_headers={
                "Patch-Content-Range": break_at,
            },
        )
    
        tmp_file = tmp_path / "tempfile"
        with tmp_file.open("wb") as f:
            f.truncate(SIZE)
    
        async with httpx.AsyncClient() as client:
            file = await aiofiles.open(tmp_file, 'rb')
>           with pytest.raises(
                    ChunkedUploadError,
                    match=f"Upload error at range {break_at} .attempt 0.: .*418 I'm a teapot.*",
            ) as excinfo:
E           AssertionError: Regex pattern did not match.
E            Regex: "Upload error at range bytes 2621440-3145727/4194304 .attempt 0.: .*418 I'm a teapot.*"
E            Input: "Upload error at range bytes 524288-1048575/4194304 (attempt 4): No response can be found for PATCH request on http://example.org/upload with {'Patch-Content-Range': 'bytes 524288-1048575/4194304', 'Content-Length': '524288'} headers amongst:\n- Match any request with {'Patch-Content-Range': 'bytes 2621440-3145727/4194304'} headers\n- Already matched any request with {'Content-Length': '524288'} headers\n\nIf you wanted to reuse an already matched response instead of registering it again, refer to https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-a-response-for-more-than-one-request"

tests/chunked_uploads/test_upload_chunked.py:102: AssertionError
----------------------------- Captured stdout call -----------------------------
2025-01-02 09:54:43 [debug    ] patching                       attempt=0 content_range=<ContentRange 'bytes 0-524287/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 09:54:43 [debug    ] patch result                   result=<Response [200 OK]>
2025-01-02 09:54:43 [debug    ] patching                       attempt=0 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 09:54:43 [error    ] retrying                       attempt=0
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /builds/infrastructure/obs-proxy/obs_proxy/chunked_uploads/client.py:84 in   │
│ upload_chunked                                                               │
│                                                                              │
│    81 │   │   │   for attempt in range(MAX_ATTEMPTS):                        │
│    82 │   │   │   │   try:                                                   │
│    83 │   │   │   │   │   logger.debug("patching", uri=uri, size=len(chunk), │
│ ❱  84 │   │   │   │   │   r = await client.patch(                            │
│    85 │   │   │   │   │   │   uri,                                           │
│    86 │   │   │   │   │   │   content=chunk,                                 │
│    87 │   │   │   │   │   │   headers=chunk_headers,                         │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       attempt = 0                                                        │ │
│ │         chunk = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\… │ │
│ │ chunk_headers = {                                                        │ │
│ │                 │   'Patch-Content-Range': 'bytes                        │ │
│ │                 524288-1048575/4194304',                                 │ │
│ │                 │   'Content-Length': '524288'                           │ │
│ │                 }                                                        │ │
│ │    chunk_size = 524288                                                   │ │
│ │        client = <httpx.AsyncClient object at 0x7f51badfb6d0>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f51badf8c90> wrapping <_io.BufferedReader          │ │
│ │                 name='/tmp/pytest-of-root/pytest-0/test_upload_chunked_… │ │
│ │             e = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Patch-Content-Range': 'bytes 524288-1048575/4194304',  │ │
│ │                 'Content-Length': '524288'} headers amongst:\n- Match    │ │
│ │                 any request with {'Patch-Content-Range': 'bytes          │ │
│ │                 2621440-3145727/4194304'} headers\n- Already matched any │ │
│ │                 request with {'Content-Length': '524288'} headers\n\nIf  │ │
│ │                 you wanted to reuse an already matched response instead  │ │
│ │                 of registering it again, refer to                        │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │           exc = None                                                     │ │
│ │   file_hasher = <md5 _hashlib.HASH object @ 0x7f51bbaafd30>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1933 in patch       │
│                                                                              │
│   1930 │   │                                                                 │
│   1931 │   │   **Parameters**: See `httpx.request`.                          │
│   1932 │   │   """                                                           │
│ ❱ 1933 │   │   return await self.request(                                    │
│   1934 │   │   │   "PATCH",                                                  │
│   1935 │   │   │   url,                                                      │
│   1936 │   │   │   content=content,                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f51badfb6d0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1540 in request     │
│                                                                              │
│   1537 │   │   │   timeout=timeout,                                          │
│   1538 │   │   │   extensions=extensions,                                    │
│   1539 │   │   )                                                             │
│ ❱ 1540 │   │   return await self.send(request, auth=auth, follow_redirects=f │
│   1541 │                                                                     │
│   1542 │   @asynccontextmanager                                              │
│   1543 │   async def stream(                                                 │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           method = 'PATCH'                                               │ │
│ │           params = None                                                  │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51badfb6d0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1629 in send        │
│                                                                              │
│   1626 │   │                                                                 │
│   1627 │   │   auth = self._build_request_auth(request, auth)                │
│   1628 │   │                                                                 │
│ ❱ 1629 │   │   response = await self._send_handling_auth(                    │
│   1630 │   │   │   request,                                                  │
│   1631 │   │   │   auth=auth,                                                │
│   1632 │   │   │   follow_redirects=follow_redirects,                        │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │             auth = <httpx.Auth object at 0x7f51badfbf90>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51badfb6d0>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1657 in             │
│ _send_handling_auth                                                          │
│                                                                              │
│   1654 │   │   │   request = await auth_flow.__anext__()                     │
│   1655 │   │   │                                                             │
│   1656 │   │   │   while True:                                               │
│ ❱ 1657 │   │   │   │   response = await self._send_handling_redirects(       │
│   1658 │   │   │   │   │   request,                                          │
│   1659 │   │   │   │   │   follow_redirects=follow_redirects,                │
│   1660 │   │   │   │   │   history=history,                                  │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx.Auth object at 0x7f51badfbf90>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f51bb96d300>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51badfb6d0>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1694 in             │
│ _send_handling_redirects                                                     │
│                                                                              │
│   1691 │   │   │   for hook in self._event_hooks["request"]:                 │
│   1692 │   │   │   │   await hook(request)                                   │
│   1693 │   │   │                                                             │
│ ❱ 1694 │   │   │   response = await self._send_single_request(request)       │
│   1695 │   │   │   try:                                                      │
│   1696 │   │   │   │   for hook in self._event_hooks["response"]:            │
│   1697 │   │   │   │   │   await hook(response)                              │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │ follow_redirects = False                                           │       │
│ │          history = []                                              │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51badfb6d0>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1730 in             │
│ _send_single_request                                                         │
│                                                                              │
│   1727 │   │   │   )                                                         │
│   1728 │   │                                                                 │
│   1729 │   │   with request_context(request=request):                        │
│ ❱ 1730 │   │   │   response = await transport.handle_async_request(request)  │
│   1731 │   │                                                                 │
│   1732 │   │   assert isinstance(response.stream, AsyncByteStream)           │
│   1733 │   │   response.request = request                                    │
│                                                                              │
│ ╭──────────────────────────── locals ─────────────────────────────╮          │
│ │   request = <Request('PATCH', 'http://example.org/upload')>     │          │
│ │      self = <httpx.AsyncClient object at 0x7f51badfb6d0>        │          │
│ │     start = 144.965858387                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51badf9d90> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/__init__.py:56 in       │
│ mocked_handle_async_request                                                  │
│                                                                              │
│   53 │   │   transport: httpx.AsyncHTTPTransport, request: httpx.Request     │
│   54 │   ) -> httpx.Response:                                                │
│   55 │   │   if options.should_mock(request):                                │
│ ❱ 56 │   │   │   return await mock._handle_async_request(transport, request) │
│   57 │   │   return await real_handle_async_request(transport, request)      │
│   58 │                                                                       │
│   59 │   monkeypatch.setattr(                                                │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │      mock = <pytest_httpx._httpx_mock.HTTPXMock object at                │ │
│ │             0x7f51badf9f90>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f51badfb510>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51badf9d90>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:183 in   │
│ _handle_async_request                                                        │
│                                                                              │
│   180 │   │   │   │   │   response = await response                          │
│   181 │   │   │   │   return _unread(response)                               │
│   182 │   │                                                                  │
│ ❱ 183 │   │   self._request_not_matched(real_transport, request)             │
│   184 │                                                                      │
│   185 │   def _request_not_matched(                                          │
│   186 │   │   self,                                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       callback = None                                                    │ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51badf9d90>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51badf9f90>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:191 in   │
│ _request_not_matched                                                         │
│                                                                              │
│   188 │   │   request: httpx.Request,                                        │
│   189 │   ) -> NoReturn:                                                     │
│   190 │   │   self._requests_not_matched.append(request)                     │
│ ❱ 191 │   │   raise httpx.TimeoutException(                                  │
│   192 │   │   │   self._explain_that_no_response_was_found(real_transport, r │
│   193 │   │   │   request=request,                                           │
│   194 │   │   )                                                              │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51badf9d90>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51badf9f90>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
TimeoutException: No response can be found for PATCH request on 
http://example.org/upload with {'Patch-Content-Range': 'bytes 
524288-1048575/4194304', 'Content-Length': '524288'} headers amongst:
- Match any request with {'Patch-Content-Range': 'bytes 
2621440-3145727/4194304'} headers
- Already matched any request with {'Content-Length': '524288'} headers

If you wanted to reuse an already matched response instead of registering it 
again, refer to 
https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-
a-response-for-more-than-one-request

2025-01-02 09:54:44 [debug    ] patching                       attempt=1 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 09:54:44 [error    ] retrying                       attempt=1
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /builds/infrastructure/obs-proxy/obs_proxy/chunked_uploads/client.py:84 in   │
│ upload_chunked                                                               │
│                                                                              │
│    81 │   │   │   for attempt in range(MAX_ATTEMPTS):                        │
│    82 │   │   │   │   try:                                                   │
│    83 │   │   │   │   │   logger.debug("patching", uri=uri, size=len(chunk), │
│ ❱  84 │   │   │   │   │   r = await client.patch(                            │
│    85 │   │   │   │   │   │   uri,                                           │
│    86 │   │   │   │   │   │   content=chunk,                                 │
│    87 │   │   │   │   │   │   headers=chunk_headers,                         │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       attempt = 1                                                        │ │
│ │         chunk = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\… │ │
│ │ chunk_headers = {                                                        │ │
│ │                 │   'Patch-Content-Range': 'bytes                        │ │
│ │                 524288-1048575/4194304',                                 │ │
│ │                 │   'Content-Length': '524288'                           │ │
│ │                 }                                                        │ │
│ │    chunk_size = 524288                                                   │ │
│ │        client = <httpx.AsyncClient object at 0x7f51badfb6d0>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f51badf8c90> wrapping <_io.BufferedReader          │ │
│ │                 name='/tmp/pytest-of-root/pytest-0/test_upload_chunked_… │ │
│ │             e = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Patch-Content-Range': 'bytes 524288-1048575/4194304',  │ │
│ │                 'Content-Length': '524288'} headers amongst:\n- Match    │ │
│ │                 any request with {'Patch-Content-Range': 'bytes          │ │
│ │                 2621440-3145727/4194304'} headers\n- Already matched any │ │
│ │                 request with {'Content-Length': '524288'} headers\n\nIf  │ │
│ │                 you wanted to reuse an already matched response instead  │ │
│ │                 of registering it again, refer to                        │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │           exc = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Patch-Content-Range': 'bytes 524288-1048575/4194304',  │ │
│ │                 'Content-Length': '524288'} headers amongst:\n- Match    │ │
│ │                 any request with {'Patch-Content-Range': 'bytes          │ │
│ │                 2621440-3145727/4194304'} headers\n- Already matched any │ │
│ │                 request with {'Content-Length': '524288'} headers\n\nIf  │ │
│ │                 you wanted to reuse an already matched response instead  │ │
│ │                 of registering it again, refer to                        │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │   file_hasher = <md5 _hashlib.HASH object @ 0x7f51bbaafd30>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1933 in patch       │
│                                                                              │
│   1930 │   │                                                                 │
│   1931 │   │   **Parameters**: See `httpx.request`.                          │
│   1932 │   │   """                                                           │
│ ❱ 1933 │   │   return await self.request(                                    │
│   1934 │   │   │   "PATCH",                                                  │
│   1935 │   │   │   url,                                                      │
│   1936 │   │   │   content=content,                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f51badfb6d0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1540 in request     │
│                                                                              │
│   1537 │   │   │   timeout=timeout,                                          │
│   1538 │   │   │   extensions=extensions,                                    │
│   1539 │   │   )                                                             │
│ ❱ 1540 │   │   return await self.send(request, auth=auth, follow_redirects=f │
│   1541 │                                                                     │
│   1542 │   @asynccontextmanager                                              │
│   1543 │   async def stream(                                                 │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           method = 'PATCH'                                               │ │
│ │           params = None                                                  │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51badfb6d0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1629 in send        │
│                                                                              │
│   1626 │   │                                                                 │
│   1627 │   │   auth = self._build_request_auth(request, auth)                │
│   1628 │   │                                                                 │
│ ❱ 1629 │   │   response = await self._send_handling_auth(                    │
│   1630 │   │   │   request,                                                  │
│   1631 │   │   │   auth=auth,                                                │
│   1632 │   │   │   follow_redirects=follow_redirects,                        │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │             auth = <httpx.Auth object at 0x7f51bbdd33d0>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51badfb6d0>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1657 in             │
│ _send_handling_auth                                                          │
│                                                                              │
│   1654 │   │   │   request = await auth_flow.__anext__()                     │
│   1655 │   │   │                                                             │
│   1656 │   │   │   while True:                                               │
│ ❱ 1657 │   │   │   │   response = await self._send_handling_redirects(       │
│   1658 │   │   │   │   │   request,                                          │
│   1659 │   │   │   │   │   follow_redirects=follow_redirects,                │
│   1660 │   │   │   │   │   history=history,                                  │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx.Auth object at 0x7f51bbdd33d0>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f51bba38c70>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51badfb6d0>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1694 in             │
│ _send_handling_redirects                                                     │
│                                                                              │
│   1691 │   │   │   for hook in self._event_hooks["request"]:                 │
│   1692 │   │   │   │   await hook(request)                                   │
│   1693 │   │   │                                                             │
│ ❱ 1694 │   │   │   response = await self._send_single_request(request)       │
│   1695 │   │   │   try:                                                      │
│   1696 │   │   │   │   for hook in self._event_hooks["response"]:            │
│   1697 │   │   │   │   │   await hook(response)                              │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │ follow_redirects = False                                           │       │
│ │          history = []                                              │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51badfb6d0>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1730 in             │
│ _send_single_request                                                         │
│                                                                              │
│   1727 │   │   │   )                                                         │
│   1728 │   │                                                                 │
│   1729 │   │   with request_context(request=request):                        │
│ ❱ 1730 │   │   │   response = await transport.handle_async_request(request)  │
│   1731 │   │                                                                 │
│   1732 │   │   assert isinstance(response.stream, AsyncByteStream)           │
│   1733 │   │   response.request = request                                    │
│                                                                              │
│ ╭──────────────────────────── locals ─────────────────────────────╮          │
│ │   request = <Request('PATCH', 'http://example.org/upload')>     │          │
│ │      self = <httpx.AsyncClient object at 0x7f51badfb6d0>        │          │
│ │     start = 146.139331717                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51badf9d90> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/__init__.py:56 in       │
│ mocked_handle_async_request                                                  │
│                                                                              │
│   53 │   │   transport: httpx.AsyncHTTPTransport, request: httpx.Request     │
│   54 │   ) -> httpx.Response:                                                │
│   55 │   │   if options.should_mock(request):                                │
│ ❱ 56 │   │   │   return await mock._handle_async_request(transport, request) │
│   57 │   │   return await real_handle_async_request(transport, request)      │
│   58 │                                                                       │
│   59 │   monkeypatch.setattr(                                                │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │      mock = <pytest_httpx._httpx_mock.HTTPXMock object at                │ │
│ │             0x7f51badf9f90>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f51badfb510>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51badf9d90>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:183 in   │
│ _handle_async_request                                                        │
│                                                                              │
│   180 │   │   │   │   │   response = await response                          │
│   181 │   │   │   │   return _unread(response)                               │
│   182 │   │                                                                  │
│ ❱ 183 │   │   self._request_not_matched(real_transport, request)             │
│   184 │                                                                      │
│   185 │   def _request_not_matched(                                          │
│   186 │   │   self,                                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       callback = None                                                    │ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51badf9d90>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51badf9f90>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:191 in   │
│ _request_not_matched                                                         │
│                                                                              │
│   188 │   │   request: httpx.Request,                                        │
│   189 │   ) -> NoReturn:                                                     │
│   190 │   │   self._requests_not_matched.append(request)                     │
│ ❱ 191 │   │   raise httpx.TimeoutException(                                  │
│   192 │   │   │   self._explain_that_no_response_was_found(real_transport, r │
│   193 │   │   │   request=request,                                           │
│   194 │   │   )                                                              │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51badf9d90>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51badf9f90>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
TimeoutException: No response can be found for PATCH request on 
http://example.org/upload with {'Patch-Content-Range': 'bytes 
524288-1048575/4194304', 'Content-Length': '524288'} headers amongst:
- Match any request with {'Patch-Content-Range': 'bytes 
2621440-3145727/4194304'} headers
- Already matched any request with {'Content-Length': '524288'} headers

If you wanted to reuse an already matched response instead of registering it 
again, refer to 
https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-
a-response-for-more-than-one-request

2025-01-02 09:54:45 [debug    ] patching                       attempt=2 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 09:54:45 [error    ] retrying                       attempt=2
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /builds/infrastructure/obs-proxy/obs_proxy/chunked_uploads/client.py:84 in   │
│ upload_chunked                                                               │
│                                                                              │
│    81 │   │   │   for attempt in range(MAX_ATTEMPTS):                        │
│    82 │   │   │   │   try:                                                   │
│    83 │   │   │   │   │   logger.debug("patching", uri=uri, size=len(chunk), │
│ ❱  84 │   │   │   │   │   r = await client.patch(                            │
│    85 │   │   │   │   │   │   uri,                                           │
│    86 │   │   │   │   │   │   content=chunk,                                 │
│    87 │   │   │   │   │   │   headers=chunk_headers,                         │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       attempt = 2                                                        │ │
│ │         chunk = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\… │ │
│ │ chunk_headers = {                                                        │ │
│ │                 │   'Patch-Content-Range': 'bytes                        │ │
│ │                 524288-1048575/4194304',                                 │ │
│ │                 │   'Content-Length': '524288'                           │ │
│ │                 }                                                        │ │
│ │    chunk_size = 524288                                                   │ │
│ │        client = <httpx.AsyncClient object at 0x7f51badfb6d0>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f51badf8c90> wrapping <_io.BufferedReader          │ │
│ │                 name='/tmp/pytest-of-root/pytest-0/test_upload_chunked_… │ │
│ │             e = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Patch-Content-Range': 'bytes 524288-1048575/4194304',  │ │
│ │                 'Content-Length': '524288'} headers amongst:\n- Match    │ │
│ │                 any request with {'Patch-Content-Range': 'bytes          │ │
│ │                 2621440-3145727/4194304'} headers\n- Already matched any │ │
│ │                 request with {'Content-Length': '524288'} headers\n\nIf  │ │
│ │                 you wanted to reuse an already matched response instead  │ │
│ │                 of registering it again, refer to                        │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │           exc = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Patch-Content-Range': 'bytes 524288-1048575/4194304',  │ │
│ │                 'Content-Length': '524288'} headers amongst:\n- Match    │ │
│ │                 any request with {'Patch-Content-Range': 'bytes          │ │
│ │                 2621440-3145727/4194304'} headers\n- Already matched any │ │
│ │                 request with {'Content-Length': '524288'} headers\n\nIf  │ │
│ │                 you wanted to reuse an already matched response instead  │ │
│ │                 of registering it again, refer to                        │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │   file_hasher = <md5 _hashlib.HASH object @ 0x7f51bbaafd30>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1933 in patch       │
│                                                                              │
│   1930 │   │                                                                 │
│   1931 │   │   **Parameters**: See `httpx.request`.                          │
│   1932 │   │   """                                                           │
│ ❱ 1933 │   │   return await self.request(                                    │
│   1934 │   │   │   "PATCH",                                                  │
│   1935 │   │   │   url,                                                      │
│   1936 │   │   │   content=content,                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f51badfb6d0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1540 in request     │
│                                                                              │
│   1537 │   │   │   timeout=timeout,                                          │
│   1538 │   │   │   extensions=extensions,                                    │
│   1539 │   │   )                                                             │
│ ❱ 1540 │   │   return await self.send(request, auth=auth, follow_redirects=f │
│   1541 │                                                                     │
│   1542 │   @asynccontextmanager                                              │
│   1543 │   async def stream(                                                 │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           method = 'PATCH'                                               │ │
│ │           params = None                                                  │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51badfb6d0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1629 in send        │
│                                                                              │
│   1626 │   │                                                                 │
│   1627 │   │   auth = self._build_request_auth(request, auth)                │
│   1628 │   │                                                                 │
│ ❱ 1629 │   │   response = await self._send_handling_auth(                    │
│   1630 │   │   │   request,                                                  │
│   1631 │   │   │   auth=auth,                                                │
│   1632 │   │   │   follow_redirects=follow_redirects,                        │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │             auth = <httpx.Auth object at 0x7f51bae25750>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51badfb6d0>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1657 in             │
│ _send_handling_auth                                                          │
│                                                                              │
│   1654 │   │   │   request = await auth_flow.__anext__()                     │
│   1655 │   │   │                                                             │
│   1656 │   │   │   while True:                                               │
│ ❱ 1657 │   │   │   │   response = await self._send_handling_redirects(       │
│   1658 │   │   │   │   │   request,                                          │
│   1659 │   │   │   │   │   follow_redirects=follow_redirects,                │
│   1660 │   │   │   │   │   history=history,                                  │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx.Auth object at 0x7f51bae25750>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f51bba38220>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51badfb6d0>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1694 in             │
│ _send_handling_redirects                                                     │
│                                                                              │
│   1691 │   │   │   for hook in self._event_hooks["request"]:                 │
│   1692 │   │   │   │   await hook(request)                                   │
│   1693 │   │   │                                                             │
│ ❱ 1694 │   │   │   response = await self._send_single_request(request)       │
│   1695 │   │   │   try:                                                      │
│   1696 │   │   │   │   for hook in self._event_hooks["response"]:            │
│   1697 │   │   │   │   │   await hook(response)                              │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │ follow_redirects = False                                           │       │
│ │          history = []                                              │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51badfb6d0>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1730 in             │
│ _send_single_request                                                         │
│                                                                              │
│   1727 │   │   │   )                                                         │
│   1728 │   │                                                                 │
│   1729 │   │   with request_context(request=request):                        │
│ ❱ 1730 │   │   │   response = await transport.handle_async_request(request)  │
│   1731 │   │                                                                 │
│   1732 │   │   assert isinstance(response.stream, AsyncByteStream)           │
│   1733 │   │   response.request = request                                    │
│                                                                              │
│ ╭──────────────────────────── locals ─────────────────────────────╮          │
│ │   request = <Request('PATCH', 'http://example.org/upload')>     │          │
│ │      self = <httpx.AsyncClient object at 0x7f51badfb6d0>        │          │
│ │     start = 147.262615907                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51badf9d90> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/__init__.py:56 in       │
│ mocked_handle_async_request                                                  │
│                                                                              │
│   53 │   │   transport: httpx.AsyncHTTPTransport, request: httpx.Request     │
│   54 │   ) -> httpx.Response:                                                │
│   55 │   │   if options.should_mock(request):                                │
│ ❱ 56 │   │   │   return await mock._handle_async_request(transport, request) │
│   57 │   │   return await real_handle_async_request(transport, request)      │
│   58 │                                                                       │
│   59 │   monkeypatch.setattr(                                                │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │      mock = <pytest_httpx._httpx_mock.HTTPXMock object at                │ │
│ │             0x7f51badf9f90>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f51badfb510>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51badf9d90>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:183 in   │
│ _handle_async_request                                                        │
│                                                                              │
│   180 │   │   │   │   │   response = await response                          │
│   181 │   │   │   │   return _unread(response)                               │
│   182 │   │                                                                  │
│ ❱ 183 │   │   self._request_not_matched(real_transport, request)             │
│   184 │                                                                      │
│   185 │   def _request_not_matched(                                          │
│   186 │   │   self,                                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       callback = None                                                    │ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51badf9d90>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51badf9f90>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:191 in   │
│ _request_not_matched                                                         │
│                                                                              │
│   188 │   │   request: httpx.Request,                                        │
│   189 │   ) -> NoReturn:                                                     │
│   190 │   │   self._requests_not_matched.append(request)                     │
│ ❱ 191 │   │   raise httpx.TimeoutException(                                  │
│   192 │   │   │   self._explain_that_no_response_was_found(real_transport, r │
│   193 │   │   │   request=request,                                           │
│   194 │   │   )                                                              │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51badf9d90>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51badf9f90>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
TimeoutException: No response can be found for PATCH request on 
http://example.org/upload with {'Patch-Content-Range': 'bytes 
524288-1048575/4194304', 'Content-Length': '524288'} headers amongst:
- Match any request with {'Patch-Content-Range': 'bytes 
2621440-3145727/4194304'} headers
- Already matched any request with {'Content-Length': '524288'} headers

If you wanted to reuse an already matched response instead of registering it 
again, refer to 
https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-
a-response-for-more-than-one-request

2025-01-02 09:54:46 [debug    ] patching                       attempt=3 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 09:54:46 [error    ] retrying                       attempt=3
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /builds/infrastructure/obs-proxy/obs_proxy/chunked_uploads/client.py:84 in   │
│ upload_chunked                                                               │
│                                                                              │
│    81 │   │   │   for attempt in range(MAX_ATTEMPTS):                        │
│    82 │   │   │   │   try:                                                   │
│    83 │   │   │   │   │   logger.debug("patching", uri=uri, size=len(chunk), │
│ ❱  84 │   │   │   │   │   r = await client.patch(                            │
│    85 │   │   │   │   │   │   uri,                                           │
│    86 │   │   │   │   │   │   content=chunk,                                 │
│    87 │   │   │   │   │   │   headers=chunk_headers,                         │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       attempt = 3                                                        │ │
│ │         chunk = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\… │ │
│ │ chunk_headers = {                                                        │ │
│ │                 │   'Patch-Content-Range': 'bytes                        │ │
│ │                 524288-1048575/4194304',                                 │ │
│ │                 │   'Content-Length': '524288'                           │ │
│ │                 }                                                        │ │
│ │    chunk_size = 524288                                                   │ │
│ │        client = <httpx.AsyncClient object at 0x7f51badfb6d0>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f51badf8c90> wrapping <_io.BufferedReader          │ │
│ │                 name='/tmp/pytest-of-root/pytest-0/test_upload_chunked_… │ │
│ │             e = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Patch-Content-Range': 'bytes 524288-1048575/4194304',  │ │
│ │                 'Content-Length': '524288'} headers amongst:\n- Match    │ │
│ │                 any request with {'Patch-Content-Range': 'bytes          │ │
│ │                 2621440-3145727/4194304'} headers\n- Already matched any │ │
│ │                 request with {'Content-Length': '524288'} headers\n\nIf  │ │
│ │                 you wanted to reuse an already matched response instead  │ │
│ │                 of registering it again, refer to                        │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │           exc = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Patch-Content-Range': 'bytes 524288-1048575/4194304',  │ │
│ │                 'Content-Length': '524288'} headers amongst:\n- Match    │ │
│ │                 any request with {'Patch-Content-Range': 'bytes          │ │
│ │                 2621440-3145727/4194304'} headers\n- Already matched any │ │
│ │                 request with {'Content-Length': '524288'} headers\n\nIf  │ │
│ │                 you wanted to reuse an already matched response instead  │ │
│ │                 of registering it again, refer to                        │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │   file_hasher = <md5 _hashlib.HASH object @ 0x7f51bbaafd30>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1933 in patch       │
│                                                                              │
│   1930 │   │                                                                 │
│   1931 │   │   **Parameters**: See `httpx.request`.                          │
│   1932 │   │   """                                                           │
│ ❱ 1933 │   │   return await self.request(                                    │
│   1934 │   │   │   "PATCH",                                                  │
│   1935 │   │   │   url,                                                      │
│   1936 │   │   │   content=content,                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f51badfb6d0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1540 in request     │
│                                                                              │
│   1537 │   │   │   timeout=timeout,                                          │
│   1538 │   │   │   extensions=extensions,                                    │
│   1539 │   │   )                                                             │
│ ❱ 1540 │   │   return await self.send(request, auth=auth, follow_redirects=f │
│   1541 │                                                                     │
│   1542 │   @asynccontextmanager                                              │
│   1543 │   async def stream(                                                 │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           method = 'PATCH'                                               │ │
│ │           params = None                                                  │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51badfb6d0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1629 in send        │
│                                                                              │
│   1626 │   │                                                                 │
│   1627 │   │   auth = self._build_request_auth(request, auth)                │
│   1628 │   │                                                                 │
│ ❱ 1629 │   │   response = await self._send_handling_auth(                    │
│   1630 │   │   │   request,                                                  │
│   1631 │   │   │   auth=auth,                                                │
│   1632 │   │   │   follow_redirects=follow_redirects,                        │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │             auth = <httpx.Auth object at 0x7f51bbacac10>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51badfb6d0>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1657 in             │
│ _send_handling_auth                                                          │
│                                                                              │
│   1654 │   │   │   request = await auth_flow.__anext__()                     │
│   1655 │   │   │                                                             │
│   1656 │   │   │   while True:                                               │
│ ❱ 1657 │   │   │   │   response = await self._send_handling_redirects(       │
│   1658 │   │   │   │   │   request,                                          │
│   1659 │   │   │   │   │   follow_redirects=follow_redirects,                │
│   1660 │   │   │   │   │   history=history,                                  │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx.Auth object at 0x7f51bbacac10>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f51bc2f6d40>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51badfb6d0>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1694 in             │
│ _send_handling_redirects                                                     │
│                                                                              │
│   1691 │   │   │   for hook in self._event_hooks["request"]:                 │
│   1692 │   │   │   │   await hook(request)                                   │
│   1693 │   │   │                                                             │
│ ❱ 1694 │   │   │   response = await self._send_single_request(request)       │
│   1695 │   │   │   try:                                                      │
│   1696 │   │   │   │   for hook in self._event_hooks["response"]:            │
│   1697 │   │   │   │   │   await hook(response)                              │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │ follow_redirects = False                                           │       │
│ │          history = []                                              │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51badfb6d0>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1730 in             │
│ _send_single_request                                                         │
│                                                                              │
│   1727 │   │   │   )                                                         │
│   1728 │   │                                                                 │
│   1729 │   │   with request_context(request=request):                        │
│ ❱ 1730 │   │   │   response = await transport.handle_async_request(request)  │
│   1731 │   │                                                                 │
│   1732 │   │   assert isinstance(response.stream, AsyncByteStream)           │
│   1733 │   │   response.request = request                                    │
│                                                                              │
│ ╭──────────────────────────── locals ─────────────────────────────╮          │
│ │   request = <Request('PATCH', 'http://example.org/upload')>     │          │
│ │      self = <httpx.AsyncClient object at 0x7f51badfb6d0>        │          │
│ │     start = 148.349859744                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51badf9d90> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/__init__.py:56 in       │
│ mocked_handle_async_request                                                  │
│                                                                              │
│   53 │   │   transport: httpx.AsyncHTTPTransport, request: httpx.Request     │
│   54 │   ) -> httpx.Response:                                                │
│   55 │   │   if options.should_mock(request):                                │
│ ❱ 56 │   │   │   return await mock._handle_async_request(transport, request) │
│   57 │   │   return await real_handle_async_request(transport, request)      │
│   58 │                                                                       │
│   59 │   monkeypatch.setattr(                                                │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │      mock = <pytest_httpx._httpx_mock.HTTPXMock object at                │ │
│ │             0x7f51badf9f90>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f51badfb510>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51badf9d90>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:183 in   │
│ _handle_async_request                                                        │
│                                                                              │
│   180 │   │   │   │   │   response = await response                          │
│   181 │   │   │   │   return _unread(response)                               │
│   182 │   │                                                                  │
│ ❱ 183 │   │   self._request_not_matched(real_transport, request)             │
│   184 │                                                                      │
│   185 │   def _request_not_matched(                                          │
│   186 │   │   self,                                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       callback = None                                                    │ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51badf9d90>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51badf9f90>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:191 in   │
│ _request_not_matched                                                         │
│                                                                              │
│   188 │   │   request: httpx.Request,                                        │
│   189 │   ) -> NoReturn:                                                     │
│   190 │   │   self._requests_not_matched.append(request)                     │
│ ❱ 191 │   │   raise httpx.TimeoutException(                                  │
│   192 │   │   │   self._explain_that_no_response_was_found(real_transport, r │
│   193 │   │   │   request=request,                                           │
│   194 │   │   )                                                              │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51badf9d90>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51badf9f90>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
TimeoutException: No response can be found for PATCH request on 
http://example.org/upload with {'Patch-Content-Range': 'bytes 
524288-1048575/4194304', 'Content-Length': '524288'} headers amongst:
- Match any request with {'Patch-Content-Range': 'bytes 
2621440-3145727/4194304'} headers
- Already matched any request with {'Content-Length': '524288'} headers

If you wanted to reuse an already matched response instead of registering it 
again, refer to 
https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-
a-response-for-more-than-one-request

2025-01-02 09:54:47 [debug    ] patching                       attempt=4 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 09:54:47 [error    ] retrying                       attempt=4
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /builds/infrastructure/obs-proxy/obs_proxy/chunked_uploads/client.py:84 in   │
│ upload_chunked                                                               │
│                                                                              │
│    81 │   │   │   for attempt in range(MAX_ATTEMPTS):                        │
│    82 │   │   │   │   try:                                                   │
│    83 │   │   │   │   │   logger.debug("patching", uri=uri, size=len(chunk), │
│ ❱  84 │   │   │   │   │   r = await client.patch(                            │
│    85 │   │   │   │   │   │   uri,                                           │
│    86 │   │   │   │   │   │   content=chunk,                                 │
│    87 │   │   │   │   │   │   headers=chunk_headers,                         │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       attempt = 4                                                        │ │
│ │         chunk = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\… │ │
│ │ chunk_headers = {                                                        │ │
│ │                 │   'Patch-Content-Range': 'bytes                        │ │
│ │                 524288-1048575/4194304',                                 │ │
│ │                 │   'Content-Length': '524288'                           │ │
│ │                 }                                                        │ │
│ │    chunk_size = 524288                                                   │ │
│ │        client = <httpx.AsyncClient object at 0x7f51badfb6d0>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f51badf8c90> wrapping <_io.BufferedReader          │ │
│ │                 name='/tmp/pytest-of-root/pytest-0/test_upload_chunked_… │ │
│ │             e = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Patch-Content-Range': 'bytes 524288-1048575/4194304',  │ │
│ │                 'Content-Length': '524288'} headers amongst:\n- Match    │ │
│ │                 any request with {'Patch-Content-Range': 'bytes          │ │
│ │                 2621440-3145727/4194304'} headers\n- Already matched any │ │
│ │                 request with {'Content-Length': '524288'} headers\n\nIf  │ │
│ │                 you wanted to reuse an already matched response instead  │ │
│ │                 of registering it again, refer to                        │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │           exc = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Patch-Content-Range': 'bytes 524288-1048575/4194304',  │ │
│ │                 'Content-Length': '524288'} headers amongst:\n- Match    │ │
│ │                 any request with {'Patch-Content-Range': 'bytes          │ │
│ │                 2621440-3145727/4194304'} headers\n- Already matched any │ │
│ │                 request with {'Content-Length': '524288'} headers\n\nIf  │ │
│ │                 you wanted to reuse an already matched response instead  │ │
│ │                 of registering it again, refer to                        │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │   file_hasher = <md5 _hashlib.HASH object @ 0x7f51bbaafd30>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1933 in patch       │
│                                                                              │
│   1930 │   │                                                                 │
│   1931 │   │   **Parameters**: See `httpx.request`.                          │
│   1932 │   │   """                                                           │
│ ❱ 1933 │   │   return await self.request(                                    │
│   1934 │   │   │   "PATCH",                                                  │
│   1935 │   │   │   url,                                                      │
│   1936 │   │   │   content=content,                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f51badfb6d0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1540 in request     │
│                                                                              │
│   1537 │   │   │   timeout=timeout,                                          │
│   1538 │   │   │   extensions=extensions,                                    │
│   1539 │   │   )                                                             │
│ ❱ 1540 │   │   return await self.send(request, auth=auth, follow_redirects=f │
│   1541 │                                                                     │
│   1542 │   @asynccontextmanager                                              │
│   1543 │   async def stream(                                                 │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           method = 'PATCH'                                               │ │
│ │           params = None                                                  │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51badfb6d0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1629 in send        │
│                                                                              │
│   1626 │   │                                                                 │
│   1627 │   │   auth = self._build_request_auth(request, auth)                │
│   1628 │   │                                                                 │
│ ❱ 1629 │   │   response = await self._send_handling_auth(                    │
│   1630 │   │   │   request,                                                  │
│   1631 │   │   │   auth=auth,                                                │
│   1632 │   │   │   follow_redirects=follow_redirects,                        │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │             auth = <httpx.Auth object at 0x7f51bbdd33d0>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51badfb6d0>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1657 in             │
│ _send_handling_auth                                                          │
│                                                                              │
│   1654 │   │   │   request = await auth_flow.__anext__()                     │
│   1655 │   │   │                                                             │
│   1656 │   │   │   while True:                                               │
│ ❱ 1657 │   │   │   │   response = await self._send_handling_redirects(       │
│   1658 │   │   │   │   │   request,                                          │
│   1659 │   │   │   │   │   follow_redirects=follow_redirects,                │
│   1660 │   │   │   │   │   history=history,                                  │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx.Auth object at 0x7f51bbdd33d0>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f51bba38c70>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51badfb6d0>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1694 in             │
│ _send_handling_redirects                                                     │
│                                                                              │
│   1691 │   │   │   for hook in self._event_hooks["request"]:                 │
│   1692 │   │   │   │   await hook(request)                                   │
│   1693 │   │   │                                                             │
│ ❱ 1694 │   │   │   response = await self._send_single_request(request)       │
│   1695 │   │   │   try:                                                      │
│   1696 │   │   │   │   for hook in self._event_hooks["response"]:            │
│   1697 │   │   │   │   │   await hook(response)                              │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │ follow_redirects = False                                           │       │
│ │          history = []                                              │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51badfb6d0>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1730 in             │
│ _send_single_request                                                         │
│                                                                              │
│   1727 │   │   │   )                                                         │
│   1728 │   │                                                                 │
│   1729 │   │   with request_context(request=request):                        │
│ ❱ 1730 │   │   │   response = await transport.handle_async_request(request)  │
│   1731 │   │                                                                 │
│   1732 │   │   assert isinstance(response.stream, AsyncByteStream)           │
│   1733 │   │   response.request = request                                    │
│                                                                              │
│ ╭──────────────────────────── locals ─────────────────────────────╮          │
│ │   request = <Request('PATCH', 'http://example.org/upload')>     │          │
│ │      self = <httpx.AsyncClient object at 0x7f51badfb6d0>        │          │
│ │     start = 149.368643594                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51badf9d90> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/__init__.py:56 in       │
│ mocked_handle_async_request                                                  │
│                                                                              │
│   53 │   │   transport: httpx.AsyncHTTPTransport, request: httpx.Request     │
│   54 │   ) -> httpx.Response:                                                │
│   55 │   │   if options.should_mock(request):                                │
│ ❱ 56 │   │   │   return await mock._handle_async_request(transport, request) │
│   57 │   │   return await real_handle_async_request(transport, request)      │
│   58 │                                                                       │
│   59 │   monkeypatch.setattr(                                                │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │      mock = <pytest_httpx._httpx_mock.HTTPXMock object at                │ │
│ │             0x7f51badf9f90>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f51badfb510>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51badf9d90>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:183 in   │
│ _handle_async_request                                                        │
│                                                                              │
│   180 │   │   │   │   │   response = await response                          │
│   181 │   │   │   │   return _unread(response)                               │
│   182 │   │                                                                  │
│ ❱ 183 │   │   self._request_not_matched(real_transport, request)             │
│   184 │                                                                      │
│   185 │   def _request_not_matched(                                          │
│   186 │   │   self,                                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       callback = None                                                    │ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51badf9d90>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51badf9f90>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:191 in   │
│ _request_not_matched                                                         │
│                                                                              │
│   188 │   │   request: httpx.Request,                                        │
│   189 │   ) -> NoReturn:                                                     │
│   190 │   │   self._requests_not_matched.append(request)                     │
│ ❱ 191 │   │   raise httpx.TimeoutException(                                  │
│   192 │   │   │   self._explain_that_no_response_was_found(real_transport, r │
│   193 │   │   │   request=request,                                           │
│   194 │   │   )                                                              │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51badf9d90>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51badf9f90>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
TimeoutException: No response can be found for PATCH request on 
http://example.org/upload with {'Patch-Content-Range': 'bytes 
524288-1048575/4194304', 'Content-Length': '524288'} headers amongst:
- Match any request with {'Patch-Content-Range': 'bytes 
2621440-3145727/4194304'} headers
- Already matched any request with {'Content-Length': '524288'} headers

If you wanted to reuse an already matched response instead of registering it 
again, refer to 
https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-
a-response-for-more-than-one-request

__________________ test_upload_chunked_transient_server_error __________________

client = <httpx.AsyncClient object at 0x7f51bba09cd0>
uri = 'http://example.org/upload'
data = <aiofiles.threadpool.binary.AsyncBufferedReader object at 0x7f51bba61e10> wrapping <_io.BufferedReader name='/tmp/pytest-of-root/pytest-0/test_upload_chunked_transient_0/tempfile'>
size = 4194304, chunk_size = 524288, headers = {}, kv = {}
content_range = <ContentRange 'bytes 524288-1048575/4194304'>, attempt = 4
file_hasher = <md5 _hashlib.HASH object @ 0x7f51bb902810>
chunk_headers = {'Content-Length': '524288', 'Patch-Content-Range': 'bytes 524288-1048575/4194304'}
offset = 524288
chunk = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00...00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
pos = 1048576

    async def upload_chunked(
            client: httpx.AsyncClient,
            uri: str,
            data: AsyncFileIO,
            size: int,
            chunk_size: int = UPLOAD_CHUNK_SIZE,
            headers=None,
            **kv,
    ):
        if not headers:
            headers = {}
    
        content_range = None
        attempt = 0
        file_hasher = hashlib.md5()
        try:
            chunk_headers = headers.copy()
            await data.seek(0)
            while True:
                offset = await data.tell()
                chunk = await data.read(chunk_size)
                if not chunk:
                    break
                pos = await data.tell()
    
                file_hasher.update(chunk)
    
                content_range = ContentRange(
                    start=offset,
                    stop=pos,
                    length=size,
                    units="bytes",
                )
                chunk_headers["Patch-Content-Range"] = content_range.to_header()
                chunk_headers["Content-Length"] = str(len(chunk))
                exc = None
                for attempt in range(MAX_ATTEMPTS):
                    try:
                        logger.debug("patching", uri=uri, size=len(chunk), content_range=content_range, attempt=attempt)
                        r = await client.patch(
                            uri,
                            content=chunk,
                            headers=chunk_headers,
                            **kv,
                        )
                        logger.debug("patch result", result=r)
                        if r.is_success:
                            break
                        else:
                            r.raise_for_status()
                    except httpx.HTTPStatusError as e:
                        if not e.response.is_server_error:
                            logger.debug("not server error, not retrying", resp=e.response)
                            raise
                        logger.exception("retrying", attempt=attempt)
                        exc = e
                    except httpx.HTTPError as e:
                        logger.exception("retrying", attempt=attempt)
                        exc = e
                else:
>                   raise exc

obs_proxy/chunked_uploads/client.py:105: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
obs_proxy/chunked_uploads/client.py:84: in upload_chunked
    r = await client.patch(
/usr/local/lib/python3.11/site-packages/httpx/_client.py:1933: in patch
    return await self.request(
/usr/local/lib/python3.11/site-packages/httpx/_client.py:1540: in request
    return await self.send(request, auth=auth, follow_redirects=follow_redirects)
/usr/local/lib/python3.11/site-packages/httpx/_client.py:1629: in send
    response = await self._send_handling_auth(
/usr/local/lib/python3.11/site-packages/httpx/_client.py:1657: in _send_handling_auth
    response = await self._send_handling_redirects(
/usr/local/lib/python3.11/site-packages/httpx/_client.py:1694: in _send_handling_redirects
    response = await self._send_single_request(request)
/usr/local/lib/python3.11/site-packages/httpx/_client.py:1730: in _send_single_request
    response = await transport.handle_async_request(request)
/usr/local/lib/python3.11/site-packages/pytest_httpx/__init__.py:56: in mocked_handle_async_request
    return await mock._handle_async_request(transport, request)
/usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:183: in _handle_async_request
    self._request_not_matched(real_transport, request)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <pytest_httpx._httpx_mock.HTTPXMock object at 0x7f51bba09fd0>
real_transport = <httpx.AsyncHTTPTransport object at 0x7f51bba63a90>
request = <Request('PATCH', 'http://example.org/upload')>

    def _request_not_matched(
        self,
        real_transport: Union[httpx.AsyncHTTPTransport, httpx.HTTPTransport],
        request: httpx.Request,
    ) -> NoReturn:
        self._requests_not_matched.append(request)
>       raise httpx.TimeoutException(
            self._explain_that_no_response_was_found(real_transport, request),
            request=request,
        )
E       httpx.TimeoutException: No response can be found for PATCH request on http://example.org/upload with {'Patch-Content-Range': 'bytes 524288-1048575/4194304', 'Content-Length': '524288'} headers amongst:
E       - Match any request with {'Patch-Content-Range': 'bytes 2621440-3145727/4194304'} headers
E       - Already matched any request with {'Content-Length': '524288'} headers
E       
E       If you wanted to reuse an already matched response instead of registering it again, refer to https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-a-response-for-more-than-one-request

/usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:191: TimeoutException

The above exception was the direct cause of the following exception:

tmp_path = PosixPath('/tmp/pytest-of-root/pytest-0/test_upload_chunked_transient_0')
httpx_mock = <pytest_httpx._httpx_mock.HTTPXMock object at 0x7f51bba09fd0>

    @pytest.mark.asyncio
    async def test_upload_chunked_transient_server_error(
            tmp_path: Path,
            httpx_mock: HTTPXMock,
    ):
        """Verify that unexpected HTTP responses in 5xx range cause a retry and raise an exception if persist"""
        httpx_mock.add_response(
            match_headers={
                "Content-Length": str(CHUNK_SIZE),
            },
        )
    
        break_at_chunk = 5
        break_at = "bytes %d-%d/%d" % (
            break_at_chunk * CHUNK_SIZE,
            (break_at_chunk + 1) * CHUNK_SIZE - 1,
            SIZE,
        )
    
        failed_once = False
    
        def fail_once(request: httpx.Request):
            if not failed_once:
                return httpx.Response(
                    status_code=500,
                )
            else:
                return httpx.Response(
                    status_code=200,
                )
    
        httpx_mock.add_callback(
            fail_once,
            match_headers={
                "Patch-Content-Range": break_at,
            },
        )
    
        tmp_file = tmp_path / "tempfile"
        with tmp_file.open("wb") as f:
            f.truncate(SIZE)
    
        async with httpx.AsyncClient() as client:
            file = await aiofiles.open(tmp_file, 'rb')
            with pytest.raises(
                    ChunkedUploadError,
                    match=f"Upload error at range {break_at} .attempt 4.: .*500 Internal Server Error.*",
            ) as excinfo:
>               await upload_chunked(
                    client,
                    "http://example.org/upload",
                    data=file,
                    size=SIZE,
                    chunk_size=CHUNK_SIZE,
                )

tests/chunked_uploads/test_upload_chunked.py:165: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

client = <httpx.AsyncClient object at 0x7f51bba09cd0>
uri = 'http://example.org/upload'
data = <aiofiles.threadpool.binary.AsyncBufferedReader object at 0x7f51bba61e10> wrapping <_io.BufferedReader name='/tmp/pytest-of-root/pytest-0/test_upload_chunked_transient_0/tempfile'>
size = 4194304, chunk_size = 524288, headers = {}, kv = {}
content_range = <ContentRange 'bytes 524288-1048575/4194304'>, attempt = 4
file_hasher = <md5 _hashlib.HASH object @ 0x7f51bb902810>
chunk_headers = {'Content-Length': '524288', 'Patch-Content-Range': 'bytes 524288-1048575/4194304'}
offset = 524288
chunk = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00...00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
pos = 1048576

    async def upload_chunked(
            client: httpx.AsyncClient,
            uri: str,
            data: AsyncFileIO,
            size: int,
            chunk_size: int = UPLOAD_CHUNK_SIZE,
            headers=None,
            **kv,
    ):
        if not headers:
            headers = {}
    
        content_range = None
        attempt = 0
        file_hasher = hashlib.md5()
        try:
            chunk_headers = headers.copy()
            await data.seek(0)
            while True:
                offset = await data.tell()
                chunk = await data.read(chunk_size)
                if not chunk:
                    break
                pos = await data.tell()
    
                file_hasher.update(chunk)
    
                content_range = ContentRange(
                    start=offset,
                    stop=pos,
                    length=size,
                    units="bytes",
                )
                chunk_headers["Patch-Content-Range"] = content_range.to_header()
                chunk_headers["Content-Length"] = str(len(chunk))
                exc = None
                for attempt in range(MAX_ATTEMPTS):
                    try:
                        logger.debug("patching", uri=uri, size=len(chunk), content_range=content_range, attempt=attempt)
                        r = await client.patch(
                            uri,
                            content=chunk,
                            headers=chunk_headers,
                            **kv,
                        )
                        logger.debug("patch result", result=r)
                        if r.is_success:
                            break
                        else:
                            r.raise_for_status()
                    except httpx.HTTPStatusError as e:
                        if not e.response.is_server_error:
                            logger.debug("not server error, not retrying", resp=e.response)
                            raise
                        logger.exception("retrying", attempt=attempt)
                        exc = e
                    except httpx.HTTPError as e:
                        logger.exception("retrying", attempt=attempt)
                        exc = e
                else:
                    raise exc
    
            logger.debug("get etag", uri=uri)
            # now verify the hash
            r = await client.head(
                uri,
                headers=headers,
            )
            calculated_hash = file_hasher.hexdigest()
            etag, _ = unquote_etag(r.headers.get("etag"))
    
            logger.debug("check upload", etag=etag, calculated_hash=calculated_hash)
    
            if etag != calculated_hash:
                raise ChunkedUploadVerificationError(
                    expected=calculated_hash,
                    actual=etag,
                )
    
        except httpx.HTTPError as e:
>           raise ChunkedUploadError(
                content_range=content_range,
                attempt=attempt,
            ) from e
E           obs_proxy.chunked_uploads.client.ChunkedUploadError: Upload error at range bytes 524288-1048575/4194304 (attempt 4): No response can be found for PATCH request on http://example.org/upload with {'Patch-Content-Range': 'bytes 524288-1048575/4194304', 'Content-Length': '524288'} headers amongst:
E           - Match any request with {'Patch-Content-Range': 'bytes 2621440-3145727/4194304'} headers
E           - Already matched any request with {'Content-Length': '524288'} headers
E           
E           If you wanted to reuse an already matched response instead of registering it again, refer to https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-a-response-for-more-than-one-request

obs_proxy/chunked_uploads/client.py:125: ChunkedUploadError

During handling of the above exception, another exception occurred:

tmp_path = PosixPath('/tmp/pytest-of-root/pytest-0/test_upload_chunked_transient_0')
httpx_mock = <pytest_httpx._httpx_mock.HTTPXMock object at 0x7f51bba09fd0>

    @pytest.mark.asyncio
    async def test_upload_chunked_transient_server_error(
            tmp_path: Path,
            httpx_mock: HTTPXMock,
    ):
        """Verify that unexpected HTTP responses in 5xx range cause a retry and raise an exception if persist"""
        httpx_mock.add_response(
            match_headers={
                "Content-Length": str(CHUNK_SIZE),
            },
        )
    
        break_at_chunk = 5
        break_at = "bytes %d-%d/%d" % (
            break_at_chunk * CHUNK_SIZE,
            (break_at_chunk + 1) * CHUNK_SIZE - 1,
            SIZE,
        )
    
        failed_once = False
    
        def fail_once(request: httpx.Request):
            if not failed_once:
                return httpx.Response(
                    status_code=500,
                )
            else:
                return httpx.Response(
                    status_code=200,
                )
    
        httpx_mock.add_callback(
            fail_once,
            match_headers={
                "Patch-Content-Range": break_at,
            },
        )
    
        tmp_file = tmp_path / "tempfile"
        with tmp_file.open("wb") as f:
            f.truncate(SIZE)
    
        async with httpx.AsyncClient() as client:
            file = await aiofiles.open(tmp_file, 'rb')
>           with pytest.raises(
                    ChunkedUploadError,
                    match=f"Upload error at range {break_at} .attempt 4.: .*500 Internal Server Error.*",
            ) as excinfo:
E           AssertionError: Regex pattern did not match.
E            Regex: 'Upload error at range bytes 2621440-3145727/4194304 .attempt 4.: .*500 Internal Server Error.*'
E            Input: "Upload error at range bytes 524288-1048575/4194304 (attempt 4): No response can be found for PATCH request on http://example.org/upload with {'Patch-Content-Range': 'bytes 524288-1048575/4194304', 'Content-Length': '524288'} headers amongst:\n- Match any request with {'Patch-Content-Range': 'bytes 2621440-3145727/4194304'} headers\n- Already matched any request with {'Content-Length': '524288'} headers\n\nIf you wanted to reuse an already matched response instead of registering it again, refer to https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-a-response-for-more-than-one-request"

tests/chunked_uploads/test_upload_chunked.py:161: AssertionError
----------------------------- Captured stdout call -----------------------------
2025-01-02 09:54:49 [debug    ] patching                       attempt=0 content_range=<ContentRange 'bytes 0-524287/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 09:54:49 [debug    ] patch result                   result=<Response [200 OK]>
2025-01-02 09:54:49 [debug    ] patching                       attempt=0 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 09:54:49 [error    ] retrying                       attempt=0
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /builds/infrastructure/obs-proxy/obs_proxy/chunked_uploads/client.py:84 in   │
│ upload_chunked                                                               │
│                                                                              │
│    81 │   │   │   for attempt in range(MAX_ATTEMPTS):                        │
│    82 │   │   │   │   try:                                                   │
│    83 │   │   │   │   │   logger.debug("patching", uri=uri, size=len(chunk), │
│ ❱  84 │   │   │   │   │   r = await client.patch(                            │
│    85 │   │   │   │   │   │   uri,                                           │
│    86 │   │   │   │   │   │   content=chunk,                                 │
│    87 │   │   │   │   │   │   headers=chunk_headers,                         │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       attempt = 0                                                        │ │
│ │         chunk = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\… │ │
│ │ chunk_headers = {                                                        │ │
│ │                 │   'Patch-Content-Range': 'bytes                        │ │
│ │                 524288-1048575/4194304',                                 │ │
│ │                 │   'Content-Length': '524288'                           │ │
│ │                 }                                                        │ │
│ │    chunk_size = 524288                                                   │ │
│ │        client = <httpx.AsyncClient object at 0x7f51bba09cd0>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f51bba61e10> wrapping <_io.BufferedReader          │ │
│ │                 name='/tmp/pytest-of-root/pytest-0/test_upload_chunked_… │ │
│ │             e = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Patch-Content-Range': 'bytes 524288-1048575/4194304',  │ │
│ │                 'Content-Length': '524288'} headers amongst:\n- Match    │ │
│ │                 any request with {'Patch-Content-Range': 'bytes          │ │
│ │                 2621440-3145727/4194304'} headers\n- Already matched any │ │
│ │                 request with {'Content-Length': '524288'} headers\n\nIf  │ │
│ │                 you wanted to reuse an already matched response instead  │ │
│ │                 of registering it again, refer to                        │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │           exc = None                                                     │ │
│ │   file_hasher = <md5 _hashlib.HASH object @ 0x7f51bb902810>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1933 in patch       │
│                                                                              │
│   1930 │   │                                                                 │
│   1931 │   │   **Parameters**: See `httpx.request`.                          │
│   1932 │   │   """                                                           │
│ ❱ 1933 │   │   return await self.request(                                    │
│   1934 │   │   │   "PATCH",                                                  │
│   1935 │   │   │   url,                                                      │
│   1936 │   │   │   content=content,                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bba09cd0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1540 in request     │
│                                                                              │
│   1537 │   │   │   timeout=timeout,                                          │
│   1538 │   │   │   extensions=extensions,                                    │
│   1539 │   │   )                                                             │
│ ❱ 1540 │   │   return await self.send(request, auth=auth, follow_redirects=f │
│   1541 │                                                                     │
│   1542 │   @asynccontextmanager                                              │
│   1543 │   async def stream(                                                 │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           method = 'PATCH'                                               │ │
│ │           params = None                                                  │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bba09cd0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1629 in send        │
│                                                                              │
│   1626 │   │                                                                 │
│   1627 │   │   auth = self._build_request_auth(request, auth)                │
│   1628 │   │                                                                 │
│ ❱ 1629 │   │   response = await self._send_handling_auth(                    │
│   1630 │   │   │   request,                                                  │
│   1631 │   │   │   auth=auth,                                                │
│   1632 │   │   │   follow_redirects=follow_redirects,                        │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │             auth = <httpx.Auth object at 0x7f51bba621d0>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51bba09cd0>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1657 in             │
│ _send_handling_auth                                                          │
│                                                                              │
│   1654 │   │   │   request = await auth_flow.__anext__()                     │
│   1655 │   │   │                                                             │
│   1656 │   │   │   while True:                                               │
│ ❱ 1657 │   │   │   │   response = await self._send_handling_redirects(       │
│   1658 │   │   │   │   │   request,                                          │
│   1659 │   │   │   │   │   follow_redirects=follow_redirects,                │
│   1660 │   │   │   │   │   history=history,                                  │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx.Auth object at 0x7f51bba621d0>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f51bbb7fb50>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bba09cd0>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1694 in             │
│ _send_handling_redirects                                                     │
│                                                                              │
│   1691 │   │   │   for hook in self._event_hooks["request"]:                 │
│   1692 │   │   │   │   await hook(request)                                   │
│   1693 │   │   │                                                             │
│ ❱ 1694 │   │   │   response = await self._send_single_request(request)       │
│   1695 │   │   │   try:                                                      │
│   1696 │   │   │   │   for hook in self._event_hooks["response"]:            │
│   1697 │   │   │   │   │   await hook(response)                              │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │ follow_redirects = False                                           │       │
│ │          history = []                                              │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51bba09cd0>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1730 in             │
│ _send_single_request                                                         │
│                                                                              │
│   1727 │   │   │   )                                                         │
│   1728 │   │                                                                 │
│   1729 │   │   with request_context(request=request):                        │
│ ❱ 1730 │   │   │   response = await transport.handle_async_request(request)  │
│   1731 │   │                                                                 │
│   1732 │   │   assert isinstance(response.stream, AsyncByteStream)           │
│   1733 │   │   response.request = request                                    │
│                                                                              │
│ ╭──────────────────────────── locals ─────────────────────────────╮          │
│ │   request = <Request('PATCH', 'http://example.org/upload')>     │          │
│ │      self = <httpx.AsyncClient object at 0x7f51bba09cd0>        │          │
│ │     start = 150.656830374                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51bba63a90> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/__init__.py:56 in       │
│ mocked_handle_async_request                                                  │
│                                                                              │
│   53 │   │   transport: httpx.AsyncHTTPTransport, request: httpx.Request     │
│   54 │   ) -> httpx.Response:                                                │
│   55 │   │   if options.should_mock(request):                                │
│ ❱ 56 │   │   │   return await mock._handle_async_request(transport, request) │
│   57 │   │   return await real_handle_async_request(transport, request)      │
│   58 │                                                                       │
│   59 │   monkeypatch.setattr(                                                │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │      mock = <pytest_httpx._httpx_mock.HTTPXMock object at                │ │
│ │             0x7f51bba09fd0>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f51bba09090>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51bba63a90>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:183 in   │
│ _handle_async_request                                                        │
│                                                                              │
│   180 │   │   │   │   │   response = await response                          │
│   181 │   │   │   │   return _unread(response)                               │
│   182 │   │                                                                  │
│ ❱ 183 │   │   self._request_not_matched(real_transport, request)             │
│   184 │                                                                      │
│   185 │   def _request_not_matched(                                          │
│   186 │   │   self,                                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       callback = None                                                    │ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51bba63a90>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51bba09fd0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:191 in   │
│ _request_not_matched                                                         │
│                                                                              │
│   188 │   │   request: httpx.Request,                                        │
│   189 │   ) -> NoReturn:                                                     │
│   190 │   │   self._requests_not_matched.append(request)                     │
│ ❱ 191 │   │   raise httpx.TimeoutException(                                  │
│   192 │   │   │   self._explain_that_no_response_was_found(real_transport, r │
│   193 │   │   │   request=request,                                           │
│   194 │   │   )                                                              │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51bba63a90>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51bba09fd0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
TimeoutException: No response can be found for PATCH request on 
http://example.org/upload with {'Patch-Content-Range': 'bytes 
524288-1048575/4194304', 'Content-Length': '524288'} headers amongst:
- Match any request with {'Patch-Content-Range': 'bytes 
2621440-3145727/4194304'} headers
- Already matched any request with {'Content-Length': '524288'} headers

If you wanted to reuse an already matched response instead of registering it 
again, refer to 
https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-
a-response-for-more-than-one-request

2025-01-02 09:54:50 [debug    ] patching                       attempt=1 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 09:54:50 [error    ] retrying                       attempt=1
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /builds/infrastructure/obs-proxy/obs_proxy/chunked_uploads/client.py:84 in   │
│ upload_chunked                                                               │
│                                                                              │
│    81 │   │   │   for attempt in range(MAX_ATTEMPTS):                        │
│    82 │   │   │   │   try:                                                   │
│    83 │   │   │   │   │   logger.debug("patching", uri=uri, size=len(chunk), │
│ ❱  84 │   │   │   │   │   r = await client.patch(                            │
│    85 │   │   │   │   │   │   uri,                                           │
│    86 │   │   │   │   │   │   content=chunk,                                 │
│    87 │   │   │   │   │   │   headers=chunk_headers,                         │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       attempt = 1                                                        │ │
│ │         chunk = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\… │ │
│ │ chunk_headers = {                                                        │ │
│ │                 │   'Patch-Content-Range': 'bytes                        │ │
│ │                 524288-1048575/4194304',                                 │ │
│ │                 │   'Content-Length': '524288'                           │ │
│ │                 }                                                        │ │
│ │    chunk_size = 524288                                                   │ │
│ │        client = <httpx.AsyncClient object at 0x7f51bba09cd0>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f51bba61e10> wrapping <_io.BufferedReader          │ │
│ │                 name='/tmp/pytest-of-root/pytest-0/test_upload_chunked_… │ │
│ │             e = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Patch-Content-Range': 'bytes 524288-1048575/4194304',  │ │
│ │                 'Content-Length': '524288'} headers amongst:\n- Match    │ │
│ │                 any request with {'Patch-Content-Range': 'bytes          │ │
│ │                 2621440-3145727/4194304'} headers\n- Already matched any │ │
│ │                 request with {'Content-Length': '524288'} headers\n\nIf  │ │
│ │                 you wanted to reuse an already matched response instead  │ │
│ │                 of registering it again, refer to                        │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │           exc = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Patch-Content-Range': 'bytes 524288-1048575/4194304',  │ │
│ │                 'Content-Length': '524288'} headers amongst:\n- Match    │ │
│ │                 any request with {'Patch-Content-Range': 'bytes          │ │
│ │                 2621440-3145727/4194304'} headers\n- Already matched any │ │
│ │                 request with {'Content-Length': '524288'} headers\n\nIf  │ │
│ │                 you wanted to reuse an already matched response instead  │ │
│ │                 of registering it again, refer to                        │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │   file_hasher = <md5 _hashlib.HASH object @ 0x7f51bb902810>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1933 in patch       │
│                                                                              │
│   1930 │   │                                                                 │
│   1931 │   │   **Parameters**: See `httpx.request`.                          │
│   1932 │   │   """                                                           │
│ ❱ 1933 │   │   return await self.request(                                    │
│   1934 │   │   │   "PATCH",                                                  │
│   1935 │   │   │   url,                                                      │
│   1936 │   │   │   content=content,                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bba09cd0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1540 in request     │
│                                                                              │
│   1537 │   │   │   timeout=timeout,                                          │
│   1538 │   │   │   extensions=extensions,                                    │
│   1539 │   │   )                                                             │
│ ❱ 1540 │   │   return await self.send(request, auth=auth, follow_redirects=f │
│   1541 │                                                                     │
│   1542 │   @asynccontextmanager                                              │
│   1543 │   async def stream(                                                 │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           method = 'PATCH'                                               │ │
│ │           params = None                                                  │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bba09cd0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1629 in send        │
│                                                                              │
│   1626 │   │                                                                 │
│   1627 │   │   auth = self._build_request_auth(request, auth)                │
│   1628 │   │                                                                 │
│ ❱ 1629 │   │   response = await self._send_handling_auth(                    │
│   1630 │   │   │   request,                                                  │
│   1631 │   │   │   auth=auth,                                                │
│   1632 │   │   │   follow_redirects=follow_redirects,                        │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │             auth = <httpx.Auth object at 0x7f51bbc36ad0>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51bba09cd0>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1657 in             │
│ _send_handling_auth                                                          │
│                                                                              │
│   1654 │   │   │   request = await auth_flow.__anext__()                     │
│   1655 │   │   │                                                             │
│   1656 │   │   │   while True:                                               │
│ ❱ 1657 │   │   │   │   response = await self._send_handling_redirects(       │
│   1658 │   │   │   │   │   request,                                          │
│   1659 │   │   │   │   │   follow_redirects=follow_redirects,                │
│   1660 │   │   │   │   │   history=history,                                  │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx.Auth object at 0x7f51bbc36ad0>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f51bc2f73d0>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bba09cd0>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1694 in             │
│ _send_handling_redirects                                                     │
│                                                                              │
│   1691 │   │   │   for hook in self._event_hooks["request"]:                 │
│   1692 │   │   │   │   await hook(request)                                   │
│   1693 │   │   │                                                             │
│ ❱ 1694 │   │   │   response = await self._send_single_request(request)       │
│   1695 │   │   │   try:                                                      │
│   1696 │   │   │   │   for hook in self._event_hooks["response"]:            │
│   1697 │   │   │   │   │   await hook(response)                              │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │ follow_redirects = False                                           │       │
│ │          history = []                                              │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51bba09cd0>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1730 in             │
│ _send_single_request                                                         │
│                                                                              │
│   1727 │   │   │   )                                                         │
│   1728 │   │                                                                 │
│   1729 │   │   with request_context(request=request):                        │
│ ❱ 1730 │   │   │   response = await transport.handle_async_request(request)  │
│   1731 │   │                                                                 │
│   1732 │   │   assert isinstance(response.stream, AsyncByteStream)           │
│   1733 │   │   response.request = request                                    │
│                                                                              │
│ ╭──────────────────────────── locals ─────────────────────────────╮          │
│ │   request = <Request('PATCH', 'http://example.org/upload')>     │          │
│ │      self = <httpx.AsyncClient object at 0x7f51bba09cd0>        │          │
│ │     start = 151.852035881                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51bba63a90> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/__init__.py:56 in       │
│ mocked_handle_async_request                                                  │
│                                                                              │
│   53 │   │   transport: httpx.AsyncHTTPTransport, request: httpx.Request     │
│   54 │   ) -> httpx.Response:                                                │
│   55 │   │   if options.should_mock(request):                                │
│ ❱ 56 │   │   │   return await mock._handle_async_request(transport, request) │
│   57 │   │   return await real_handle_async_request(transport, request)      │
│   58 │                                                                       │
│   59 │   monkeypatch.setattr(                                                │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │      mock = <pytest_httpx._httpx_mock.HTTPXMock object at                │ │
│ │             0x7f51bba09fd0>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f51bba09090>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51bba63a90>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:183 in   │
│ _handle_async_request                                                        │
│                                                                              │
│   180 │   │   │   │   │   response = await response                          │
│   181 │   │   │   │   return _unread(response)                               │
│   182 │   │                                                                  │
│ ❱ 183 │   │   self._request_not_matched(real_transport, request)             │
│   184 │                                                                      │
│   185 │   def _request_not_matched(                                          │
│   186 │   │   self,                                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       callback = None                                                    │ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51bba63a90>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51bba09fd0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:191 in   │
│ _request_not_matched                                                         │
│                                                                              │
│   188 │   │   request: httpx.Request,                                        │
│   189 │   ) -> NoReturn:                                                     │
│   190 │   │   self._requests_not_matched.append(request)                     │
│ ❱ 191 │   │   raise httpx.TimeoutException(                                  │
│   192 │   │   │   self._explain_that_no_response_was_found(real_transport, r │
│   193 │   │   │   request=request,                                           │
│   194 │   │   )                                                              │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51bba63a90>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51bba09fd0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
TimeoutException: No response can be found for PATCH request on 
http://example.org/upload with {'Patch-Content-Range': 'bytes 
524288-1048575/4194304', 'Content-Length': '524288'} headers amongst:
- Match any request with {'Patch-Content-Range': 'bytes 
2621440-3145727/4194304'} headers
- Already matched any request with {'Content-Length': '524288'} headers

If you wanted to reuse an already matched response instead of registering it 
again, refer to 
https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-
a-response-for-more-than-one-request

2025-01-02 09:54:51 [debug    ] patching                       attempt=2 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 09:54:51 [error    ] retrying                       attempt=2
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /builds/infrastructure/obs-proxy/obs_proxy/chunked_uploads/client.py:84 in   │
│ upload_chunked                                                               │
│                                                                              │
│    81 │   │   │   for attempt in range(MAX_ATTEMPTS):                        │
│    82 │   │   │   │   try:                                                   │
│    83 │   │   │   │   │   logger.debug("patching", uri=uri, size=len(chunk), │
│ ❱  84 │   │   │   │   │   r = await client.patch(                            │
│    85 │   │   │   │   │   │   uri,                                           │
│    86 │   │   │   │   │   │   content=chunk,                                 │
│    87 │   │   │   │   │   │   headers=chunk_headers,                         │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       attempt = 2                                                        │ │
│ │         chunk = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\… │ │
│ │ chunk_headers = {                                                        │ │
│ │                 │   'Patch-Content-Range': 'bytes                        │ │
│ │                 524288-1048575/4194304',                                 │ │
│ │                 │   'Content-Length': '524288'                           │ │
│ │                 }                                                        │ │
│ │    chunk_size = 524288                                                   │ │
│ │        client = <httpx.AsyncClient object at 0x7f51bba09cd0>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f51bba61e10> wrapping <_io.BufferedReader          │ │
│ │                 name='/tmp/pytest-of-root/pytest-0/test_upload_chunked_… │ │
│ │             e = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Patch-Content-Range': 'bytes 524288-1048575/4194304',  │ │
│ │                 'Content-Length': '524288'} headers amongst:\n- Match    │ │
│ │                 any request with {'Patch-Content-Range': 'bytes          │ │
│ │                 2621440-3145727/4194304'} headers\n- Already matched any │ │
│ │                 request with {'Content-Length': '524288'} headers\n\nIf  │ │
│ │                 you wanted to reuse an already matched response instead  │ │
│ │                 of registering it again, refer to                        │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │           exc = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Patch-Content-Range': 'bytes 524288-1048575/4194304',  │ │
│ │                 'Content-Length': '524288'} headers amongst:\n- Match    │ │
│ │                 any request with {'Patch-Content-Range': 'bytes          │ │
│ │                 2621440-3145727/4194304'} headers\n- Already matched any │ │
│ │                 request with {'Content-Length': '524288'} headers\n\nIf  │ │
│ │                 you wanted to reuse an already matched response instead  │ │
│ │                 of registering it again, refer to                        │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │   file_hasher = <md5 _hashlib.HASH object @ 0x7f51bb902810>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1933 in patch       │
│                                                                              │
│   1930 │   │                                                                 │
│   1931 │   │   **Parameters**: See `httpx.request`.                          │
│   1932 │   │   """                                                           │
│ ❱ 1933 │   │   return await self.request(                                    │
│   1934 │   │   │   "PATCH",                                                  │
│   1935 │   │   │   url,                                                      │
│   1936 │   │   │   content=content,                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bba09cd0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1540 in request     │
│                                                                              │
│   1537 │   │   │   timeout=timeout,                                          │
│   1538 │   │   │   extensions=extensions,                                    │
│   1539 │   │   )                                                             │
│ ❱ 1540 │   │   return await self.send(request, auth=auth, follow_redirects=f │
│   1541 │                                                                     │
│   1542 │   @asynccontextmanager                                              │
│   1543 │   async def stream(                                                 │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           method = 'PATCH'                                               │ │
│ │           params = None                                                  │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bba09cd0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1629 in send        │
│                                                                              │
│   1626 │   │                                                                 │
│   1627 │   │   auth = self._build_request_auth(request, auth)                │
│   1628 │   │                                                                 │
│ ❱ 1629 │   │   response = await self._send_handling_auth(                    │
│   1630 │   │   │   request,                                                  │
│   1631 │   │   │   auth=auth,                                                │
│   1632 │   │   │   follow_redirects=follow_redirects,                        │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │             auth = <httpx.Auth object at 0x7f51bc4b0890>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51bba09cd0>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1657 in             │
│ _send_handling_auth                                                          │
│                                                                              │
│   1654 │   │   │   request = await auth_flow.__anext__()                     │
│   1655 │   │   │                                                             │
│   1656 │   │   │   while True:                                               │
│ ❱ 1657 │   │   │   │   response = await self._send_handling_redirects(       │
│   1658 │   │   │   │   │   request,                                          │
│   1659 │   │   │   │   │   follow_redirects=follow_redirects,                │
│   1660 │   │   │   │   │   history=history,                                  │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx.Auth object at 0x7f51bc4b0890>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f51bbb7f4c0>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bba09cd0>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1694 in             │
│ _send_handling_redirects                                                     │
│                                                                              │
│   1691 │   │   │   for hook in self._event_hooks["request"]:                 │
│   1692 │   │   │   │   await hook(request)                                   │
│   1693 │   │   │                                                             │
│ ❱ 1694 │   │   │   response = await self._send_single_request(request)       │
│   1695 │   │   │   try:                                                      │
│   1696 │   │   │   │   for hook in self._event_hooks["response"]:            │
│   1697 │   │   │   │   │   await hook(response)                              │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │ follow_redirects = False                                           │       │
│ │          history = []                                              │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51bba09cd0>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1730 in             │
│ _send_single_request                                                         │
│                                                                              │
│   1727 │   │   │   )                                                         │
│   1728 │   │                                                                 │
│   1729 │   │   with request_context(request=request):                        │
│ ❱ 1730 │   │   │   response = await transport.handle_async_request(request)  │
│   1731 │   │                                                                 │
│   1732 │   │   assert isinstance(response.stream, AsyncByteStream)           │
│   1733 │   │   response.request = request                                    │
│                                                                              │
│ ╭──────────────────────────── locals ─────────────────────────────╮          │
│ │   request = <Request('PATCH', 'http://example.org/upload')>     │          │
│ │      self = <httpx.AsyncClient object at 0x7f51bba09cd0>        │          │
│ │     start = 153.118299928                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51bba63a90> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/__init__.py:56 in       │
│ mocked_handle_async_request                                                  │
│                                                                              │
│   53 │   │   transport: httpx.AsyncHTTPTransport, request: httpx.Request     │
│   54 │   ) -> httpx.Response:                                                │
│   55 │   │   if options.should_mock(request):                                │
│ ❱ 56 │   │   │   return await mock._handle_async_request(transport, request) │
│   57 │   │   return await real_handle_async_request(transport, request)      │
│   58 │                                                                       │
│   59 │   monkeypatch.setattr(                                                │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │      mock = <pytest_httpx._httpx_mock.HTTPXMock object at                │ │
│ │             0x7f51bba09fd0>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f51bba09090>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51bba63a90>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:183 in   │
│ _handle_async_request                                                        │
│                                                                              │
│   180 │   │   │   │   │   response = await response                          │
│   181 │   │   │   │   return _unread(response)                               │
│   182 │   │                                                                  │
│ ❱ 183 │   │   self._request_not_matched(real_transport, request)             │
│   184 │                                                                      │
│   185 │   def _request_not_matched(                                          │
│   186 │   │   self,                                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       callback = None                                                    │ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51bba63a90>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51bba09fd0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:191 in   │
│ _request_not_matched                                                         │
│                                                                              │
│   188 │   │   request: httpx.Request,                                        │
│   189 │   ) -> NoReturn:                                                     │
│   190 │   │   self._requests_not_matched.append(request)                     │
│ ❱ 191 │   │   raise httpx.TimeoutException(                                  │
│   192 │   │   │   self._explain_that_no_response_was_found(real_transport, r │
│   193 │   │   │   request=request,                                           │
│   194 │   │   )                                                              │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51bba63a90>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51bba09fd0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
TimeoutException: No response can be found for PATCH request on 
http://example.org/upload with {'Patch-Content-Range': 'bytes 
524288-1048575/4194304', 'Content-Length': '524288'} headers amongst:
- Match any request with {'Patch-Content-Range': 'bytes 
2621440-3145727/4194304'} headers
- Already matched any request with {'Content-Length': '524288'} headers

If you wanted to reuse an already matched response instead of registering it 
again, refer to 
https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-
a-response-for-more-than-one-request

2025-01-02 09:54:52 [debug    ] patching                       attempt=3 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 09:54:52 [error    ] retrying                       attempt=3
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /builds/infrastructure/obs-proxy/obs_proxy/chunked_uploads/client.py:84 in   │
│ upload_chunked                                                               │
│                                                                              │
│    81 │   │   │   for attempt in range(MAX_ATTEMPTS):                        │
│    82 │   │   │   │   try:                                                   │
│    83 │   │   │   │   │   logger.debug("patching", uri=uri, size=len(chunk), │
│ ❱  84 │   │   │   │   │   r = await client.patch(                            │
│    85 │   │   │   │   │   │   uri,                                           │
│    86 │   │   │   │   │   │   content=chunk,                                 │
│    87 │   │   │   │   │   │   headers=chunk_headers,                         │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       attempt = 3                                                        │ │
│ │         chunk = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\… │ │
│ │ chunk_headers = {                                                        │ │
│ │                 │   'Patch-Content-Range': 'bytes                        │ │
│ │                 524288-1048575/4194304',                                 │ │
│ │                 │   'Content-Length': '524288'                           │ │
│ │                 }                                                        │ │
│ │    chunk_size = 524288                                                   │ │
│ │        client = <httpx.AsyncClient object at 0x7f51bba09cd0>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f51bba61e10> wrapping <_io.BufferedReader          │ │
│ │                 name='/tmp/pytest-of-root/pytest-0/test_upload_chunked_… │ │
│ │             e = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Patch-Content-Range': 'bytes 524288-1048575/4194304',  │ │
│ │                 'Content-Length': '524288'} headers amongst:\n- Match    │ │
│ │                 any request with {'Patch-Content-Range': 'bytes          │ │
│ │                 2621440-3145727/4194304'} headers\n- Already matched any │ │
│ │                 request with {'Content-Length': '524288'} headers\n\nIf  │ │
│ │                 you wanted to reuse an already matched response instead  │ │
│ │                 of registering it again, refer to                        │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │           exc = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Patch-Content-Range': 'bytes 524288-1048575/4194304',  │ │
│ │                 'Content-Length': '524288'} headers amongst:\n- Match    │ │
│ │                 any request with {'Patch-Content-Range': 'bytes          │ │
│ │                 2621440-3145727/4194304'} headers\n- Already matched any │ │
│ │                 request with {'Content-Length': '524288'} headers\n\nIf  │ │
│ │                 you wanted to reuse an already matched response instead  │ │
│ │                 of registering it again, refer to                        │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │   file_hasher = <md5 _hashlib.HASH object @ 0x7f51bb902810>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1933 in patch       │
│                                                                              │
│   1930 │   │                                                                 │
│   1931 │   │   **Parameters**: See `httpx.request`.                          │
│   1932 │   │   """                                                           │
│ ❱ 1933 │   │   return await self.request(                                    │
│   1934 │   │   │   "PATCH",                                                  │
│   1935 │   │   │   url,                                                      │
│   1936 │   │   │   content=content,                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bba09cd0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1540 in request     │
│                                                                              │
│   1537 │   │   │   timeout=timeout,                                          │
│   1538 │   │   │   extensions=extensions,                                    │
│   1539 │   │   )                                                             │
│ ❱ 1540 │   │   return await self.send(request, auth=auth, follow_redirects=f │
│   1541 │                                                                     │
│   1542 │   @asynccontextmanager                                              │
│   1543 │   async def stream(                                                 │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           method = 'PATCH'                                               │ │
│ │           params = None                                                  │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bba09cd0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1629 in send        │
│                                                                              │
│   1626 │   │                                                                 │
│   1627 │   │   auth = self._build_request_auth(request, auth)                │
│   1628 │   │                                                                 │
│ ❱ 1629 │   │   response = await self._send_handling_auth(                    │
│   1630 │   │   │   request,                                                  │
│   1631 │   │   │   auth=auth,                                                │
│   1632 │   │   │   follow_redirects=follow_redirects,                        │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │             auth = <httpx.Auth object at 0x7f51bbb079d0>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51bba09cd0>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1657 in             │
│ _send_handling_auth                                                          │
│                                                                              │
│   1654 │   │   │   request = await auth_flow.__anext__()                     │
│   1655 │   │   │                                                             │
│   1656 │   │   │   while True:                                               │
│ ❱ 1657 │   │   │   │   response = await self._send_handling_redirects(       │
│   1658 │   │   │   │   │   request,                                          │
│   1659 │   │   │   │   │   follow_redirects=follow_redirects,                │
│   1660 │   │   │   │   │   history=history,                                  │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx.Auth object at 0x7f51bbb079d0>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f51bbb7fb50>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bba09cd0>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1694 in             │
│ _send_handling_redirects                                                     │
│                                                                              │
│   1691 │   │   │   for hook in self._event_hooks["request"]:                 │
│   1692 │   │   │   │   await hook(request)                                   │
│   1693 │   │   │                                                             │
│ ❱ 1694 │   │   │   response = await self._send_single_request(request)       │
│   1695 │   │   │   try:                                                      │
│   1696 │   │   │   │   for hook in self._event_hooks["response"]:            │
│   1697 │   │   │   │   │   await hook(response)                              │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │ follow_redirects = False                                           │       │
│ │          history = []                                              │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51bba09cd0>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1730 in             │
│ _send_single_request                                                         │
│                                                                              │
│   1727 │   │   │   )                                                         │
│   1728 │   │                                                                 │
│   1729 │   │   with request_context(request=request):                        │
│ ❱ 1730 │   │   │   response = await transport.handle_async_request(request)  │
│   1731 │   │                                                                 │
│   1732 │   │   assert isinstance(response.stream, AsyncByteStream)           │
│   1733 │   │   response.request = request                                    │
│                                                                              │
│ ╭──────────────────────────── locals ─────────────────────────────╮          │
│ │   request = <Request('PATCH', 'http://example.org/upload')>     │          │
│ │      self = <httpx.AsyncClient object at 0x7f51bba09cd0>        │          │
│ │     start = 154.326372958                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51bba63a90> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/__init__.py:56 in       │
│ mocked_handle_async_request                                                  │
│                                                                              │
│   53 │   │   transport: httpx.AsyncHTTPTransport, request: httpx.Request     │
│   54 │   ) -> httpx.Response:                                                │
│   55 │   │   if options.should_mock(request):                                │
│ ❱ 56 │   │   │   return await mock._handle_async_request(transport, request) │
│   57 │   │   return await real_handle_async_request(transport, request)      │
│   58 │                                                                       │
│   59 │   monkeypatch.setattr(                                                │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │      mock = <pytest_httpx._httpx_mock.HTTPXMock object at                │ │
│ │             0x7f51bba09fd0>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f51bba09090>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51bba63a90>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:183 in   │
│ _handle_async_request                                                        │
│                                                                              │
│   180 │   │   │   │   │   response = await response                          │
│   181 │   │   │   │   return _unread(response)                               │
│   182 │   │                                                                  │
│ ❱ 183 │   │   self._request_not_matched(real_transport, request)             │
│   184 │                                                                      │
│   185 │   def _request_not_matched(                                          │
│   186 │   │   self,                                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       callback = None                                                    │ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51bba63a90>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51bba09fd0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:191 in   │
│ _request_not_matched                                                         │
│                                                                              │
│   188 │   │   request: httpx.Request,                                        │
│   189 │   ) -> NoReturn:                                                     │
│   190 │   │   self._requests_not_matched.append(request)                     │
│ ❱ 191 │   │   raise httpx.TimeoutException(                                  │
│   192 │   │   │   self._explain_that_no_response_was_found(real_transport, r │
│   193 │   │   │   request=request,                                           │
│   194 │   │   )                                                              │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51bba63a90>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51bba09fd0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
TimeoutException: No response can be found for PATCH request on 
http://example.org/upload with {'Patch-Content-Range': 'bytes 
524288-1048575/4194304', 'Content-Length': '524288'} headers amongst:
- Match any request with {'Patch-Content-Range': 'bytes 
2621440-3145727/4194304'} headers
- Already matched any request with {'Content-Length': '524288'} headers

If you wanted to reuse an already matched response instead of registering it 
again, refer to 
https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-
a-response-for-more-than-one-request

2025-01-02 09:54:54 [debug    ] patching                       attempt=4 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 09:54:54 [error    ] retrying                       attempt=4
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /builds/infrastructure/obs-proxy/obs_proxy/chunked_uploads/client.py:84 in   │
│ upload_chunked                                                               │
│                                                                              │
│    81 │   │   │   for attempt in range(MAX_ATTEMPTS):                        │
│    82 │   │   │   │   try:                                                   │
│    83 │   │   │   │   │   logger.debug("patching", uri=uri, size=len(chunk), │
│ ❱  84 │   │   │   │   │   r = await client.patch(                            │
│    85 │   │   │   │   │   │   uri,                                           │
│    86 │   │   │   │   │   │   content=chunk,                                 │
│    87 │   │   │   │   │   │   headers=chunk_headers,                         │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       attempt = 4                                                        │ │
│ │         chunk = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\… │ │
│ │ chunk_headers = {                                                        │ │
│ │                 │   'Patch-Content-Range': 'bytes                        │ │
│ │                 524288-1048575/4194304',                                 │ │
│ │                 │   'Content-Length': '524288'                           │ │
│ │                 }                                                        │ │
│ │    chunk_size = 524288                                                   │ │
│ │        client = <httpx.AsyncClient object at 0x7f51bba09cd0>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f51bba61e10> wrapping <_io.BufferedReader          │ │
│ │                 name='/tmp/pytest-of-root/pytest-0/test_upload_chunked_… │ │
│ │             e = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Patch-Content-Range': 'bytes 524288-1048575/4194304',  │ │
│ │                 'Content-Length': '524288'} headers amongst:\n- Match    │ │
│ │                 any request with {'Patch-Content-Range': 'bytes          │ │
│ │                 2621440-3145727/4194304'} headers\n- Already matched any │ │
│ │                 request with {'Content-Length': '524288'} headers\n\nIf  │ │
│ │                 you wanted to reuse an already matched response instead  │ │
│ │                 of registering it again, refer to                        │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │           exc = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Patch-Content-Range': 'bytes 524288-1048575/4194304',  │ │
│ │                 'Content-Length': '524288'} headers amongst:\n- Match    │ │
│ │                 any request with {'Patch-Content-Range': 'bytes          │ │
│ │                 2621440-3145727/4194304'} headers\n- Already matched any │ │
│ │                 request with {'Content-Length': '524288'} headers\n\nIf  │ │
│ │                 you wanted to reuse an already matched response instead  │ │
│ │                 of registering it again, refer to                        │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │   file_hasher = <md5 _hashlib.HASH object @ 0x7f51bb902810>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1933 in patch       │
│                                                                              │
│   1930 │   │                                                                 │
│   1931 │   │   **Parameters**: See `httpx.request`.                          │
│   1932 │   │   """                                                           │
│ ❱ 1933 │   │   return await self.request(                                    │
│   1934 │   │   │   "PATCH",                                                  │
│   1935 │   │   │   url,                                                      │
│   1936 │   │   │   content=content,                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bba09cd0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1540 in request     │
│                                                                              │
│   1537 │   │   │   timeout=timeout,                                          │
│   1538 │   │   │   extensions=extensions,                                    │
│   1539 │   │   )                                                             │
│ ❱ 1540 │   │   return await self.send(request, auth=auth, follow_redirects=f │
│   1541 │                                                                     │
│   1542 │   @asynccontextmanager                                              │
│   1543 │   async def stream(                                                 │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           method = 'PATCH'                                               │ │
│ │           params = None                                                  │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bba09cd0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1629 in send        │
│                                                                              │
│   1626 │   │                                                                 │
│   1627 │   │   auth = self._build_request_auth(request, auth)                │
│   1628 │   │                                                                 │
│ ❱ 1629 │   │   response = await self._send_handling_auth(                    │
│   1630 │   │   │   request,                                                  │
│   1631 │   │   │   auth=auth,                                                │
│   1632 │   │   │   follow_redirects=follow_redirects,                        │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │             auth = <httpx.Auth object at 0x7f51bbba81d0>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51bba09cd0>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1657 in             │
│ _send_handling_auth                                                          │
│                                                                              │
│   1654 │   │   │   request = await auth_flow.__anext__()                     │
│   1655 │   │   │                                                             │
│   1656 │   │   │   while True:                                               │
│ ❱ 1657 │   │   │   │   response = await self._send_handling_redirects(       │
│   1658 │   │   │   │   │   request,                                          │
│   1659 │   │   │   │   │   follow_redirects=follow_redirects,                │
│   1660 │   │   │   │   │   history=history,                                  │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx.Auth object at 0x7f51bbba81d0>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f51bc2f73d0>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bba09cd0>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1694 in             │
│ _send_handling_redirects                                                     │
│                                                                              │
│   1691 │   │   │   for hook in self._event_hooks["request"]:                 │
│   1692 │   │   │   │   await hook(request)                                   │
│   1693 │   │   │                                                             │
│ ❱ 1694 │   │   │   response = await self._send_single_request(request)       │
│   1695 │   │   │   try:                                                      │
│   1696 │   │   │   │   for hook in self._event_hooks["response"]:            │
│   1697 │   │   │   │   │   await hook(response)                              │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │ follow_redirects = False                                           │       │
│ │          history = []                                              │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51bba09cd0>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1730 in             │
│ _send_single_request                                                         │
│                                                                              │
│   1727 │   │   │   )                                                         │
│   1728 │   │                                                                 │
│   1729 │   │   with request_context(request=request):                        │
│ ❱ 1730 │   │   │   response = await transport.handle_async_request(request)  │
│   1731 │   │                                                                 │
│   1732 │   │   assert isinstance(response.stream, AsyncByteStream)           │
│   1733 │   │   response.request = request                                    │
│                                                                              │
│ ╭──────────────────────────── locals ─────────────────────────────╮          │
│ │   request = <Request('PATCH', 'http://example.org/upload')>     │          │
│ │      self = <httpx.AsyncClient object at 0x7f51bba09cd0>        │          │
│ │     start = 155.505518671                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51bba63a90> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/__init__.py:56 in       │
│ mocked_handle_async_request                                                  │
│                                                                              │
│   53 │   │   transport: httpx.AsyncHTTPTransport, request: httpx.Request     │
│   54 │   ) -> httpx.Response:                                                │
│   55 │   │   if options.should_mock(request):                                │
│ ❱ 56 │   │   │   return await mock._handle_async_request(transport, request) │
│   57 │   │   return await real_handle_async_request(transport, request)      │
│   58 │                                                                       │
│   59 │   monkeypatch.setattr(                                                │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │      mock = <pytest_httpx._httpx_mock.HTTPXMock object at                │ │
│ │             0x7f51bba09fd0>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f51bba09090>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51bba63a90>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:183 in   │
│ _handle_async_request                                                        │
│                                                                              │
│   180 │   │   │   │   │   response = await response                          │
│   181 │   │   │   │   return _unread(response)                               │
│   182 │   │                                                                  │
│ ❱ 183 │   │   self._request_not_matched(real_transport, request)             │
│   184 │                                                                      │
│   185 │   def _request_not_matched(                                          │
│   186 │   │   self,                                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       callback = None                                                    │ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51bba63a90>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51bba09fd0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:191 in   │
│ _request_not_matched                                                         │
│                                                                              │
│   188 │   │   request: httpx.Request,                                        │
│   189 │   ) -> NoReturn:                                                     │
│   190 │   │   self._requests_not_matched.append(request)                     │
│ ❱ 191 │   │   raise httpx.TimeoutException(                                  │
│   192 │   │   │   self._explain_that_no_response_was_found(real_transport, r │
│   193 │   │   │   request=request,                                           │
│   194 │   │   )                                                              │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51bba63a90>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51bba09fd0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
TimeoutException: No response can be found for PATCH request on 
http://example.org/upload with {'Patch-Content-Range': 'bytes 
524288-1048575/4194304', 'Content-Length': '524288'} headers amongst:
- Match any request with {'Patch-Content-Range': 'bytes 
2621440-3145727/4194304'} headers
- Already matched any request with {'Content-Length': '524288'} headers

If you wanted to reuse an already matched response instead of registering it 
again, refer to 
https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-
a-response-for-more-than-one-request

_________________________ test_upload_chunked_complete _________________________

client = <httpx.AsyncClient object at 0x7f51bae11390>
uri = 'http://example.org/upload'
data = <aiofiles.threadpool.binary.AsyncBufferedReader object at 0x7f51bae11250> wrapping <_io.BufferedReader name='/tmp/pytest-of-root/pytest-0/test_upload_chunked_complete0/tempfile'>
size = 4194304, chunk_size = 524288, headers = {}, kv = {}
content_range = <ContentRange 'bytes 524288-1048575/4194304'>, attempt = 4
file_hasher = <md5 _hashlib.HASH object @ 0x7f51baa7aeb0>
chunk_headers = {'Content-Length': '524288', 'Patch-Content-Range': 'bytes 524288-1048575/4194304'}
offset = 524288
chunk = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00...00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
pos = 1048576

    async def upload_chunked(
            client: httpx.AsyncClient,
            uri: str,
            data: AsyncFileIO,
            size: int,
            chunk_size: int = UPLOAD_CHUNK_SIZE,
            headers=None,
            **kv,
    ):
        if not headers:
            headers = {}
    
        content_range = None
        attempt = 0
        file_hasher = hashlib.md5()
        try:
            chunk_headers = headers.copy()
            await data.seek(0)
            while True:
                offset = await data.tell()
                chunk = await data.read(chunk_size)
                if not chunk:
                    break
                pos = await data.tell()
    
                file_hasher.update(chunk)
    
                content_range = ContentRange(
                    start=offset,
                    stop=pos,
                    length=size,
                    units="bytes",
                )
                chunk_headers["Patch-Content-Range"] = content_range.to_header()
                chunk_headers["Content-Length"] = str(len(chunk))
                exc = None
                for attempt in range(MAX_ATTEMPTS):
                    try:
                        logger.debug("patching", uri=uri, size=len(chunk), content_range=content_range, attempt=attempt)
                        r = await client.patch(
                            uri,
                            content=chunk,
                            headers=chunk_headers,
                            **kv,
                        )
                        logger.debug("patch result", result=r)
                        if r.is_success:
                            break
                        else:
                            r.raise_for_status()
                    except httpx.HTTPStatusError as e:
                        if not e.response.is_server_error:
                            logger.debug("not server error, not retrying", resp=e.response)
                            raise
                        logger.exception("retrying", attempt=attempt)
                        exc = e
                    except httpx.HTTPError as e:
                        logger.exception("retrying", attempt=attempt)
                        exc = e
                else:
>                   raise exc

obs_proxy/chunked_uploads/client.py:105: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
obs_proxy/chunked_uploads/client.py:84: in upload_chunked
    r = await client.patch(
/usr/local/lib/python3.11/site-packages/httpx/_client.py:1933: in patch
    return await self.request(
/usr/local/lib/python3.11/site-packages/httpx/_client.py:1540: in request
    return await self.send(request, auth=auth, follow_redirects=follow_redirects)
/usr/local/lib/python3.11/site-packages/httpx/_client.py:1629: in send
    response = await self._send_handling_auth(
/usr/local/lib/python3.11/site-packages/httpx/_client.py:1657: in _send_handling_auth
    response = await self._send_handling_redirects(
/usr/local/lib/python3.11/site-packages/httpx/_client.py:1694: in _send_handling_redirects
    response = await self._send_single_request(request)
/usr/local/lib/python3.11/site-packages/httpx/_client.py:1730: in _send_single_request
    response = await transport.handle_async_request(request)
/usr/local/lib/python3.11/site-packages/pytest_httpx/__init__.py:56: in mocked_handle_async_request
    return await mock._handle_async_request(transport, request)
/usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:183: in _handle_async_request
    self._request_not_matched(real_transport, request)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <pytest_httpx._httpx_mock.HTTPXMock object at 0x7f51bae10c10>
real_transport = <httpx.AsyncHTTPTransport object at 0x7f51bae12b10>
request = <Request('PATCH', 'http://example.org/upload')>

    def _request_not_matched(
        self,
        real_transport: Union[httpx.AsyncHTTPTransport, httpx.HTTPTransport],
        request: httpx.Request,
    ) -> NoReturn:
        self._requests_not_matched.append(request)
>       raise httpx.TimeoutException(
            self._explain_that_no_response_was_found(real_transport, request),
            request=request,
        )
E       httpx.TimeoutException: No response can be found for PATCH request on http://example.org/upload with {'Content-Length': '524288'} headers amongst:
E       - Match HEAD request
E       - Already matched any request with {'Content-Length': '524288'} headers
E       
E       If you wanted to reuse an already matched response instead of registering it again, refer to https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-a-response-for-more-than-one-request

/usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:191: TimeoutException

The above exception was the direct cause of the following exception:

tmp_path = PosixPath('/tmp/pytest-of-root/pytest-0/test_upload_chunked_complete0')
httpx_mock = <pytest_httpx._httpx_mock.HTTPXMock object at 0x7f51bae10c10>

    @pytest.mark.asyncio
    async def test_upload_chunked_complete(
            tmp_path: Path,
            httpx_mock: HTTPXMock,
    ):
        """Verify the complete upload is followed by a hashsum verification"""
        httpx_mock.add_response(
            match_headers={
                "Content-Length": str(CHUNK_SIZE),
            },
        )
    
        # this is the MD5 of 4 MB zeroes
        expected_md5 = "b5cfa9d6c8febd618f91ac2843d50a1c"
    
        httpx_mock.add_response(
            method="HEAD",
            headers={
                "ETag": quote_etag(expected_md5 + "foo"),
            },
        )
    
        tmp_file = tmp_path / "tempfile"
        with tmp_file.open("wb") as f:
            f.truncate(SIZE)
    
        async with httpx.AsyncClient() as client:
            file = await aiofiles.open(tmp_file, 'rb')
            with pytest.raises(
                    ChunkedUploadVerificationError,
            ) as excinfo:
>               await upload_chunked(
                    client,
                    "http://example.org/upload",
                    data=file,
                    size=SIZE,
                    chunk_size=CHUNK_SIZE,
                )

tests/chunked_uploads/test_upload_chunked.py:207: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

client = <httpx.AsyncClient object at 0x7f51bae11390>
uri = 'http://example.org/upload'
data = <aiofiles.threadpool.binary.AsyncBufferedReader object at 0x7f51bae11250> wrapping <_io.BufferedReader name='/tmp/pytest-of-root/pytest-0/test_upload_chunked_complete0/tempfile'>
size = 4194304, chunk_size = 524288, headers = {}, kv = {}
content_range = <ContentRange 'bytes 524288-1048575/4194304'>, attempt = 4
file_hasher = <md5 _hashlib.HASH object @ 0x7f51baa7aeb0>
chunk_headers = {'Content-Length': '524288', 'Patch-Content-Range': 'bytes 524288-1048575/4194304'}
offset = 524288
chunk = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00...00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
pos = 1048576

    async def upload_chunked(
            client: httpx.AsyncClient,
            uri: str,
            data: AsyncFileIO,
            size: int,
            chunk_size: int = UPLOAD_CHUNK_SIZE,
            headers=None,
            **kv,
    ):
        if not headers:
            headers = {}
    
        content_range = None
        attempt = 0
        file_hasher = hashlib.md5()
        try:
            chunk_headers = headers.copy()
            await data.seek(0)
            while True:
                offset = await data.tell()
                chunk = await data.read(chunk_size)
                if not chunk:
                    break
                pos = await data.tell()
    
                file_hasher.update(chunk)
    
                content_range = ContentRange(
                    start=offset,
                    stop=pos,
                    length=size,
                    units="bytes",
                )
                chunk_headers["Patch-Content-Range"] = content_range.to_header()
                chunk_headers["Content-Length"] = str(len(chunk))
                exc = None
                for attempt in range(MAX_ATTEMPTS):
                    try:
                        logger.debug("patching", uri=uri, size=len(chunk), content_range=content_range, attempt=attempt)
                        r = await client.patch(
                            uri,
                            content=chunk,
                            headers=chunk_headers,
                            **kv,
                        )
                        logger.debug("patch result", result=r)
                        if r.is_success:
                            break
                        else:
                            r.raise_for_status()
                    except httpx.HTTPStatusError as e:
                        if not e.response.is_server_error:
                            logger.debug("not server error, not retrying", resp=e.response)
                            raise
                        logger.exception("retrying", attempt=attempt)
                        exc = e
                    except httpx.HTTPError as e:
                        logger.exception("retrying", attempt=attempt)
                        exc = e
                else:
                    raise exc
    
            logger.debug("get etag", uri=uri)
            # now verify the hash
            r = await client.head(
                uri,
                headers=headers,
            )
            calculated_hash = file_hasher.hexdigest()
            etag, _ = unquote_etag(r.headers.get("etag"))
    
            logger.debug("check upload", etag=etag, calculated_hash=calculated_hash)
    
            if etag != calculated_hash:
                raise ChunkedUploadVerificationError(
                    expected=calculated_hash,
                    actual=etag,
                )
    
        except httpx.HTTPError as e:
>           raise ChunkedUploadError(
                content_range=content_range,
                attempt=attempt,
            ) from e
E           obs_proxy.chunked_uploads.client.ChunkedUploadError: Upload error at range bytes 524288-1048575/4194304 (attempt 4): No response can be found for PATCH request on http://example.org/upload with {'Content-Length': '524288'} headers amongst:
E           - Match HEAD request
E           - Already matched any request with {'Content-Length': '524288'} headers
E           
E           If you wanted to reuse an already matched response instead of registering it again, refer to https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-a-response-for-more-than-one-request

obs_proxy/chunked_uploads/client.py:125: ChunkedUploadError

During handling of the above exception, another exception occurred:

self = <contextlib._GeneratorContextManager object at 0x7f51bae12790>
typ = <class 'obs_proxy.chunked_uploads.client.ChunkedUploadError'>
value = ChunkedUploadError(content_range=<ContentRange 'bytes 524288-1048575/4194304'>, attempt=4)
traceback = <traceback object at 0x7f51bc4b67c0>

    def __exit__(self, typ, value, traceback):
        if typ is None:
            try:
                next(self.gen)
            except StopIteration:
                return False
            else:
                try:
                    raise RuntimeError("generator didn't stop")
                finally:
                    self.gen.close()
        else:
            if value is None:
                # Need to force instantiation so we can reliably
                # tell if we get the same exception back
                value = typ()
            try:
                self.gen.throw(typ, value, traceback)
            except StopIteration as exc:
                # Suppress StopIteration *unless* it's the same exception that
                # was passed to throw().  This prevents a StopIteration
                # raised inside the "with" statement from being suppressed.
                return exc is not value
            except RuntimeError as exc:
                # Don't re-raise the passed in exception. (issue27122)
                if exc is value:
                    exc.__traceback__ = traceback
                    return False
                # Avoid suppressing if a StopIteration exception
                # was passed to throw() and later wrapped into a RuntimeError
                # (see PEP 479 for sync generators; async generators also
                # have this behavior). But do this only if the exception wrapped
                # by the RuntimeError is actually Stop(Async)Iteration (see
                # issue29692).
                if (
                    isinstance(value, StopIteration)
                    and exc.__cause__ is value
                ):
                    value.__traceback__ = traceback
                    return False
                raise
            except BaseException as exc:
                # only re-raise if it's *not* the exception that was
                # passed to throw(), because __exit__() must not raise
                # an exception unless __exit__() itself failed.  But throw()
                # has to raise the exception to signal propagation, so this
                # fixes the impedance mismatch between the throw() protocol
                # and the __exit__() protocol.
                if exc is not value:
                    raise
>               exc.__traceback__ = traceback
E               dataclasses.FrozenInstanceError: cannot assign to field '__traceback__'

/usr/local/lib/python3.11/contextlib.py:191: FrozenInstanceError
----------------------------- Captured stdout call -----------------------------
2025-01-02 09:54:55 [debug    ] patching                       attempt=0 content_range=<ContentRange 'bytes 0-524287/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 09:54:55 [debug    ] patch result                   result=<Response [200 OK]>
2025-01-02 09:54:55 [debug    ] patching                       attempt=0 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 09:54:55 [error    ] retrying                       attempt=0
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /builds/infrastructure/obs-proxy/obs_proxy/chunked_uploads/client.py:84 in   │
│ upload_chunked                                                               │
│                                                                              │
│    81 │   │   │   for attempt in range(MAX_ATTEMPTS):                        │
│    82 │   │   │   │   try:                                                   │
│    83 │   │   │   │   │   logger.debug("patching", uri=uri, size=len(chunk), │
│ ❱  84 │   │   │   │   │   r = await client.patch(                            │
│    85 │   │   │   │   │   │   uri,                                           │
│    86 │   │   │   │   │   │   content=chunk,                                 │
│    87 │   │   │   │   │   │   headers=chunk_headers,                         │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       attempt = 0                                                        │ │
│ │         chunk = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\… │ │
│ │ chunk_headers = {                                                        │ │
│ │                 │   'Patch-Content-Range': 'bytes                        │ │
│ │                 524288-1048575/4194304',                                 │ │
│ │                 │   'Content-Length': '524288'                           │ │
│ │                 }                                                        │ │
│ │    chunk_size = 524288                                                   │ │
│ │        client = <httpx.AsyncClient object at 0x7f51bae11390>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f51bae11250> wrapping <_io.BufferedReader          │ │
│ │                 name='/tmp/pytest-of-root/pytest-0/test_upload_chunked_… │ │
│ │             e = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Content-Length': '524288'} headers amongst:\n- Match   │ │
│ │                 HEAD request\n- Already matched any request with         │ │
│ │                 {'Content-Length': '524288'} headers\n\nIf you wanted to │ │
│ │                 reuse an already matched response instead of registering │ │
│ │                 it again, refer to                                       │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │           exc = None                                                     │ │
│ │   file_hasher = <md5 _hashlib.HASH object @ 0x7f51baa7aeb0>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1933 in patch       │
│                                                                              │
│   1930 │   │                                                                 │
│   1931 │   │   **Parameters**: See `httpx.request`.                          │
│   1932 │   │   """                                                           │
│ ❱ 1933 │   │   return await self.request(                                    │
│   1934 │   │   │   "PATCH",                                                  │
│   1935 │   │   │   url,                                                      │
│   1936 │   │   │   content=content,                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bae11390>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1540 in request     │
│                                                                              │
│   1537 │   │   │   timeout=timeout,                                          │
│   1538 │   │   │   extensions=extensions,                                    │
│   1539 │   │   )                                                             │
│ ❱ 1540 │   │   return await self.send(request, auth=auth, follow_redirects=f │
│   1541 │                                                                     │
│   1542 │   @asynccontextmanager                                              │
│   1543 │   async def stream(                                                 │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           method = 'PATCH'                                               │ │
│ │           params = None                                                  │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bae11390>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1629 in send        │
│                                                                              │
│   1626 │   │                                                                 │
│   1627 │   │   auth = self._build_request_auth(request, auth)                │
│   1628 │   │                                                                 │
│ ❱ 1629 │   │   response = await self._send_handling_auth(                    │
│   1630 │   │   │   request,                                                  │
│   1631 │   │   │   auth=auth,                                                │
│   1632 │   │   │   follow_redirects=follow_redirects,                        │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │             auth = <httpx.Auth object at 0x7f51bae112d0>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51bae11390>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1657 in             │
│ _send_handling_auth                                                          │
│                                                                              │
│   1654 │   │   │   request = await auth_flow.__anext__()                     │
│   1655 │   │   │                                                             │
│   1656 │   │   │   while True:                                               │
│ ❱ 1657 │   │   │   │   response = await self._send_handling_redirects(       │
│   1658 │   │   │   │   │   request,                                          │
│   1659 │   │   │   │   │   follow_redirects=follow_redirects,                │
│   1660 │   │   │   │   │   history=history,                                  │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx.Auth object at 0x7f51bae112d0>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f51bba38040>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bae11390>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1694 in             │
│ _send_handling_redirects                                                     │
│                                                                              │
│   1691 │   │   │   for hook in self._event_hooks["request"]:                 │
│   1692 │   │   │   │   await hook(request)                                   │
│   1693 │   │   │                                                             │
│ ❱ 1694 │   │   │   response = await self._send_single_request(request)       │
│   1695 │   │   │   try:                                                      │
│   1696 │   │   │   │   for hook in self._event_hooks["response"]:            │
│   1697 │   │   │   │   │   await hook(response)                              │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │ follow_redirects = False                                           │       │
│ │          history = []                                              │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51bae11390>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1730 in             │
│ _send_single_request                                                         │
│                                                                              │
│   1727 │   │   │   )                                                         │
│   1728 │   │                                                                 │
│   1729 │   │   with request_context(request=request):                        │
│ ❱ 1730 │   │   │   response = await transport.handle_async_request(request)  │
│   1731 │   │                                                                 │
│   1732 │   │   assert isinstance(response.stream, AsyncByteStream)           │
│   1733 │   │   response.request = request                                    │
│                                                                              │
│ ╭──────────────────────────── locals ─────────────────────────────╮          │
│ │   request = <Request('PATCH', 'http://example.org/upload')>     │          │
│ │      self = <httpx.AsyncClient object at 0x7f51bae11390>        │          │
│ │     start = 156.62537686                                        │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51bae12b10> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/__init__.py:56 in       │
│ mocked_handle_async_request                                                  │
│                                                                              │
│   53 │   │   transport: httpx.AsyncHTTPTransport, request: httpx.Request     │
│   54 │   ) -> httpx.Response:                                                │
│   55 │   │   if options.should_mock(request):                                │
│ ❱ 56 │   │   │   return await mock._handle_async_request(transport, request) │
│   57 │   │   return await real_handle_async_request(transport, request)      │
│   58 │                                                                       │
│   59 │   monkeypatch.setattr(                                                │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │      mock = <pytest_httpx._httpx_mock.HTTPXMock object at                │ │
│ │             0x7f51bae10c10>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f51bae11110>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51bae12b10>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:183 in   │
│ _handle_async_request                                                        │
│                                                                              │
│   180 │   │   │   │   │   response = await response                          │
│   181 │   │   │   │   return _unread(response)                               │
│   182 │   │                                                                  │
│ ❱ 183 │   │   self._request_not_matched(real_transport, request)             │
│   184 │                                                                      │
│   185 │   def _request_not_matched(                                          │
│   186 │   │   self,                                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       callback = None                                                    │ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51bae12b10>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51bae10c10>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:191 in   │
│ _request_not_matched                                                         │
│                                                                              │
│   188 │   │   request: httpx.Request,                                        │
│   189 │   ) -> NoReturn:                                                     │
│   190 │   │   self._requests_not_matched.append(request)                     │
│ ❱ 191 │   │   raise httpx.TimeoutException(                                  │
│   192 │   │   │   self._explain_that_no_response_was_found(real_transport, r │
│   193 │   │   │   request=request,                                           │
│   194 │   │   )                                                              │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51bae12b10>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51bae10c10>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
TimeoutException: No response can be found for PATCH request on 
http://example.org/upload with {'Content-Length': '524288'} headers amongst:
- Match HEAD request
- Already matched any request with {'Content-Length': '524288'} headers

If you wanted to reuse an already matched response instead of registering it 
again, refer to 
https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-
a-response-for-more-than-one-request

2025-01-02 09:54:56 [debug    ] patching                       attempt=1 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 09:54:56 [error    ] retrying                       attempt=1
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /builds/infrastructure/obs-proxy/obs_proxy/chunked_uploads/client.py:84 in   │
│ upload_chunked                                                               │
│                                                                              │
│    81 │   │   │   for attempt in range(MAX_ATTEMPTS):                        │
│    82 │   │   │   │   try:                                                   │
│    83 │   │   │   │   │   logger.debug("patching", uri=uri, size=len(chunk), │
│ ❱  84 │   │   │   │   │   r = await client.patch(                            │
│    85 │   │   │   │   │   │   uri,                                           │
│    86 │   │   │   │   │   │   content=chunk,                                 │
│    87 │   │   │   │   │   │   headers=chunk_headers,                         │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       attempt = 1                                                        │ │
│ │         chunk = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\… │ │
│ │ chunk_headers = {                                                        │ │
│ │                 │   'Patch-Content-Range': 'bytes                        │ │
│ │                 524288-1048575/4194304',                                 │ │
│ │                 │   'Content-Length': '524288'                           │ │
│ │                 }                                                        │ │
│ │    chunk_size = 524288                                                   │ │
│ │        client = <httpx.AsyncClient object at 0x7f51bae11390>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f51bae11250> wrapping <_io.BufferedReader          │ │
│ │                 name='/tmp/pytest-of-root/pytest-0/test_upload_chunked_… │ │
│ │             e = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Content-Length': '524288'} headers amongst:\n- Match   │ │
│ │                 HEAD request\n- Already matched any request with         │ │
│ │                 {'Content-Length': '524288'} headers\n\nIf you wanted to │ │
│ │                 reuse an already matched response instead of registering │ │
│ │                 it again, refer to                                       │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │           exc = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Content-Length': '524288'} headers amongst:\n- Match   │ │
│ │                 HEAD request\n- Already matched any request with         │ │
│ │                 {'Content-Length': '524288'} headers\n\nIf you wanted to │ │
│ │                 reuse an already matched response instead of registering │ │
│ │                 it again, refer to                                       │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │   file_hasher = <md5 _hashlib.HASH object @ 0x7f51baa7aeb0>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1933 in patch       │
│                                                                              │
│   1930 │   │                                                                 │
│   1931 │   │   **Parameters**: See `httpx.request`.                          │
│   1932 │   │   """                                                           │
│ ❱ 1933 │   │   return await self.request(                                    │
│   1934 │   │   │   "PATCH",                                                  │
│   1935 │   │   │   url,                                                      │
│   1936 │   │   │   content=content,                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bae11390>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1540 in request     │
│                                                                              │
│   1537 │   │   │   timeout=timeout,                                          │
│   1538 │   │   │   extensions=extensions,                                    │
│   1539 │   │   )                                                             │
│ ❱ 1540 │   │   return await self.send(request, auth=auth, follow_redirects=f │
│   1541 │                                                                     │
│   1542 │   @asynccontextmanager                                              │
│   1543 │   async def stream(                                                 │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           method = 'PATCH'                                               │ │
│ │           params = None                                                  │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bae11390>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1629 in send        │
│                                                                              │
│   1626 │   │                                                                 │
│   1627 │   │   auth = self._build_request_auth(request, auth)                │
│   1628 │   │                                                                 │
│ ❱ 1629 │   │   response = await self._send_handling_auth(                    │
│   1630 │   │   │   request,                                                  │
│   1631 │   │   │   auth=auth,                                                │
│   1632 │   │   │   follow_redirects=follow_redirects,                        │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │             auth = <httpx.Auth object at 0x7f51bb9373d0>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51bae11390>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1657 in             │
│ _send_handling_auth                                                          │
│                                                                              │
│   1654 │   │   │   request = await auth_flow.__anext__()                     │
│   1655 │   │   │                                                             │
│   1656 │   │   │   while True:                                               │
│ ❱ 1657 │   │   │   │   response = await self._send_handling_redirects(       │
│   1658 │   │   │   │   │   request,                                          │
│   1659 │   │   │   │   │   follow_redirects=follow_redirects,                │
│   1660 │   │   │   │   │   history=history,                                  │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx.Auth object at 0x7f51bb9373d0>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f51bc2f73d0>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bae11390>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1694 in             │
│ _send_handling_redirects                                                     │
│                                                                              │
│   1691 │   │   │   for hook in self._event_hooks["request"]:                 │
│   1692 │   │   │   │   await hook(request)                                   │
│   1693 │   │   │                                                             │
│ ❱ 1694 │   │   │   response = await self._send_single_request(request)       │
│   1695 │   │   │   try:                                                      │
│   1696 │   │   │   │   for hook in self._event_hooks["response"]:            │
│   1697 │   │   │   │   │   await hook(response)                              │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │ follow_redirects = False                                           │       │
│ │          history = []                                              │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51bae11390>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1730 in             │
│ _send_single_request                                                         │
│                                                                              │
│   1727 │   │   │   )                                                         │
│   1728 │   │                                                                 │
│   1729 │   │   with request_context(request=request):                        │
│ ❱ 1730 │   │   │   response = await transport.handle_async_request(request)  │
│   1731 │   │                                                                 │
│   1732 │   │   assert isinstance(response.stream, AsyncByteStream)           │
│   1733 │   │   response.request = request                                    │
│                                                                              │
│ ╭──────────────────────────── locals ─────────────────────────────╮          │
│ │   request = <Request('PATCH', 'http://example.org/upload')>     │          │
│ │      self = <httpx.AsyncClient object at 0x7f51bae11390>        │          │
│ │     start = 157.768732116                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51bae12b10> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/__init__.py:56 in       │
│ mocked_handle_async_request                                                  │
│                                                                              │
│   53 │   │   transport: httpx.AsyncHTTPTransport, request: httpx.Request     │
│   54 │   ) -> httpx.Response:                                                │
│   55 │   │   if options.should_mock(request):                                │
│ ❱ 56 │   │   │   return await mock._handle_async_request(transport, request) │
│   57 │   │   return await real_handle_async_request(transport, request)      │
│   58 │                                                                       │
│   59 │   monkeypatch.setattr(                                                │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │      mock = <pytest_httpx._httpx_mock.HTTPXMock object at                │ │
│ │             0x7f51bae10c10>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f51bae11110>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51bae12b10>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:183 in   │
│ _handle_async_request                                                        │
│                                                                              │
│   180 │   │   │   │   │   response = await response                          │
│   181 │   │   │   │   return _unread(response)                               │
│   182 │   │                                                                  │
│ ❱ 183 │   │   self._request_not_matched(real_transport, request)             │
│   184 │                                                                      │
│   185 │   def _request_not_matched(                                          │
│   186 │   │   self,                                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       callback = None                                                    │ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51bae12b10>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51bae10c10>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:191 in   │
│ _request_not_matched                                                         │
│                                                                              │
│   188 │   │   request: httpx.Request,                                        │
│   189 │   ) -> NoReturn:                                                     │
│   190 │   │   self._requests_not_matched.append(request)                     │
│ ❱ 191 │   │   raise httpx.TimeoutException(                                  │
│   192 │   │   │   self._explain_that_no_response_was_found(real_transport, r │
│   193 │   │   │   request=request,                                           │
│   194 │   │   )                                                              │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51bae12b10>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51bae10c10>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
TimeoutException: No response can be found for PATCH request on 
http://example.org/upload with {'Content-Length': '524288'} headers amongst:
- Match HEAD request
- Already matched any request with {'Content-Length': '524288'} headers

If you wanted to reuse an already matched response instead of registering it 
again, refer to 
https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-
a-response-for-more-than-one-request

2025-01-02 09:54:57 [debug    ] patching                       attempt=2 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 09:54:57 [error    ] retrying                       attempt=2
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /builds/infrastructure/obs-proxy/obs_proxy/chunked_uploads/client.py:84 in   │
│ upload_chunked                                                               │
│                                                                              │
│    81 │   │   │   for attempt in range(MAX_ATTEMPTS):                        │
│    82 │   │   │   │   try:                                                   │
│    83 │   │   │   │   │   logger.debug("patching", uri=uri, size=len(chunk), │
│ ❱  84 │   │   │   │   │   r = await client.patch(                            │
│    85 │   │   │   │   │   │   uri,                                           │
│    86 │   │   │   │   │   │   content=chunk,                                 │
│    87 │   │   │   │   │   │   headers=chunk_headers,                         │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       attempt = 2                                                        │ │
│ │         chunk = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\… │ │
│ │ chunk_headers = {                                                        │ │
│ │                 │   'Patch-Content-Range': 'bytes                        │ │
│ │                 524288-1048575/4194304',                                 │ │
│ │                 │   'Content-Length': '524288'                           │ │
│ │                 }                                                        │ │
│ │    chunk_size = 524288                                                   │ │
│ │        client = <httpx.AsyncClient object at 0x7f51bae11390>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f51bae11250> wrapping <_io.BufferedReader          │ │
│ │                 name='/tmp/pytest-of-root/pytest-0/test_upload_chunked_… │ │
│ │             e = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Content-Length': '524288'} headers amongst:\n- Match   │ │
│ │                 HEAD request\n- Already matched any request with         │ │
│ │                 {'Content-Length': '524288'} headers\n\nIf you wanted to │ │
│ │                 reuse an already matched response instead of registering │ │
│ │                 it again, refer to                                       │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │           exc = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Content-Length': '524288'} headers amongst:\n- Match   │ │
│ │                 HEAD request\n- Already matched any request with         │ │
│ │                 {'Content-Length': '524288'} headers\n\nIf you wanted to │ │
│ │                 reuse an already matched response instead of registering │ │
│ │                 it again, refer to                                       │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │   file_hasher = <md5 _hashlib.HASH object @ 0x7f51baa7aeb0>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1933 in patch       │
│                                                                              │
│   1930 │   │                                                                 │
│   1931 │   │   **Parameters**: See `httpx.request`.                          │
│   1932 │   │   """                                                           │
│ ❱ 1933 │   │   return await self.request(                                    │
│   1934 │   │   │   "PATCH",                                                  │
│   1935 │   │   │   url,                                                      │
│   1936 │   │   │   content=content,                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bae11390>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1540 in request     │
│                                                                              │
│   1537 │   │   │   timeout=timeout,                                          │
│   1538 │   │   │   extensions=extensions,                                    │
│   1539 │   │   )                                                             │
│ ❱ 1540 │   │   return await self.send(request, auth=auth, follow_redirects=f │
│   1541 │                                                                     │
│   1542 │   @asynccontextmanager                                              │
│   1543 │   async def stream(                                                 │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           method = 'PATCH'                                               │ │
│ │           params = None                                                  │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bae11390>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1629 in send        │
│                                                                              │
│   1626 │   │                                                                 │
│   1627 │   │   auth = self._build_request_auth(request, auth)                │
│   1628 │   │                                                                 │
│ ❱ 1629 │   │   response = await self._send_handling_auth(                    │
│   1630 │   │   │   request,                                                  │
│   1631 │   │   │   auth=auth,                                                │
│   1632 │   │   │   follow_redirects=follow_redirects,                        │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │             auth = <httpx.Auth object at 0x7f51bb937450>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51bae11390>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1657 in             │
│ _send_handling_auth                                                          │
│                                                                              │
│   1654 │   │   │   request = await auth_flow.__anext__()                     │
│   1655 │   │   │                                                             │
│   1656 │   │   │   while True:                                               │
│ ❱ 1657 │   │   │   │   response = await self._send_handling_redirects(       │
│   1658 │   │   │   │   │   request,                                          │
│   1659 │   │   │   │   │   follow_redirects=follow_redirects,                │
│   1660 │   │   │   │   │   history=history,                                  │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx.Auth object at 0x7f51bb937450>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f51bbb7df30>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bae11390>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1694 in             │
│ _send_handling_redirects                                                     │
│                                                                              │
│   1691 │   │   │   for hook in self._event_hooks["request"]:                 │
│   1692 │   │   │   │   await hook(request)                                   │
│   1693 │   │   │                                                             │
│ ❱ 1694 │   │   │   response = await self._send_single_request(request)       │
│   1695 │   │   │   try:                                                      │
│   1696 │   │   │   │   for hook in self._event_hooks["response"]:            │
│   1697 │   │   │   │   │   await hook(response)                              │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │ follow_redirects = False                                           │       │
│ │          history = []                                              │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51bae11390>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1730 in             │
│ _send_single_request                                                         │
│                                                                              │
│   1727 │   │   │   )                                                         │
│   1728 │   │                                                                 │
│   1729 │   │   with request_context(request=request):                        │
│ ❱ 1730 │   │   │   response = await transport.handle_async_request(request)  │
│   1731 │   │                                                                 │
│   1732 │   │   assert isinstance(response.stream, AsyncByteStream)           │
│   1733 │   │   response.request = request                                    │
│                                                                              │
│ ╭──────────────────────────── locals ─────────────────────────────╮          │
│ │   request = <Request('PATCH', 'http://example.org/upload')>     │          │
│ │      self = <httpx.AsyncClient object at 0x7f51bae11390>        │          │
│ │     start = 159.003350649                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51bae12b10> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/__init__.py:56 in       │
│ mocked_handle_async_request                                                  │
│                                                                              │
│   53 │   │   transport: httpx.AsyncHTTPTransport, request: httpx.Request     │
│   54 │   ) -> httpx.Response:                                                │
│   55 │   │   if options.should_mock(request):                                │
│ ❱ 56 │   │   │   return await mock._handle_async_request(transport, request) │
│   57 │   │   return await real_handle_async_request(transport, request)      │
│   58 │                                                                       │
│   59 │   monkeypatch.setattr(                                                │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │      mock = <pytest_httpx._httpx_mock.HTTPXMock object at                │ │
│ │             0x7f51bae10c10>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f51bae11110>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51bae12b10>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:183 in   │
│ _handle_async_request                                                        │
│                                                                              │
│   180 │   │   │   │   │   response = await response                          │
│   181 │   │   │   │   return _unread(response)                               │
│   182 │   │                                                                  │
│ ❱ 183 │   │   self._request_not_matched(real_transport, request)             │
│   184 │                                                                      │
│   185 │   def _request_not_matched(                                          │
│   186 │   │   self,                                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       callback = None                                                    │ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51bae12b10>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51bae10c10>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:191 in   │
│ _request_not_matched                                                         │
│                                                                              │
│   188 │   │   request: httpx.Request,                                        │
│   189 │   ) -> NoReturn:                                                     │
│   190 │   │   self._requests_not_matched.append(request)                     │
│ ❱ 191 │   │   raise httpx.TimeoutException(                                  │
│   192 │   │   │   self._explain_that_no_response_was_found(real_transport, r │
│   193 │   │   │   request=request,                                           │
│   194 │   │   )                                                              │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51bae12b10>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51bae10c10>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
TimeoutException: No response can be found for PATCH request on 
http://example.org/upload with {'Content-Length': '524288'} headers amongst:
- Match HEAD request
- Already matched any request with {'Content-Length': '524288'} headers

If you wanted to reuse an already matched response instead of registering it 
again, refer to 
https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-
a-response-for-more-than-one-request

2025-01-02 09:54:58 [debug    ] patching                       attempt=3 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 09:54:58 [error    ] retrying                       attempt=3
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /builds/infrastructure/obs-proxy/obs_proxy/chunked_uploads/client.py:84 in   │
│ upload_chunked                                                               │
│                                                                              │
│    81 │   │   │   for attempt in range(MAX_ATTEMPTS):                        │
│    82 │   │   │   │   try:                                                   │
│    83 │   │   │   │   │   logger.debug("patching", uri=uri, size=len(chunk), │
│ ❱  84 │   │   │   │   │   r = await client.patch(                            │
│    85 │   │   │   │   │   │   uri,                                           │
│    86 │   │   │   │   │   │   content=chunk,                                 │
│    87 │   │   │   │   │   │   headers=chunk_headers,                         │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       attempt = 3                                                        │ │
│ │         chunk = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\… │ │
│ │ chunk_headers = {                                                        │ │
│ │                 │   'Patch-Content-Range': 'bytes                        │ │
│ │                 524288-1048575/4194304',                                 │ │
│ │                 │   'Content-Length': '524288'                           │ │
│ │                 }                                                        │ │
│ │    chunk_size = 524288                                                   │ │
│ │        client = <httpx.AsyncClient object at 0x7f51bae11390>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f51bae11250> wrapping <_io.BufferedReader          │ │
│ │                 name='/tmp/pytest-of-root/pytest-0/test_upload_chunked_… │ │
│ │             e = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Content-Length': '524288'} headers amongst:\n- Match   │ │
│ │                 HEAD request\n- Already matched any request with         │ │
│ │                 {'Content-Length': '524288'} headers\n\nIf you wanted to │ │
│ │                 reuse an already matched response instead of registering │ │
│ │                 it again, refer to                                       │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │           exc = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Content-Length': '524288'} headers amongst:\n- Match   │ │
│ │                 HEAD request\n- Already matched any request with         │ │
│ │                 {'Content-Length': '524288'} headers\n\nIf you wanted to │ │
│ │                 reuse an already matched response instead of registering │ │
│ │                 it again, refer to                                       │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │   file_hasher = <md5 _hashlib.HASH object @ 0x7f51baa7aeb0>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1933 in patch       │
│                                                                              │
│   1930 │   │                                                                 │
│   1931 │   │   **Parameters**: See `httpx.request`.                          │
│   1932 │   │   """                                                           │
│ ❱ 1933 │   │   return await self.request(                                    │
│   1934 │   │   │   "PATCH",                                                  │
│   1935 │   │   │   url,                                                      │
│   1936 │   │   │   content=content,                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bae11390>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1540 in request     │
│                                                                              │
│   1537 │   │   │   timeout=timeout,                                          │
│   1538 │   │   │   extensions=extensions,                                    │
│   1539 │   │   )                                                             │
│ ❱ 1540 │   │   return await self.send(request, auth=auth, follow_redirects=f │
│   1541 │                                                                     │
│   1542 │   @asynccontextmanager                                              │
│   1543 │   async def stream(                                                 │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           method = 'PATCH'                                               │ │
│ │           params = None                                                  │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bae11390>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1629 in send        │
│                                                                              │
│   1626 │   │                                                                 │
│   1627 │   │   auth = self._build_request_auth(request, auth)                │
│   1628 │   │                                                                 │
│ ❱ 1629 │   │   response = await self._send_handling_auth(                    │
│   1630 │   │   │   request,                                                  │
│   1631 │   │   │   auth=auth,                                                │
│   1632 │   │   │   follow_redirects=follow_redirects,                        │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │             auth = <httpx.Auth object at 0x7f51bc2677d0>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51bae11390>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1657 in             │
│ _send_handling_auth                                                          │
│                                                                              │
│   1654 │   │   │   request = await auth_flow.__anext__()                     │
│   1655 │   │   │                                                             │
│   1656 │   │   │   while True:                                               │
│ ❱ 1657 │   │   │   │   response = await self._send_handling_redirects(       │
│   1658 │   │   │   │   │   request,                                          │
│   1659 │   │   │   │   │   follow_redirects=follow_redirects,                │
│   1660 │   │   │   │   │   history=history,                                  │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx.Auth object at 0x7f51bc2677d0>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f51bba38040>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bae11390>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1694 in             │
│ _send_handling_redirects                                                     │
│                                                                              │
│   1691 │   │   │   for hook in self._event_hooks["request"]:                 │
│   1692 │   │   │   │   await hook(request)                                   │
│   1693 │   │   │                                                             │
│ ❱ 1694 │   │   │   response = await self._send_single_request(request)       │
│   1695 │   │   │   try:                                                      │
│   1696 │   │   │   │   for hook in self._event_hooks["response"]:            │
│   1697 │   │   │   │   │   await hook(response)                              │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │ follow_redirects = False                                           │       │
│ │          history = []                                              │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51bae11390>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1730 in             │
│ _send_single_request                                                         │
│                                                                              │
│   1727 │   │   │   )                                                         │
│   1728 │   │                                                                 │
│   1729 │   │   with request_context(request=request):                        │
│ ❱ 1730 │   │   │   response = await transport.handle_async_request(request)  │
│   1731 │   │                                                                 │
│   1732 │   │   assert isinstance(response.stream, AsyncByteStream)           │
│   1733 │   │   response.request = request                                    │
│                                                                              │
│ ╭──────────────────────────── locals ─────────────────────────────╮          │
│ │   request = <Request('PATCH', 'http://example.org/upload')>     │          │
│ │      self = <httpx.AsyncClient object at 0x7f51bae11390>        │          │
│ │     start = 160.398138824                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51bae12b10> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/__init__.py:56 in       │
│ mocked_handle_async_request                                                  │
│                                                                              │
│   53 │   │   transport: httpx.AsyncHTTPTransport, request: httpx.Request     │
│   54 │   ) -> httpx.Response:                                                │
│   55 │   │   if options.should_mock(request):                                │
│ ❱ 56 │   │   │   return await mock._handle_async_request(transport, request) │
│   57 │   │   return await real_handle_async_request(transport, request)      │
│   58 │                                                                       │
│   59 │   monkeypatch.setattr(                                                │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │      mock = <pytest_httpx._httpx_mock.HTTPXMock object at                │ │
│ │             0x7f51bae10c10>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f51bae11110>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51bae12b10>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:183 in   │
│ _handle_async_request                                                        │
│                                                                              │
│   180 │   │   │   │   │   response = await response                          │
│   181 │   │   │   │   return _unread(response)                               │
│   182 │   │                                                                  │
│ ❱ 183 │   │   self._request_not_matched(real_transport, request)             │
│   184 │                                                                      │
│   185 │   def _request_not_matched(                                          │
│   186 │   │   self,                                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       callback = None                                                    │ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51bae12b10>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51bae10c10>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:191 in   │
│ _request_not_matched                                                         │
│                                                                              │
│   188 │   │   request: httpx.Request,                                        │
│   189 │   ) -> NoReturn:                                                     │
│   190 │   │   self._requests_not_matched.append(request)                     │
│ ❱ 191 │   │   raise httpx.TimeoutException(                                  │
│   192 │   │   │   self._explain_that_no_response_was_found(real_transport, r │
│   193 │   │   │   request=request,                                           │
│   194 │   │   )                                                              │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51bae12b10>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51bae10c10>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
TimeoutException: No response can be found for PATCH request on 
http://example.org/upload with {'Content-Length': '524288'} headers amongst:
- Match HEAD request
- Already matched any request with {'Content-Length': '524288'} headers

If you wanted to reuse an already matched response instead of registering it 
again, refer to 
https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-
a-response-for-more-than-one-request

2025-01-02 09:55:00 [debug    ] patching                       attempt=4 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 09:55:00 [error    ] retrying                       attempt=4
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /builds/infrastructure/obs-proxy/obs_proxy/chunked_uploads/client.py:84 in   │
│ upload_chunked                                                               │
│                                                                              │
│    81 │   │   │   for attempt in range(MAX_ATTEMPTS):                        │
│    82 │   │   │   │   try:                                                   │
│    83 │   │   │   │   │   logger.debug("patching", uri=uri, size=len(chunk), │
│ ❱  84 │   │   │   │   │   r = await client.patch(                            │
│    85 │   │   │   │   │   │   uri,                                           │
│    86 │   │   │   │   │   │   content=chunk,                                 │
│    87 │   │   │   │   │   │   headers=chunk_headers,                         │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       attempt = 4                                                        │ │
│ │         chunk = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\… │ │
│ │ chunk_headers = {                                                        │ │
│ │                 │   'Patch-Content-Range': 'bytes                        │ │
│ │                 524288-1048575/4194304',                                 │ │
│ │                 │   'Content-Length': '524288'                           │ │
│ │                 }                                                        │ │
│ │    chunk_size = 524288                                                   │ │
│ │        client = <httpx.AsyncClient object at 0x7f51bae11390>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f51bae11250> wrapping <_io.BufferedReader          │ │
│ │                 name='/tmp/pytest-of-root/pytest-0/test_upload_chunked_… │ │
│ │             e = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Content-Length': '524288'} headers amongst:\n- Match   │ │
│ │                 HEAD request\n- Already matched any request with         │ │
│ │                 {'Content-Length': '524288'} headers\n\nIf you wanted to │ │
│ │                 reuse an already matched response instead of registering │ │
│ │                 it again, refer to                                       │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │           exc = TimeoutException("No response can be found for PATCH     │ │
│ │                 request on http://example.org/upload with                │ │
│ │                 {'Content-Length': '524288'} headers amongst:\n- Match   │ │
│ │                 HEAD request\n- Already matched any request with         │ │
│ │                 {'Content-Length': '524288'} headers\n\nIf you wanted to │ │
│ │                 reuse an already matched response instead of registering │ │
│ │                 it again, refer to                                       │ │
│ │                 https://github.com/Colin-b/pytest_httpx/blob/master/REA… │ │
│ │   file_hasher = <md5 _hashlib.HASH object @ 0x7f51baa7aeb0>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1933 in patch       │
│                                                                              │
│   1930 │   │                                                                 │
│   1931 │   │   **Parameters**: See `httpx.request`.                          │
│   1932 │   │   """                                                           │
│ ❱ 1933 │   │   return await self.request(                                    │
│   1934 │   │   │   "PATCH",                                                  │
│   1935 │   │   │   url,                                                      │
│   1936 │   │   │   content=content,                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bae11390>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1540 in request     │
│                                                                              │
│   1537 │   │   │   timeout=timeout,                                          │
│   1538 │   │   │   extensions=extensions,                                    │
│   1539 │   │   )                                                             │
│ ❱ 1540 │   │   return await self.send(request, auth=auth, follow_redirects=f │
│   1541 │                                                                     │
│   1542 │   @asynccontextmanager                                              │
│   1543 │   async def stream(                                                 │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          content = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x… │ │
│ │          cookies = None                                                  │ │
│ │             data = None                                                  │ │
│ │       extensions = None                                                  │ │
│ │            files = None                                                  │ │
│ │ follow_redirects = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           method = 'PATCH'                                               │ │
│ │           params = None                                                  │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bae11390>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f51bcc38b90>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1629 in send        │
│                                                                              │
│   1626 │   │                                                                 │
│   1627 │   │   auth = self._build_request_auth(request, auth)                │
│   1628 │   │                                                                 │
│ ❱ 1629 │   │   response = await self._send_handling_auth(                    │
│   1630 │   │   │   request,                                                  │
│   1631 │   │   │   auth=auth,                                                │
│   1632 │   │   │   follow_redirects=follow_redirects,                        │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │             auth = <httpx.Auth object at 0x7f51bbb15990>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51bae11390>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1657 in             │
│ _send_handling_auth                                                          │
│                                                                              │
│   1654 │   │   │   request = await auth_flow.__anext__()                     │
│   1655 │   │   │                                                             │
│   1656 │   │   │   while True:                                               │
│ ❱ 1657 │   │   │   │   response = await self._send_handling_redirects(       │
│   1658 │   │   │   │   │   request,                                          │
│   1659 │   │   │   │   │   follow_redirects=follow_redirects,                │
│   1660 │   │   │   │   │   history=history,                                  │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │             auth = <httpx.Auth object at 0x7f51bbb15990>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f51bc2f73d0>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f51bae11390>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1694 in             │
│ _send_handling_redirects                                                     │
│                                                                              │
│   1691 │   │   │   for hook in self._event_hooks["request"]:                 │
│   1692 │   │   │   │   await hook(request)                                   │
│   1693 │   │   │                                                             │
│ ❱ 1694 │   │   │   response = await self._send_single_request(request)       │
│   1695 │   │   │   try:                                                      │
│   1696 │   │   │   │   for hook in self._event_hooks["response"]:            │
│   1697 │   │   │   │   │   await hook(response)                              │
│                                                                              │
│ ╭────────────────────────────── locals ──────────────────────────────╮       │
│ │ follow_redirects = False                                           │       │
│ │          history = []                                              │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f51bae11390>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/httpx/_client.py:1730 in             │
│ _send_single_request                                                         │
│                                                                              │
│   1727 │   │   │   )                                                         │
│   1728 │   │                                                                 │
│   1729 │   │   with request_context(request=request):                        │
│ ❱ 1730 │   │   │   response = await transport.handle_async_request(request)  │
│   1731 │   │                                                                 │
│   1732 │   │   assert isinstance(response.stream, AsyncByteStream)           │
│   1733 │   │   response.request = request                                    │
│                                                                              │
│ ╭──────────────────────────── locals ─────────────────────────────╮          │
│ │   request = <Request('PATCH', 'http://example.org/upload')>     │          │
│ │      self = <httpx.AsyncClient object at 0x7f51bae11390>        │          │
│ │     start = 161.646384035                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51bae12b10> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/__init__.py:56 in       │
│ mocked_handle_async_request                                                  │
│                                                                              │
│   53 │   │   transport: httpx.AsyncHTTPTransport, request: httpx.Request     │
│   54 │   ) -> httpx.Response:                                                │
│   55 │   │   if options.should_mock(request):                                │
│ ❱ 56 │   │   │   return await mock._handle_async_request(transport, request) │
│   57 │   │   return await real_handle_async_request(transport, request)      │
│   58 │                                                                       │
│   59 │   monkeypatch.setattr(                                                │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │      mock = <pytest_httpx._httpx_mock.HTTPXMock object at                │ │
│ │             0x7f51bae10c10>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f51bae11110>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f51bae12b10>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:183 in   │
│ _handle_async_request                                                        │
│                                                                              │
│   180 │   │   │   │   │   response = await response                          │
│   181 │   │   │   │   return _unread(response)                               │
│   182 │   │                                                                  │
│ ❱ 183 │   │   self._request_not_matched(real_transport, request)             │
│   184 │                                                                      │
│   185 │   def _request_not_matched(                                          │
│   186 │   │   self,                                                          │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │       callback = None                                                    │ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51bae12b10>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51bae10c10>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.11/site-packages/pytest_httpx/_httpx_mock.py:191 in   │
│ _request_not_matched                                                         │
│                                                                              │
│   188 │   │   request: httpx.Request,                                        │
│   189 │   ) -> NoReturn:                                                     │
│   190 │   │   self._requests_not_matched.append(request)                     │
│ ❱ 191 │   │   raise httpx.TimeoutException(                                  │
│   192 │   │   │   self._explain_that_no_response_was_found(real_transport, r │
│   193 │   │   │   request=request,                                           │
│   194 │   │   )                                                              │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │ real_transport = <httpx.AsyncHTTPTransport object at 0x7f51bae12b10>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f51bae10c10>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
TimeoutException: No response can be found for PATCH request on 
http://example.org/upload with {'Content-Length': '524288'} headers amongst:
- Match HEAD request
- Already matched any request with {'Content-Length': '524288'} headers

If you wanted to reuse an already matched response instead of registering it 
again, refer to 
https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-
a-response-for-more-than-one-request

=============================== warnings summary ===============================
tests/chunked_uploads/test_upload_client_server.py: 10 warnings
tests/chunked_uploads/test_upload_endpoint.py: 8 warnings
tests/test_auth.py: 4 warnings
tests/upload/test_upload_five_gigazeroes.py: 4 warnings
tests/upload/test_upload_prefix.py: 4 warnings
  /usr/local/lib/python3.11/site-packages/quart/wrappers/response.py:335: DeprecationWarning: The 'charset' attribute is deprecated and will not be used in Werkzeug 2.4. Text in body and cookie data will always use UTF-8.
    bytes_data = data.encode(self.charset)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
---- generated xml file: /builds/infrastructure/obs-proxy/test-results.xml -----
=========================== short test summary info ============================
FAILED tests/chunked_uploads/test_upload_chunked.py::test_upload_chunked_timeout - AssertionError: Regex pattern did not match.
 Regex: 'Upload error at range bytes 2621440-3145727/4194304 .attempt 4.: Simulated timeout'
 Input: "Upload error at range bytes 524288-1048575/4194304 (attempt 4): No response can be found for PATCH request on http://example.org/upload with {'Patch-Content-Range': 'bytes 524288-1048575/4194304', 'Content-Length': '524288'} headers amongst:\n- Match any request with {'Patch-Content-Range': 'bytes 2621440-3145727/4194304'} headers\n- Already matched any request with {'Content-Length': '524288'} headers\n\nIf you wanted to reuse an already matched response instead of registering it again, refer to https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-a-response-for-more-than-one-request"
FAILED tests/chunked_uploads/test_upload_chunked.py::test_upload_chunked_wrong_response - AssertionError: Regex pattern did not match.
 Regex: "Upload error at range bytes 2621440-3145727/4194304 .attempt 0.: .*418 I'm a teapot.*"
 Input: "Upload error at range bytes 524288-1048575/4194304 (attempt 4): No response can be found for PATCH request on http://example.org/upload with {'Patch-Content-Range': 'bytes 524288-1048575/4194304', 'Content-Length': '524288'} headers amongst:\n- Match any request with {'Patch-Content-Range': 'bytes 2621440-3145727/4194304'} headers\n- Already matched any request with {'Content-Length': '524288'} headers\n\nIf you wanted to reuse an already matched response instead of registering it again, refer to https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-a-response-for-more-than-one-request"
FAILED tests/chunked_uploads/test_upload_chunked.py::test_upload_chunked_transient_server_error - AssertionError: Regex pattern did not match.
 Regex: 'Upload error at range bytes 2621440-3145727/4194304 .attempt 4.: .*500 Internal Server Error.*'
 Input: "Upload error at range bytes 524288-1048575/4194304 (attempt 4): No response can be found for PATCH request on http://example.org/upload with {'Patch-Content-Range': 'bytes 524288-1048575/4194304', 'Content-Length': '524288'} headers amongst:\n- Match any request with {'Patch-Content-Range': 'bytes 2621440-3145727/4194304'} headers\n- Already matched any request with {'Content-Length': '524288'} headers\n\nIf you wanted to reuse an already matched response instead of registering it again, refer to https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-a-response-for-more-than-one-request"
FAILED tests/chunked_uploads/test_upload_chunked.py::test_upload_chunked_complete - dataclasses.FrozenInstanceError: cannot assign to field '__traceback__'
ERROR tests/chunked_uploads/test_upload_chunked.py::test_upload_chunked_timeout - AssertionError: The following responses are mocked but not requested:
  - Match any request with {'Patch-Content-Range': 'bytes 2621440-3145727/4194304'} headers
  
  If this is on purpose, refer to https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-more-responses-than-what-will-be-requested
assert not [<pytest_httpx._request_matcher._RequestMatcher object at 0x7f51bba1b950>]
ERROR tests/chunked_uploads/test_upload_chunked.py::test_upload_chunked_wrong_response - AssertionError: The following responses are mocked but not requested:
  - Match any request with {'Patch-Content-Range': 'bytes 2621440-3145727/4194304'} headers
  
  If this is on purpose, refer to https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-more-responses-than-what-will-be-requested
assert not [<pytest_httpx._request_matcher._RequestMatcher object at 0x7f51badfa150>]
ERROR tests/chunked_uploads/test_upload_chunked.py::test_upload_chunked_transient_server_error - AssertionError: The following responses are mocked but not requested:
  - Match any request with {'Patch-Content-Range': 'bytes 2621440-3145727/4194304'} headers
  
  If this is on purpose, refer to https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-more-responses-than-what-will-be-requested
assert not [<pytest_httpx._request_matcher._RequestMatcher object at 0x7f51bba09e50>]
ERROR tests/chunked_uploads/test_upload_chunked.py::test_upload_chunked_complete - AssertionError: The following responses are mocked but not requested:
  - Match HEAD request
  
  If this is on purpose, refer to https://github.com/Colin-b/pytest_httpx/blob/master/README.md#allow-to-register-more-responses-than-what-will-be-requested
assert not [<pytest_httpx._request_matcher._RequestMatcher object at 0x7f51bae13dd0>]
======= 4 failed, 26 passed, 30 warnings, 4 errors in 142.40s (0:02:22) ========
section_end:1735811817:step_script
section_start:1735811817:upload_artifacts_on_failure
Uploading artifacts for failed job
Uploading artifacts...
test-results.xml: found 1 matching artifact files and directories 
Uploading artifacts as "junit" to coordinator... 201 Created  id=3636256 responseStatus=201 Created token=glcbt-64
section_end:1735811818:upload_artifacts_on_failure
section_start:1735811818:cleanup_file_variables
Cleaning up project directory and file based variables
section_end:1735811818:cleanup_file_variables
ERROR: Job failed: exit code 1