Running with gitlab-runner 17.7.0 (3153ccc6)
  on Heavy runner on DO CsXVDUbD, system ID: s_a30377c9ccd3
section_start:1735811870:prepare_executor
Preparing the "docker+machine" executor
Using Docker executor with image python:3.12 ...
Pulling docker image python:3.12 ...
Using docker image sha256:acda8b87a53fdba562e5dd1d52f64b95fa96f2c1eb92df388e53f3ccc07c921b for python:3.12 with digest python@sha256:251ef8e69b6ccdf3c7bf7effaa51179d59af35364dd9c86469142aa72a2c8cfc ...
section_end:1735811996:prepare_executor
section_start:1735811996:prepare_script
Preparing environment
Running on runner-csxvdubd-project-6813-concurrent-0 via runner-csxvdubd-apertis-heavy-1735811870-a2119eb7...
section_end:1735811997:prepare_script
section_start:1735811997: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 28f32a57 as detached HEAD (ref is py-3.12-13-test)...

Skipping Git submodules setup
section_end:1735811998:get_sources
section_start:1735811998:step_script
Executing "step_script" stage of the job script
Using docker image sha256:acda8b87a53fdba562e5dd1d52f64b95fa96f2c1eb92df388e53f3ccc07c921b for python:3.12 with digest python@sha256:251ef8e69b6ccdf3c7bf7effaa51179d59af35364dd9c86469142aa72a2c8cfc ...
$ pip install .[test]
Processing /builds/infrastructure/obs-proxy
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  Getting requirements to build wheel: finished with status 'done'
  Preparing metadata (pyproject.toml): started
  Preparing metadata (pyproject.toml): finished with status 'done'
Collecting setuptools (from obs-proxy==0)
  Using cached setuptools-75.6.0-py3-none-any.whl.metadata (6.7 kB)
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.tar.gz (84 kB)
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  Getting requirements to build wheel: finished with status 'done'
  Preparing metadata (pyproject.toml): started
  Preparing metadata (pyproject.toml): finished with status 'done'
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-cp312-cp312-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)
Downloading httpcore-1.0.7-py3-none-any.whl (78 kB)
Downloading Jinja2-3.0.3-py3-none-any.whl (133 kB)
Downloading json_rpc-1.15.0-py2.py3-none-any.whl (39 kB)
Downloading pytest-8.3.4-py3-none-any.whl (343 kB)
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)
Downloading structlog-22.3.0-py3-none-any.whl (61 kB)
Downloading werkzeug-2.3.8-py3-none-any.whl (242 kB)
Downloading xmltodict-0.14.2-py2.py3-none-any.whl (10.0 kB)
Downloading rich-13.9.4-py3-none-any.whl (242 kB)
Using cached setuptools-75.6.0-py3-none-any.whl (1.2 MB)
Downloading blinker-1.5-py2.py3-none-any.whl (12 kB)
Downloading click-8.1.8-py3-none-any.whl (98 kB)
Downloading hypercorn-0.17.3-py3-none-any.whl (61 kB)
Downloading markdown_it_py-3.0.0-py3-none-any.whl (87 kB)
Downloading MarkupSafe-3.0.2-cp312-cp312-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 60.6 MB/s eta 0:00:00
Downloading anyio-4.7.0-py3-none-any.whl (93 kB)
Downloading idna-3.10-py3-none-any.whl (70 kB)
Downloading certifi-2024.12.14-py3-none-any.whl (164 kB)
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)
Downloading h11-0.14.0-py3-none-any.whl (58 kB)
Downloading h2-4.1.0-py3-none-any.whl (57 kB)
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, websockets
  Building wheel for obs-proxy (pyproject.toml): started
  Building wheel for obs-proxy (pyproject.toml): finished with status 'done'
  Created wheel for obs-proxy: filename=obs_proxy-0-py3-none-any.whl size=37789 sha256=6cc8a8fe304c85408afc4ab93d53d950f2a968220a20671ebd32bf7a5e157033
  Stored in directory: /root/.cache/pip/wheels/f1/b5/e0/1ffc6f3cb1ed4a610cb9e43914376c08d673c0bd6d3220f558
  Building wheel for websockets (pyproject.toml): started
  Building wheel for websockets (pyproject.toml): finished with status 'done'
  Created wheel for websockets: filename=websockets-10.4-cp312-cp312-linux_x86_64.whl size=106370 sha256=98d9da572e4eeb459b5213b561d04f74088c3a4f3410916681784d6828659d51
  Stored in directory: /root/.cache/pip/wheels/80/cf/6d/5d7e4c920cb41925a178b2d2621889c520d648bab487b1d7fd
Successfully built obs-proxy websockets
Installing collected packages: json-rpc, xmltodict, websockets, typing_extensions, structlog, sniffio, setuptools, 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 setuptools-75.6.0 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, possibly rendering your system unusable.It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv. Use the --root-user-action option if you know what you are doing and want to suppress this warning.
$ python setup.py build sdist bdist
running build
running build_py
copying obs_proxy/server.py -> build/lib/obs_proxy
copying obs_proxy/worker.py -> build/lib/obs_proxy
copying obs_proxy/rpcqueue.py -> build/lib/obs_proxy
copying obs_proxy/repserver.py -> build/lib/obs_proxy
copying obs_proxy/wsclient.py -> build/lib/obs_proxy
copying obs_proxy/config.py -> build/lib/obs_proxy
copying obs_proxy/async_jsonrpc.py -> build/lib/obs_proxy
copying obs_proxy/client.py -> build/lib/obs_proxy
copying obs_proxy/utils.py -> build/lib/obs_proxy
copying obs_proxy/__init__.py -> build/lib/obs_proxy
copying obs_proxy/chunked_uploads/client.py -> build/lib/obs_proxy/chunked_uploads
copying obs_proxy/chunked_uploads/utils.py -> build/lib/obs_proxy/chunked_uploads
copying obs_proxy/chunked_uploads/__init__.py -> build/lib/obs_proxy/chunked_uploads
copying obs_proxy/chunked_uploads/routes.py -> build/lib/obs_proxy/chunked_uploads
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
creating obs_proxy-0/tests
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
copying tests/test_auth.py -> obs_proxy-0/tests
copying tests/test_config.py -> obs_proxy-0/tests
copying tests/test_rpcqueue.py -> obs_proxy-0/tests
copying obs_proxy.egg-info/SOURCES.txt -> obs_proxy-0/obs_proxy.egg-info
Writing obs_proxy-0/setup.cfg
creating dist
Creating tar archive
removing 'obs_proxy-0' (and everything under it)
running bdist
running bdist_dumb
installing to build/bdist.linux-x86_64/dumb
running install
/usr/local/lib/python3.12/site-packages/setuptools/_distutils/cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated.
!!

        ********************************************************************************
        Please avoid running ``setup.py`` directly.
        Instead, use pypa/build, pypa/installer or other
        standards-based tools.

        See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
        ********************************************************************************

!!
  self.initialize_options()
running install_lib
creating build/bdist.linux-x86_64/dumb/usr/local/lib/python3.12/site-packages
creating build/bdist.linux-x86_64/dumb/usr/local/lib/python3.12/site-packages/obs_proxy
copying build/lib/obs_proxy/server.py -> build/bdist.linux-x86_64/dumb/usr/local/lib/python3.12/site-packages/obs_proxy
creating build/bdist.linux-x86_64/dumb/usr/local/lib/python3.12/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.12/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.12/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.12/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.12/site-packages/obs_proxy/chunked_uploads
copying build/lib/obs_proxy/worker.py -> build/bdist.linux-x86_64/dumb/usr/local/lib/python3.12/site-packages/obs_proxy
copying build/lib/obs_proxy/rpcqueue.py -> build/bdist.linux-x86_64/dumb/usr/local/lib/python3.12/site-packages/obs_proxy
copying build/lib/obs_proxy/repserver.py -> build/bdist.linux-x86_64/dumb/usr/local/lib/python3.12/site-packages/obs_proxy
copying build/lib/obs_proxy/wsclient.py -> build/bdist.linux-x86_64/dumb/usr/local/lib/python3.12/site-packages/obs_proxy
copying build/lib/obs_proxy/config.py -> build/bdist.linux-x86_64/dumb/usr/local/lib/python3.12/site-packages/obs_proxy
copying build/lib/obs_proxy/async_jsonrpc.py -> build/bdist.linux-x86_64/dumb/usr/local/lib/python3.12/site-packages/obs_proxy
copying build/lib/obs_proxy/client.py -> build/bdist.linux-x86_64/dumb/usr/local/lib/python3.12/site-packages/obs_proxy
copying build/lib/obs_proxy/utils.py -> build/bdist.linux-x86_64/dumb/usr/local/lib/python3.12/site-packages/obs_proxy
copying build/lib/obs_proxy/__init__.py -> build/bdist.linux-x86_64/dumb/usr/local/lib/python3.12/site-packages/obs_proxy
byte-compiling build/bdist.linux-x86_64/dumb/usr/local/lib/python3.12/site-packages/obs_proxy/server.py to server.cpython-312.pyc
byte-compiling build/bdist.linux-x86_64/dumb/usr/local/lib/python3.12/site-packages/obs_proxy/chunked_uploads/client.py to client.cpython-312.pyc
byte-compiling build/bdist.linux-x86_64/dumb/usr/local/lib/python3.12/site-packages/obs_proxy/chunked_uploads/utils.py to utils.cpython-312.pyc
byte-compiling build/bdist.linux-x86_64/dumb/usr/local/lib/python3.12/site-packages/obs_proxy/chunked_uploads/__init__.py to __init__.cpython-312.pyc
byte-compiling build/bdist.linux-x86_64/dumb/usr/local/lib/python3.12/site-packages/obs_proxy/chunked_uploads/routes.py to routes.cpython-312.pyc
byte-compiling build/bdist.linux-x86_64/dumb/usr/local/lib/python3.12/site-packages/obs_proxy/worker.py to worker.cpython-312.pyc
byte-compiling build/bdist.linux-x86_64/dumb/usr/local/lib/python3.12/site-packages/obs_proxy/rpcqueue.py to rpcqueue.cpython-312.pyc
byte-compiling build/bdist.linux-x86_64/dumb/usr/local/lib/python3.12/site-packages/obs_proxy/repserver.py to repserver.cpython-312.pyc
byte-compiling build/bdist.linux-x86_64/dumb/usr/local/lib/python3.12/site-packages/obs_proxy/wsclient.py to wsclient.cpython-312.pyc
byte-compiling build/bdist.linux-x86_64/dumb/usr/local/lib/python3.12/site-packages/obs_proxy/config.py to config.cpython-312.pyc
byte-compiling build/bdist.linux-x86_64/dumb/usr/local/lib/python3.12/site-packages/obs_proxy/async_jsonrpc.py to async_jsonrpc.cpython-312.pyc
byte-compiling build/bdist.linux-x86_64/dumb/usr/local/lib/python3.12/site-packages/obs_proxy/client.py to client.cpython-312.pyc
byte-compiling build/bdist.linux-x86_64/dumb/usr/local/lib/python3.12/site-packages/obs_proxy/utils.py to utils.cpython-312.pyc
byte-compiling build/bdist.linux-x86_64/dumb/usr/local/lib/python3.12/site-packages/obs_proxy/__init__.py to __init__.cpython-312.pyc
running install_data
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.12/site-packages/obs_proxy-0-py3.12.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.12/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.12.8, pytest-8.3.4, pluggy-1.5.0 -- /usr/local/bin/python3.12
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 FAILED            [ 80%]
tests/upload/test_upload.py::test_upload_data_no_error ERROR             [ 80%]
tests/upload/test_upload.py::test_upload_data_req_error FAILED           [ 83%]
tests/upload/test_upload.py::test_upload_data_req_error ERROR            [ 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 FAILED [ 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 0x7f006cafd1c0>
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.12/site-packages/pytest_httpx/__init__.py:67: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

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

    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 0x7f006cafcb90>]

/usr/local/lib/python3.12/site-packages/pytest_httpx/_httpx_mock.py:319: AssertionError
----------------------------- Captured stdout call -----------------------------
2025-01-02 10:00:26 [debug    ] patching                       attempt=0 content_range=<ContentRange 'bytes 0-524287/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 10:00:26 [debug    ] patch result                   result=<Response [200 OK]>
2025-01-02 10:00:26 [debug    ] patching                       attempt=0 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 10:00:26 [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 0x7f006cafcbf0>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f006cd876e0> 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 @ 0x7f006cbfe3b0>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f006cafcbf0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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 0x7f006cafcbf0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cc041d0>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f006cafcbf0>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cc041d0>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f006cb2f920>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f006cafcbf0>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cafcbf0>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cafcbf0>        │          │
│ │     start = 134.330108591                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006cafe240> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.12/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                │ │
│ │             0x7f006cafd5b0>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f006cafcfe0>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006cafe240>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cafe240>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006cafd5b0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cafe240>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006cafd5b0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
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 10:00:27 [debug    ] patching                       attempt=1 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 10:00:27 [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 0x7f006cafcbf0>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f006cd876e0> 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 @ 0x7f006cbfe3b0>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f006cafcbf0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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 0x7f006cafcbf0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006e362f30>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f006cafcbf0>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006e362f30>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f006d1efe60>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f006cafcbf0>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cafcbf0>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cafcbf0>        │          │
│ │     start = 135.652573862                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006cafe240> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.12/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                │ │
│ │             0x7f006cafd5b0>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f006cafcfe0>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006cafe240>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cafe240>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006cafd5b0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cafe240>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006cafd5b0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
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 10:00:28 [debug    ] patching                       attempt=2 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 10:00:28 [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 0x7f006cafcbf0>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f006cd876e0> 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 @ 0x7f006cbfe3b0>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f006cafcbf0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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 0x7f006cafcbf0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cc073b0>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f006cafcbf0>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cc073b0>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f006d1ec3c0>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f006cafcbf0>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cafcbf0>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cafcbf0>        │          │
│ │     start = 136.950223703                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006cafe240> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.12/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                │ │
│ │             0x7f006cafd5b0>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f006cafcfe0>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006cafe240>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cafe240>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006cafd5b0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cafe240>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006cafd5b0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
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 10:00:30 [debug    ] patching                       attempt=3 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 10:00:30 [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 0x7f006cafcbf0>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f006cd876e0> 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 @ 0x7f006cbfe3b0>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f006cafcbf0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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 0x7f006cafcbf0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006d3dc740>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f006cafcbf0>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006d3dc740>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f006d1ec120>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f006cafcbf0>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cafcbf0>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cafcbf0>        │          │
│ │     start = 138.287907795                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006cafe240> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.12/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                │ │
│ │             0x7f006cafd5b0>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f006cafcfe0>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006cafe240>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cafe240>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006cafd5b0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cafe240>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006cafd5b0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
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 10:00:31 [debug    ] patching                       attempt=4 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 10:00:31 [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 0x7f006cafcbf0>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f006cd876e0> 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 @ 0x7f006cbfe3b0>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f006cafcbf0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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 0x7f006cafcbf0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cb710a0>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f006cafcbf0>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cb710a0>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f006d1ec2e0>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f006cafcbf0>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cafcbf0>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cafcbf0>        │          │
│ │     start = 139.613202971                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006cafe240> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.12/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                │ │
│ │             0x7f006cafd5b0>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f006cafcfe0>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006cafe240>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cafe240>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006cafd5b0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cafe240>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006cafd5b0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
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 0x7f006cafe630>
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.12/site-packages/pytest_httpx/__init__.py:67: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

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

    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 0x7f006ca45a00>]

/usr/local/lib/python3.12/site-packages/pytest_httpx/_httpx_mock.py:319: AssertionError
----------------------------- Captured stdout call -----------------------------
2025-01-02 10:00:33 [debug    ] patching                       attempt=0 content_range=<ContentRange 'bytes 0-524287/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 10:00:33 [debug    ] patch result                   result=<Response [200 OK]>
2025-01-02 10:00:33 [debug    ] patching                       attempt=0 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 10:00:33 [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 0x7f006ca469c0>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f006cafef60> 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 @ 0x7f006bde50b0>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f006ca469c0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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 0x7f006ca469c0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca44290>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f006ca469c0>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca44290>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f006ca025e0>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f006ca469c0>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca469c0>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca469c0>        │          │
│ │     start = 141.773685059                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006ca44680> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.12/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                │ │
│ │             0x7f006cafe3c0>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f006cafda30>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006ca44680>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca44680>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006cafe3c0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca44680>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006cafe3c0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
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 10:00:35 [debug    ] patching                       attempt=1 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 10:00:35 [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 0x7f006ca469c0>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f006cafef60> 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 @ 0x7f006bde50b0>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f006ca469c0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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 0x7f006ca469c0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cf080e0>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f006ca469c0>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cf080e0>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f006cae25e0>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f006ca469c0>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca469c0>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca469c0>        │          │
│ │     start = 143.330463554                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006ca44680> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.12/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                │ │
│ │             0x7f006cafe3c0>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f006cafda30>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006ca44680>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca44680>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006cafe3c0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca44680>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006cafe3c0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
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 10:00:36 [debug    ] patching                       attempt=2 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 10:00:36 [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 0x7f006ca469c0>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f006cafef60> 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 @ 0x7f006bde50b0>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f006ca469c0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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 0x7f006ca469c0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cd46570>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f006ca469c0>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cd46570>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f006ca02960>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f006ca469c0>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca469c0>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca469c0>        │          │
│ │     start = 144.736432973                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006ca44680> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.12/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                │ │
│ │             0x7f006cafe3c0>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f006cafda30>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006ca44680>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca44680>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006cafe3c0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca44680>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006cafe3c0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
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 10:00:37 [debug    ] patching                       attempt=3 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 10:00:37 [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 0x7f006ca469c0>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f006cafef60> 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 @ 0x7f006bde50b0>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f006ca469c0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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 0x7f006ca469c0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006d275160>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f006ca469c0>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006d275160>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f006ca03060>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f006ca469c0>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca469c0>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca469c0>        │          │
│ │     start = 146.021906157                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006ca44680> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.12/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                │ │
│ │             0x7f006cafe3c0>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f006cafda30>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006ca44680>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca44680>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006cafe3c0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca44680>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006cafe3c0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
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 10:00:39 [debug    ] patching                       attempt=4 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 10:00:39 [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 0x7f006ca469c0>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f006cafef60> 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 @ 0x7f006bde50b0>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f006ca469c0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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 0x7f006ca469c0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cacb020>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f006ca469c0>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cacb020>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f006cae25e0>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f006ca469c0>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca469c0>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca469c0>        │          │
│ │     start = 147.465831852                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006ca44680> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.12/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                │ │
│ │             0x7f006cafe3c0>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f006cafda30>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006ca44680>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca44680>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006cafe3c0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca44680>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006cafe3c0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
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 0x7f006cafe450>
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.12/site-packages/pytest_httpx/__init__.py:67: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

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

    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 0x7f006ca47e30>]

/usr/local/lib/python3.12/site-packages/pytest_httpx/_httpx_mock.py:319: AssertionError
----------------------------- Captured stdout call -----------------------------
2025-01-02 10:00:40 [debug    ] patching                       attempt=0 content_range=<ContentRange 'bytes 0-524287/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 10:00:40 [debug    ] patch result                   result=<Response [200 OK]>
2025-01-02 10:00:40 [debug    ] patching                       attempt=0 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 10:00:40 [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 0x7f006ca44a10>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f006caff290> 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 @ 0x7f006bde68f0>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f006ca44a10>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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 0x7f006ca44a10>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca470b0>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f006ca44a10>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca470b0>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f006cb2e880>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f006ca44a10>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca44a10>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca44a10>        │          │
│ │     start = 148.950287045                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006ca45e80> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.12/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                │ │
│ │             0x7f006cafcb30>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f006cafd8b0>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006ca45e80>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca45e80>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006cafcb30>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca45e80>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006cafcb30>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
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 10:00:42 [debug    ] patching                       attempt=1 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 10:00:42 [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 0x7f006ca44a10>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f006caff290> 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 @ 0x7f006bde68f0>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f006ca44a10>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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 0x7f006ca44a10>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006d2dc950>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f006ca44a10>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006d2dc950>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f006cae25e0>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f006ca44a10>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca44a10>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca44a10>        │          │
│ │     start = 150.382753404                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006ca45e80> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.12/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                │ │
│ │             0x7f006cafcb30>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f006cafd8b0>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006ca45e80>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca45e80>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006cafcb30>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca45e80>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006cafcb30>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
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 10:00:43 [debug    ] patching                       attempt=2 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 10:00:43 [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 0x7f006ca44a10>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f006caff290> 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 @ 0x7f006bde68f0>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f006ca44a10>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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 0x7f006ca44a10>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cc07ce0>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f006ca44a10>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cc07ce0>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f006c9ce180>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f006ca44a10>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca44a10>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca44a10>        │          │
│ │     start = 152.140619346                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006ca45e80> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.12/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                │ │
│ │             0x7f006cafcb30>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f006cafd8b0>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006ca45e80>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca45e80>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006cafcb30>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca45e80>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006cafcb30>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
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 10:00:45 [debug    ] patching                       attempt=3 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 10:00:45 [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 0x7f006ca44a10>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f006caff290> 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 @ 0x7f006bde68f0>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f006ca44a10>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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 0x7f006ca44a10>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006caa75c0>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f006ca44a10>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006caa75c0>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f006cb2ec00>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f006ca44a10>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca44a10>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca44a10>        │          │
│ │     start = 154.190322732                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006ca45e80> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.12/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                │ │
│ │             0x7f006cafcb30>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f006cafd8b0>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006ca45e80>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca45e80>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006cafcb30>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca45e80>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006cafcb30>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
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 10:00:47 [debug    ] patching                       attempt=4 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 10:00: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 0x7f006ca44a10>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f006caff290> 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 @ 0x7f006bde68f0>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f006ca44a10>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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 0x7f006ca44a10>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006d2dc950>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f006ca44a10>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006d2dc950>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f006cae25e0>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f006ca44a10>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca44a10>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca44a10>        │          │
│ │     start = 156.078819092                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006ca45e80> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.12/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                │ │
│ │             0x7f006cafcb30>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f006cafd8b0>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006ca45e80>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca45e80>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006cafcb30>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca45e80>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006cafcb30>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
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 0x7f006ca52030>
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.12/site-packages/pytest_httpx/__init__.py:67: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

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

    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 0x7f006ca53b60>]

/usr/local/lib/python3.12/site-packages/pytest_httpx/_httpx_mock.py:319: AssertionError
----------------------------- Captured stdout call -----------------------------
2025-01-02 10:00:49 [debug    ] patching                       attempt=0 content_range=<ContentRange 'bytes 0-524287/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 10:00:49 [debug    ] patch result                   result=<Response [200 OK]>
2025-01-02 10:00:49 [debug    ] patching                       attempt=0 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 10:00: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 0x7f006ca53ce0>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f006ca52c60> 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 @ 0x7f006bb0e3b0>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f006ca53ce0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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 0x7f006ca53ce0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006c996cf0>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f006ca53ce0>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006c996cf0>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f006ca01a80>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f006ca53ce0>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca53ce0>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca53ce0>        │          │
│ │     start = 157.552867777                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006ca51130> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.12/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                │ │
│ │             0x7f006ca50bf0>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f006ca52ab0>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006ca51130>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca51130>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006ca50bf0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca51130>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006ca50bf0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
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 10:00:50 [debug    ] patching                       attempt=1 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 10:00: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 0x7f006ca53ce0>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f006ca52c60> 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 @ 0x7f006bb0e3b0>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f006ca53ce0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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 0x7f006ca53ce0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cf944a0>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f006ca53ce0>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cf944a0>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f006cae25e0>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f006ca53ce0>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca53ce0>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca53ce0>        │          │
│ │     start = 158.883533377                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006ca51130> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.12/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                │ │
│ │             0x7f006ca50bf0>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f006ca52ab0>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006ca51130>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca51130>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006ca50bf0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca51130>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006ca50bf0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
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 10:00:51 [debug    ] patching                       attempt=2 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 10:00: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 0x7f006ca53ce0>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f006ca52c60> 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 @ 0x7f006bb0e3b0>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f006ca53ce0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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 0x7f006ca53ce0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006caa7440>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f006ca53ce0>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006caa7440>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f006d1ec580>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f006ca53ce0>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca53ce0>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca53ce0>        │          │
│ │     start = 160.192334751                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006ca51130> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.12/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                │ │
│ │             0x7f006ca50bf0>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f006ca52ab0>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006ca51130>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca51130>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006ca50bf0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca51130>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006ca50bf0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
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 10:00:53 [debug    ] patching                       attempt=3 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 10:00:53 [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 0x7f006ca53ce0>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f006ca52c60> 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 @ 0x7f006bb0e3b0>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f006ca53ce0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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 0x7f006ca53ce0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006d193020>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f006ca53ce0>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006d193020>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f006d1ec820>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f006ca53ce0>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca53ce0>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca53ce0>        │          │
│ │     start = 161.411765947                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006ca51130> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.12/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                │ │
│ │             0x7f006ca50bf0>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f006ca52ab0>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006ca51130>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca51130>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006ca50bf0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca51130>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006ca50bf0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
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 10:00:54 [debug    ] patching                       attempt=4 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 10:00: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 0x7f006ca53ce0>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f006ca52c60> 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 @ 0x7f006bb0e3b0>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f006ca53ce0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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 0x7f006ca53ce0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cb9a720>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f006ca53ce0>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cb9a720>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f006cae25e0>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f006ca53ce0>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca53ce0>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca53ce0>        │          │
│ │     start = 162.63447043                                        │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006ca51130> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.12/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                │ │
│ │             0x7f006ca50bf0>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f006ca52ab0>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006ca51130>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca51130>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006ca50bf0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca51130>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006ca50bf0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
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

________________ ERROR at teardown of test_upload_data_no_error ________________

monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7f006bdcb650>
request = <SubRequest 'httpx_mock' for <Coroutine test_upload_data_no_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.12/site-packages/pytest_httpx/__init__.py:67: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

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

    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
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 0x7f006bea3e00>]

/usr/local/lib/python3.12/site-packages/pytest_httpx/_httpx_mock.py:319: AssertionError
_______________ ERROR at teardown of test_upload_data_req_error ________________

monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7f006ca4ca40>
request = <SubRequest 'httpx_mock' for <Coroutine test_upload_data_req_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.12/site-packages/pytest_httpx/__init__.py:67: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

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

    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
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 0x7f006ca4cc50>]

/usr/local/lib/python3.12/site-packages/pytest_httpx/_httpx_mock.py:319: AssertionError
=================================== FAILURES ===================================
_________________________ test_upload_chunked_timeout __________________________

client = <httpx.AsyncClient object at 0x7f006cafcbf0>
uri = 'http://example.org/upload'
data = <aiofiles.threadpool.binary.AsyncBufferedReader object at 0x7f006cd876e0> 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 @ 0x7f006cbfe3b0>
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.12/site-packages/httpx/_client.py:1933: in patch
    return await self.request(
/usr/local/lib/python3.12/site-packages/httpx/_client.py:1540: in request
    return await self.send(request, auth=auth, follow_redirects=follow_redirects)
/usr/local/lib/python3.12/site-packages/httpx/_client.py:1629: in send
    response = await self._send_handling_auth(
/usr/local/lib/python3.12/site-packages/httpx/_client.py:1657: in _send_handling_auth
    response = await self._send_handling_redirects(
/usr/local/lib/python3.12/site-packages/httpx/_client.py:1694: in _send_handling_redirects
    response = await self._send_single_request(request)
/usr/local/lib/python3.12/site-packages/httpx/_client.py:1730: in _send_single_request
    response = await transport.handle_async_request(request)
/usr/local/lib/python3.12/site-packages/pytest_httpx/__init__.py:56: in mocked_handle_async_request
    return await mock._handle_async_request(transport, request)
/usr/local/lib/python3.12/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 0x7f006cafd5b0>
real_transport = <httpx.AsyncHTTPTransport object at 0x7f006cafe240>
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.12/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 0x7f006cafd5b0>

    @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 0x7f006cafcbf0>
uri = 'http://example.org/upload'
data = <aiofiles.threadpool.binary.AsyncBufferedReader object at 0x7f006cd876e0> 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 @ 0x7f006cbfe3b0>
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 0x7f006cafd5b0>

    @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 10:00:26 [debug    ] patching                       attempt=0 content_range=<ContentRange 'bytes 0-524287/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 10:00:26 [debug    ] patch result                   result=<Response [200 OK]>
2025-01-02 10:00:26 [debug    ] patching                       attempt=0 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 10:00:26 [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 0x7f006cafcbf0>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f006cd876e0> 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 @ 0x7f006cbfe3b0>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f006cafcbf0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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 0x7f006cafcbf0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cc041d0>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f006cafcbf0>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cc041d0>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f006cb2f920>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f006cafcbf0>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cafcbf0>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cafcbf0>        │          │
│ │     start = 134.330108591                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006cafe240> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.12/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                │ │
│ │             0x7f006cafd5b0>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f006cafcfe0>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006cafe240>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cafe240>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006cafd5b0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cafe240>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006cafd5b0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
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 10:00:27 [debug    ] patching                       attempt=1 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 10:00:27 [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 0x7f006cafcbf0>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f006cd876e0> 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 @ 0x7f006cbfe3b0>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f006cafcbf0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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 0x7f006cafcbf0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006e362f30>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f006cafcbf0>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006e362f30>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f006d1efe60>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f006cafcbf0>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cafcbf0>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cafcbf0>        │          │
│ │     start = 135.652573862                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006cafe240> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.12/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                │ │
│ │             0x7f006cafd5b0>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f006cafcfe0>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006cafe240>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cafe240>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006cafd5b0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cafe240>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006cafd5b0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
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 10:00:28 [debug    ] patching                       attempt=2 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 10:00:28 [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 0x7f006cafcbf0>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f006cd876e0> 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 @ 0x7f006cbfe3b0>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f006cafcbf0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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 0x7f006cafcbf0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cc073b0>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f006cafcbf0>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cc073b0>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f006d1ec3c0>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f006cafcbf0>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cafcbf0>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cafcbf0>        │          │
│ │     start = 136.950223703                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006cafe240> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.12/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                │ │
│ │             0x7f006cafd5b0>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f006cafcfe0>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006cafe240>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cafe240>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006cafd5b0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cafe240>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006cafd5b0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
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 10:00:30 [debug    ] patching                       attempt=3 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 10:00:30 [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 0x7f006cafcbf0>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f006cd876e0> 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 @ 0x7f006cbfe3b0>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f006cafcbf0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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 0x7f006cafcbf0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006d3dc740>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f006cafcbf0>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006d3dc740>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f006d1ec120>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f006cafcbf0>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cafcbf0>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cafcbf0>        │          │
│ │     start = 138.287907795                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006cafe240> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.12/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                │ │
│ │             0x7f006cafd5b0>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f006cafcfe0>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006cafe240>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cafe240>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006cafd5b0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cafe240>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006cafd5b0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
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 10:00:31 [debug    ] patching                       attempt=4 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 10:00:31 [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 0x7f006cafcbf0>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f006cd876e0> 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 @ 0x7f006cbfe3b0>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f006cafcbf0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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 0x7f006cafcbf0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cb710a0>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f006cafcbf0>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cb710a0>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f006d1ec2e0>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f006cafcbf0>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cafcbf0>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cafcbf0>        │          │
│ │     start = 139.613202971                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006cafe240> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.12/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                │ │
│ │             0x7f006cafd5b0>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f006cafcfe0>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006cafe240>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cafe240>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006cafd5b0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cafe240>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006cafd5b0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
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 0x7f006ca469c0>
uri = 'http://example.org/upload'
data = <aiofiles.threadpool.binary.AsyncBufferedReader object at 0x7f006cafef60> 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 @ 0x7f006bde50b0>
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.12/site-packages/httpx/_client.py:1933: in patch
    return await self.request(
/usr/local/lib/python3.12/site-packages/httpx/_client.py:1540: in request
    return await self.send(request, auth=auth, follow_redirects=follow_redirects)
/usr/local/lib/python3.12/site-packages/httpx/_client.py:1629: in send
    response = await self._send_handling_auth(
/usr/local/lib/python3.12/site-packages/httpx/_client.py:1657: in _send_handling_auth
    response = await self._send_handling_redirects(
/usr/local/lib/python3.12/site-packages/httpx/_client.py:1694: in _send_handling_redirects
    response = await self._send_single_request(request)
/usr/local/lib/python3.12/site-packages/httpx/_client.py:1730: in _send_single_request
    response = await transport.handle_async_request(request)
/usr/local/lib/python3.12/site-packages/pytest_httpx/__init__.py:56: in mocked_handle_async_request
    return await mock._handle_async_request(transport, request)
/usr/local/lib/python3.12/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 0x7f006cafe3c0>
real_transport = <httpx.AsyncHTTPTransport object at 0x7f006ca44680>
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.12/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 0x7f006cafe3c0>

    @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 0x7f006ca469c0>
uri = 'http://example.org/upload'
data = <aiofiles.threadpool.binary.AsyncBufferedReader object at 0x7f006cafef60> 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 @ 0x7f006bde50b0>
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 0x7f006cafe3c0>

    @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 10:00:33 [debug    ] patching                       attempt=0 content_range=<ContentRange 'bytes 0-524287/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 10:00:33 [debug    ] patch result                   result=<Response [200 OK]>
2025-01-02 10:00:33 [debug    ] patching                       attempt=0 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 10:00:33 [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 0x7f006ca469c0>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f006cafef60> 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 @ 0x7f006bde50b0>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f006ca469c0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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 0x7f006ca469c0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca44290>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f006ca469c0>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca44290>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f006ca025e0>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f006ca469c0>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca469c0>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca469c0>        │          │
│ │     start = 141.773685059                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006ca44680> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.12/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                │ │
│ │             0x7f006cafe3c0>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f006cafda30>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006ca44680>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca44680>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006cafe3c0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca44680>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006cafe3c0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
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 10:00:35 [debug    ] patching                       attempt=1 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 10:00:35 [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 0x7f006ca469c0>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f006cafef60> 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 @ 0x7f006bde50b0>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f006ca469c0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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 0x7f006ca469c0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cf080e0>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f006ca469c0>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cf080e0>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f006cae25e0>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f006ca469c0>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca469c0>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca469c0>        │          │
│ │     start = 143.330463554                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006ca44680> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.12/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                │ │
│ │             0x7f006cafe3c0>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f006cafda30>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006ca44680>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca44680>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006cafe3c0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca44680>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006cafe3c0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
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 10:00:36 [debug    ] patching                       attempt=2 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 10:00:36 [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 0x7f006ca469c0>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f006cafef60> 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 @ 0x7f006bde50b0>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f006ca469c0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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 0x7f006ca469c0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cd46570>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f006ca469c0>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cd46570>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f006ca02960>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f006ca469c0>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca469c0>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca469c0>        │          │
│ │     start = 144.736432973                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006ca44680> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.12/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                │ │
│ │             0x7f006cafe3c0>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f006cafda30>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006ca44680>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca44680>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006cafe3c0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca44680>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006cafe3c0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
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 10:00:37 [debug    ] patching                       attempt=3 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 10:00:37 [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 0x7f006ca469c0>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f006cafef60> 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 @ 0x7f006bde50b0>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f006ca469c0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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 0x7f006ca469c0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006d275160>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f006ca469c0>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006d275160>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f006ca03060>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f006ca469c0>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca469c0>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca469c0>        │          │
│ │     start = 146.021906157                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006ca44680> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.12/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                │ │
│ │             0x7f006cafe3c0>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f006cafda30>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006ca44680>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca44680>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006cafe3c0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca44680>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006cafe3c0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
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 10:00:39 [debug    ] patching                       attempt=4 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 10:00:39 [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 0x7f006ca469c0>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f006cafef60> 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 @ 0x7f006bde50b0>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f006ca469c0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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 0x7f006ca469c0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cacb020>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f006ca469c0>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cacb020>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f006cae25e0>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f006ca469c0>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca469c0>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca469c0>        │          │
│ │     start = 147.465831852                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006ca44680> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.12/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                │ │
│ │             0x7f006cafe3c0>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f006cafda30>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006ca44680>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca44680>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006cafe3c0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca44680>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006cafe3c0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
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 0x7f006ca44a10>
uri = 'http://example.org/upload'
data = <aiofiles.threadpool.binary.AsyncBufferedReader object at 0x7f006caff290> 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 @ 0x7f006bde68f0>
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.12/site-packages/httpx/_client.py:1933: in patch
    return await self.request(
/usr/local/lib/python3.12/site-packages/httpx/_client.py:1540: in request
    return await self.send(request, auth=auth, follow_redirects=follow_redirects)
/usr/local/lib/python3.12/site-packages/httpx/_client.py:1629: in send
    response = await self._send_handling_auth(
/usr/local/lib/python3.12/site-packages/httpx/_client.py:1657: in _send_handling_auth
    response = await self._send_handling_redirects(
/usr/local/lib/python3.12/site-packages/httpx/_client.py:1694: in _send_handling_redirects
    response = await self._send_single_request(request)
/usr/local/lib/python3.12/site-packages/httpx/_client.py:1730: in _send_single_request
    response = await transport.handle_async_request(request)
/usr/local/lib/python3.12/site-packages/pytest_httpx/__init__.py:56: in mocked_handle_async_request
    return await mock._handle_async_request(transport, request)
/usr/local/lib/python3.12/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 0x7f006cafcb30>
real_transport = <httpx.AsyncHTTPTransport object at 0x7f006ca45e80>
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.12/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 0x7f006cafcb30>

    @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 0x7f006ca44a10>
uri = 'http://example.org/upload'
data = <aiofiles.threadpool.binary.AsyncBufferedReader object at 0x7f006caff290> 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 @ 0x7f006bde68f0>
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 0x7f006cafcb30>

    @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 10:00:40 [debug    ] patching                       attempt=0 content_range=<ContentRange 'bytes 0-524287/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 10:00:40 [debug    ] patch result                   result=<Response [200 OK]>
2025-01-02 10:00:40 [debug    ] patching                       attempt=0 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 10:00:40 [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 0x7f006ca44a10>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f006caff290> 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 @ 0x7f006bde68f0>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f006ca44a10>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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 0x7f006ca44a10>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca470b0>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f006ca44a10>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca470b0>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f006cb2e880>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f006ca44a10>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca44a10>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca44a10>        │          │
│ │     start = 148.950287045                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006ca45e80> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.12/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                │ │
│ │             0x7f006cafcb30>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f006cafd8b0>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006ca45e80>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca45e80>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006cafcb30>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca45e80>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006cafcb30>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
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 10:00:42 [debug    ] patching                       attempt=1 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 10:00:42 [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 0x7f006ca44a10>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f006caff290> 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 @ 0x7f006bde68f0>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f006ca44a10>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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 0x7f006ca44a10>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006d2dc950>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f006ca44a10>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006d2dc950>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f006cae25e0>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f006ca44a10>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca44a10>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca44a10>        │          │
│ │     start = 150.382753404                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006ca45e80> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.12/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                │ │
│ │             0x7f006cafcb30>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f006cafd8b0>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006ca45e80>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca45e80>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006cafcb30>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca45e80>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006cafcb30>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
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 10:00:43 [debug    ] patching                       attempt=2 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 10:00:43 [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 0x7f006ca44a10>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f006caff290> 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 @ 0x7f006bde68f0>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f006ca44a10>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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 0x7f006ca44a10>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cc07ce0>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f006ca44a10>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cc07ce0>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f006c9ce180>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f006ca44a10>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca44a10>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca44a10>        │          │
│ │     start = 152.140619346                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006ca45e80> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.12/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                │ │
│ │             0x7f006cafcb30>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f006cafd8b0>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006ca45e80>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca45e80>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006cafcb30>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca45e80>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006cafcb30>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
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 10:00:45 [debug    ] patching                       attempt=3 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 10:00:45 [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 0x7f006ca44a10>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f006caff290> 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 @ 0x7f006bde68f0>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f006ca44a10>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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 0x7f006ca44a10>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006caa75c0>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f006ca44a10>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006caa75c0>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f006cb2ec00>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f006ca44a10>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca44a10>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca44a10>        │          │
│ │     start = 154.190322732                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006ca45e80> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.12/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                │ │
│ │             0x7f006cafcb30>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f006cafd8b0>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006ca45e80>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca45e80>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006cafcb30>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca45e80>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006cafcb30>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
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 10:00:47 [debug    ] patching                       attempt=4 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 10:00: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 0x7f006ca44a10>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f006caff290> 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 @ 0x7f006bde68f0>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f006ca44a10>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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 0x7f006ca44a10>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006d2dc950>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f006ca44a10>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006d2dc950>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f006cae25e0>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f006ca44a10>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca44a10>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca44a10>        │          │
│ │     start = 156.078819092                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006ca45e80> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.12/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                │ │
│ │             0x7f006cafcb30>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f006cafd8b0>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006ca45e80>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca45e80>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006cafcb30>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca45e80>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006cafcb30>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
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 0x7f006ca53ce0>
uri = 'http://example.org/upload'
data = <aiofiles.threadpool.binary.AsyncBufferedReader object at 0x7f006ca52c60> 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 @ 0x7f006bb0e3b0>
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.12/site-packages/httpx/_client.py:1933: in patch
    return await self.request(
/usr/local/lib/python3.12/site-packages/httpx/_client.py:1540: in request
    return await self.send(request, auth=auth, follow_redirects=follow_redirects)
/usr/local/lib/python3.12/site-packages/httpx/_client.py:1629: in send
    response = await self._send_handling_auth(
/usr/local/lib/python3.12/site-packages/httpx/_client.py:1657: in _send_handling_auth
    response = await self._send_handling_redirects(
/usr/local/lib/python3.12/site-packages/httpx/_client.py:1694: in _send_handling_redirects
    response = await self._send_single_request(request)
/usr/local/lib/python3.12/site-packages/httpx/_client.py:1730: in _send_single_request
    response = await transport.handle_async_request(request)
/usr/local/lib/python3.12/site-packages/pytest_httpx/__init__.py:56: in mocked_handle_async_request
    return await mock._handle_async_request(transport, request)
/usr/local/lib/python3.12/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 0x7f006ca50bf0>
real_transport = <httpx.AsyncHTTPTransport object at 0x7f006ca51130>
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.12/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 0x7f006ca50bf0>

    @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 0x7f006ca53ce0>
uri = 'http://example.org/upload'
data = <aiofiles.threadpool.binary.AsyncBufferedReader object at 0x7f006ca52c60> 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 @ 0x7f006bb0e3b0>
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 0x7f006cafe270>
typ = <class 'obs_proxy.chunked_uploads.client.ChunkedUploadError'>
value = ChunkedUploadError(content_range=<ContentRange 'bytes 524288-1048575/4194304'>, attempt=4)
traceback = <traceback object at 0x7f006cb39880>

    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(value)
            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.12/contextlib.py:191: FrozenInstanceError
----------------------------- Captured stdout call -----------------------------
2025-01-02 10:00:49 [debug    ] patching                       attempt=0 content_range=<ContentRange 'bytes 0-524287/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 10:00:49 [debug    ] patch result                   result=<Response [200 OK]>
2025-01-02 10:00:49 [debug    ] patching                       attempt=0 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 10:00: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 0x7f006ca53ce0>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f006ca52c60> 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 @ 0x7f006bb0e3b0>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f006ca53ce0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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 0x7f006ca53ce0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006c996cf0>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f006ca53ce0>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006c996cf0>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f006ca01a80>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f006ca53ce0>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca53ce0>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca53ce0>        │          │
│ │     start = 157.552867777                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006ca51130> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.12/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                │ │
│ │             0x7f006ca50bf0>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f006ca52ab0>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006ca51130>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca51130>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006ca50bf0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca51130>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006ca50bf0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
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 10:00:50 [debug    ] patching                       attempt=1 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 10:00: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 0x7f006ca53ce0>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f006ca52c60> 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 @ 0x7f006bb0e3b0>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f006ca53ce0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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 0x7f006ca53ce0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cf944a0>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f006ca53ce0>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cf944a0>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f006cae25e0>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f006ca53ce0>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca53ce0>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca53ce0>        │          │
│ │     start = 158.883533377                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006ca51130> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.12/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                │ │
│ │             0x7f006ca50bf0>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f006ca52ab0>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006ca51130>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca51130>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006ca50bf0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca51130>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006ca50bf0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
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 10:00:51 [debug    ] patching                       attempt=2 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 10:00: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 0x7f006ca53ce0>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f006ca52c60> 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 @ 0x7f006bb0e3b0>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f006ca53ce0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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 0x7f006ca53ce0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006caa7440>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f006ca53ce0>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006caa7440>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f006d1ec580>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f006ca53ce0>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca53ce0>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca53ce0>        │          │
│ │     start = 160.192334751                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006ca51130> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.12/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                │ │
│ │             0x7f006ca50bf0>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f006ca52ab0>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006ca51130>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca51130>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006ca50bf0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca51130>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006ca50bf0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
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 10:00:53 [debug    ] patching                       attempt=3 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 10:00:53 [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 0x7f006ca53ce0>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f006ca52c60> 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 @ 0x7f006bb0e3b0>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f006ca53ce0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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 0x7f006ca53ce0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006d193020>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f006ca53ce0>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006d193020>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f006d1ec820>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f006ca53ce0>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca53ce0>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca53ce0>        │          │
│ │     start = 161.411765947                                       │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006ca51130> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.12/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                │ │
│ │             0x7f006ca50bf0>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f006ca52ab0>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006ca51130>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca51130>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006ca50bf0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca51130>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006ca50bf0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
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 10:00:54 [debug    ] patching                       attempt=4 content_range=<ContentRange 'bytes 524288-1048575/4194304'> size=524288 uri=http://example.org/upload
2025-01-02 10:00: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 0x7f006ca53ce0>             │ │
│ │ content_range = <ContentRange 'bytes 524288-1048575/4194304'>            │ │
│ │          data = <aiofiles.threadpool.binary.AsyncBufferedReader object   │ │
│ │                 at 0x7f006ca52c60> 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 @ 0x7f006bb0e3b0>              │ │
│ │       headers = {}                                                       │ │
│ │            kv = {}                                                       │ │
│ │        offset = 524288                                                   │ │
│ │           pos = 1048576                                                  │ │
│ │             r = <Response [200 OK]>                                      │ │
│ │          size = 4194304                                                  │ │
│ │           uri = 'http://example.org/upload'                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          headers = {                                                     │ │
│ │                    │   'Patch-Content-Range': 'bytes                     │ │
│ │                    524288-1048575/4194304',                              │ │
│ │                    │   'Content-Length': '524288'                        │ │
│ │                    }                                                     │ │
│ │             json = None                                                  │ │
│ │           params = None                                                  │ │
│ │             self = <httpx.AsyncClient object at 0x7f006ca53ce0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │          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 0x7f006ca53ce0>          │ │
│ │          timeout = <httpx._client.UseClientDefault object at             │ │
│ │                    0x7f006e389e80>                                       │ │
│ │              url = 'http://example.org/upload'                           │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cb9a720>           │       │
│ │ follow_redirects = False                                           │       │
│ │          request = <Request('PATCH', 'http://example.org/upload')> │       │
│ │             self = <httpx.AsyncClient object at 0x7f006ca53ce0>    │       │
│ │           stream = False                                           │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006cb9a720>                 │ │
│ │        auth_flow = <async_generator object Auth.async_auth_flow at       │ │
│ │                    0x7f006cae25e0>                                       │ │
│ │ follow_redirects = False                                                 │ │
│ │          history = []                                                    │ │
│ │          request = <Request('PATCH', 'http://example.org/upload')>       │ │
│ │             self = <httpx.AsyncClient object at 0x7f006ca53ce0>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca53ce0>    │       │
│ ╰────────────────────────────────────────────────────────────────────╯       │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca53ce0>        │          │
│ │     start = 162.63447043                                        │          │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006ca51130> │          │
│ ╰─────────────────────────────────────────────────────────────────╯          │
│                                                                              │
│ /usr/local/lib/python3.12/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                │ │
│ │             0x7f006ca50bf0>                                              │ │
│ │   options = <pytest_httpx._options._HTTPXMockOptions object at           │ │
│ │             0x7f006ca52ab0>                                              │ │
│ │   request = <Request('PATCH', 'http://example.org/upload')>              │ │
│ │ transport = <httpx.AsyncHTTPTransport object at 0x7f006ca51130>          │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca51130>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006ca50bf0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ /usr/local/lib/python3.12/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 0x7f006ca51130>     │ │
│ │        request = <Request('PATCH', 'http://example.org/upload')>         │ │
│ │           self = <pytest_httpx._httpx_mock.HTTPXMock object at           │ │
│ │                  0x7f006ca50bf0>                                         │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
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

__________________________ test_upload_data_no_error ___________________________

mockrequest = <quart.ctx.RequestContext object at 0x7f006bdc8860>
caplog = <_pytest.logging.LogCaptureFixture object at 0x7f006bea1670>
httpx_mock = <pytest_httpx._httpx_mock.HTTPXMock object at 0x7f006bea3b30>

    @pytest.mark.asyncio
    async def test_upload_data_no_error(mockrequest, caplog, httpx_mock: HTTPXMock):
        httpx_mock.add_response()
    
        async with httpx.AsyncClient() as client:
            async with mockrequest:
>               resp = await utils.upload_data(
                    client, 'http://127.0.0.1/putjob', buffer=True,
                )

tests/upload/test_upload.py:53: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
obs_proxy/utils.py:252: in upload_data
    async with NamedTemporaryFile(delete=False) as tmpfile:
/usr/local/lib/python3.12/site-packages/aiofiles/base.py:78: in __aenter__
    self._obj = await self._coro
/usr/local/lib/python3.12/site-packages/aiofiles/tempfile/__init__.py:177: in _temporary_file
    result.delete = f.delete
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <tempfile._TemporaryFileWrapper object at 0x7f006bdc95b0>
name = 'delete'

    def __getattr__(self, name):
        # Attribute lookups are delegated to the underlying file
        # and cached for non-numeric results
        # (i.e. methods are cached, closed and friends are not)
        file = self.__dict__['file']
>       a = getattr(file, name)
E       AttributeError: '_io.BufferedRandom' object has no attribute 'delete'

/usr/local/lib/python3.12/tempfile.py:494: AttributeError
__________________________ test_upload_data_req_error __________________________

mockrequest = <quart.ctx.RequestContext object at 0x7f006ca4d2e0>
caplog = <_pytest.logging.LogCaptureFixture object at 0x7f006ca4e600>
httpx_mock = <pytest_httpx._httpx_mock.HTTPXMock object at 0x7f006ca4fe00>

    @pytest.mark.asyncio
    async def test_upload_data_req_error(mockrequest, caplog, httpx_mock: HTTPXMock):
        httpx_mock.add_exception(httpx.ReadTimeout("Unable to read within timeout"))
    
        async with httpx.AsyncClient() as client:
            async with mockrequest:
                with pytest.raises(httpx.ReadTimeout):
>                   await utils.upload_data(
                        client, 'http://127.0.0.1/putjob', buffer=True,
                    )

tests/upload/test_upload.py:70: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
obs_proxy/utils.py:252: in upload_data
    async with NamedTemporaryFile(delete=False) as tmpfile:
/usr/local/lib/python3.12/site-packages/aiofiles/base.py:78: in __aenter__
    self._obj = await self._coro
/usr/local/lib/python3.12/site-packages/aiofiles/tempfile/__init__.py:177: in _temporary_file
    result.delete = f.delete
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <tempfile._TemporaryFileWrapper object at 0x7f006ca4c230>
name = 'delete'

    def __getattr__(self, name):
        # Attribute lookups are delegated to the underlying file
        # and cached for non-numeric results
        # (i.e. methods are cached, closed and friends are not)
        file = self.__dict__['file']
>       a = getattr(file, name)
E       AttributeError: '_io.BufferedRandom' object has no attribute 'delete'

/usr/local/lib/python3.12/tempfile.py:494: AttributeError
__________________________ test_five_gigazero_upload ___________________________

    @contextlib.contextmanager
    def map_httpcore_exceptions() -> typing.Iterator[None]:
        global HTTPCORE_EXC_MAP
        if len(HTTPCORE_EXC_MAP) == 0:
            HTTPCORE_EXC_MAP = _load_httpcore_exceptions()
        try:
>           yield

/usr/local/lib/python3.12/site-packages/httpx/_transports/default.py:101: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/local/lib/python3.12/site-packages/httpx/_transports/default.py:394: in handle_async_request
    resp = await self._pool.handle_async_request(req)
/usr/local/lib/python3.12/site-packages/httpcore/_async/connection_pool.py:256: in handle_async_request
    raise exc from None
/usr/local/lib/python3.12/site-packages/httpcore/_async/connection_pool.py:236: in handle_async_request
    response = await connection.handle_async_request(
/usr/local/lib/python3.12/site-packages/httpcore/_async/connection.py:103: in handle_async_request
    return await self._connection.handle_async_request(request)
/usr/local/lib/python3.12/site-packages/httpcore/_async/http11.py:136: in handle_async_request
    raise exc
/usr/local/lib/python3.12/site-packages/httpcore/_async/http11.py:106: in handle_async_request
    ) = await self._receive_response_headers(**kwargs)
/usr/local/lib/python3.12/site-packages/httpcore/_async/http11.py:177: in _receive_response_headers
    event = await self._receive_event(timeout=timeout)
/usr/local/lib/python3.12/site-packages/httpcore/_async/http11.py:217: in _receive_event
    data = await self._network_stream.read(
/usr/local/lib/python3.12/site-packages/httpcore/_backends/anyio.py:32: in read
    with map_exceptions(exc_map):
/usr/local/lib/python3.12/contextlib.py:158: in __exit__
    self.gen.throw(value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

map = {<class 'TimeoutError'>: <class 'httpcore.ReadTimeout'>, <class 'anyio.BrokenResourceError'>: <class 'httpcore.ReadErr... 'anyio.ClosedResourceError'>: <class 'httpcore.ReadError'>, <class 'anyio.EndOfStream'>: <class 'httpcore.ReadError'>}

    @contextlib.contextmanager
    def map_exceptions(map: ExceptionMapping) -> typing.Iterator[None]:
        try:
            yield
        except Exception as exc:  # noqa: PIE786
            for from_exc, to_exc in map.items():
                if isinstance(exc, from_exc):
>                   raise to_exc(exc) from exc
E                   httpcore.ReadError

/usr/local/lib/python3.12/site-packages/httpcore/_exceptions.py:14: ReadError

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

app_testbed = MockConfig(server_port=47469, client_port=41771, worker_port=40185, mock_backend_port=49937)
tmp_path = PosixPath('/tmp/pytest-of-root/pytest-0/test_five_gigazero_upload0')

    @pytest.mark.asyncio
    async def test_five_gigazero_upload(app_testbed, tmp_path):
        client_base = f"http://127.0.0.1:{app_testbed.client_port}"
        async with httpx.AsyncClient(timeout=5 * 60) as client:
            await client.post(
                f"{client_base}/worker",
                content=mock_worker,
            )
    
            fivegig = tmp_path / "fivegig"
    
            async with aiofiles.open(fivegig, "wb") as f:
                await f.truncate(5 * 1024 * 1024 * 1024)
    
            size = await file_size(fivegig)
    
            async with aiofiles.open(fivegig, "rb") as f:
>               await upload_file(
                    client,
                    f"{client_base}/repserver/worker:1/putjob",
                    file=f,
                    params={
                        'jobid': '62d106cb98d80ec44b18691e6bb5b487',
                    },
                    headers={
                        "content-length": str(size),
                    },
                )

tests/upload/test_upload_five_gigazeroes.py:55: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
obs_proxy/utils.py:333: in upload_file
    return await client.post(
/usr/local/lib/python3.12/site-packages/httpx/_client.py:1859: in post
    return await self.request(
/usr/local/lib/python3.12/site-packages/httpx/_client.py:1540: in request
    return await self.send(request, auth=auth, follow_redirects=follow_redirects)
/usr/local/lib/python3.12/site-packages/httpx/_client.py:1629: in send
    response = await self._send_handling_auth(
/usr/local/lib/python3.12/site-packages/httpx/_client.py:1657: in _send_handling_auth
    response = await self._send_handling_redirects(
/usr/local/lib/python3.12/site-packages/httpx/_client.py:1694: in _send_handling_redirects
    response = await self._send_single_request(request)
/usr/local/lib/python3.12/site-packages/httpx/_client.py:1730: in _send_single_request
    response = await transport.handle_async_request(request)
/usr/local/lib/python3.12/site-packages/httpx/_transports/default.py:393: in handle_async_request
    with map_httpcore_exceptions():
/usr/local/lib/python3.12/contextlib.py:158: in __exit__
    self.gen.throw(value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

    @contextlib.contextmanager
    def map_httpcore_exceptions() -> typing.Iterator[None]:
        global HTTPCORE_EXC_MAP
        if len(HTTPCORE_EXC_MAP) == 0:
            HTTPCORE_EXC_MAP = _load_httpcore_exceptions()
        try:
            yield
        except Exception as exc:
            mapped_exc = None
    
            for from_exc, to_exc in HTTPCORE_EXC_MAP.items():
                if not isinstance(exc, from_exc):
                    continue
                # We want to map to the most specific exception we can find.
                # Eg if `exc` is an `httpcore.ReadTimeout`, we want to map to
                # `httpx.ReadTimeout`, not just `httpx.TimeoutException`.
                if mapped_exc is None or issubclass(to_exc, mapped_exc):
                    mapped_exc = to_exc
    
            if mapped_exc is None:  # pragma: no cover
                raise
    
            message = str(exc)
>           raise mapped_exc(message) from exc
E           httpx.ReadError

/usr/local/lib/python3.12/site-packages/httpx/_transports/default.py:118: ReadError
---------------------------- Captured stdout setup -----------------------------
mock_config = MockConfig(server_port=47469, client_port=41771, worker_port=40185, mock_backend_port=49937)
obs_proxy.client: /builds/infrastructure/obs-proxy/obs_proxy/client.py:36: DeprecationWarning: There is no current event loop
obs_proxy.client:   loop = asyncio.get_event_loop()
obs_proxy.client: timestamp=2025-01-02T10:01:04Z event="Using selector: EpollSelector" level=debug logger=asyncio
obs_proxy.client: timestamp=2025-01-02T10:01:04Z event="Waiting for the worker to connect" level=info func_name=wsclient logger=obs_proxy.wsclient
obs_proxy.server: timestamp=2025-01-02T10:01:05Z event="Using disk cache: /var/cache/obs-proxy/port_cache" level=info func_name=run logger=__main__
obs_proxy.server: timestamp=2025-01-02T10:01:05Z event="Proxying for srcserver http://127.0.0.1:49937 and repserver http://127.0.0.1:49937" level=info func_name=run logger=__main__
obs_proxy.server: /builds/infrastructure/obs-proxy/obs_proxy/server.py:700: DeprecationWarning: There is no current event loop
obs_proxy.server:   loop = asyncio.get_event_loop()
obs_proxy.server: timestamp=2025-01-02T10:01:05Z event="Using selector: EpollSelector" level=debug logger=asyncio
obs_proxy.server: timestamp=2025-01-02T10:01:05Z event="Will listen on worker ports 40185 to 40185" level=info func_name=run logger=__main__
----------------------------- Captured stderr call -----------------------------
[2025-01-02 10:01:06 +0000] [38] [INFO] Running on http://127.0.0.1:49937 (CTRL + C to quit)
------------------------------ Captured log call -------------------------------
INFO     hypercorn.error:logging.py:106 Running on http://127.0.0.1:49937 (CTRL + C to quit)
--------------------------- Captured stdout teardown ---------------------------
{'_charset': 'utf-8', '_encoding_errors': 'replace', '_url_charset': 'utf-8', 'method': 'POST', 'scheme': 'http', 'server': ('127.0.0.1', 49937), 'root_path': '', 'path': '/worker', 'query_string': b'state=&arch=armv8l&port=40185&workerid=worker%3A1', 'headers': Headers([('Remote-Addr', '127.0.0.1'), ('Host', '127.0.0.1:49937'), ('Accept', '*/*'), ('Accept-Encoding', 'gzip, deflate'), ('Connection', 'keep-alive'), ('User-Agent', 'python-httpx/0.28.1'), ('Content-Length', '278')]), 'remote_addr': '127.0.0.1', 'http_version': '1.1', 'scope': {'type': 'http', 'http_version': '1.1', 'asgi': {'spec_version': '2.1', 'version': '3.0'}, 'method': 'POST', 'scheme': 'http', 'path': '/worker', 'raw_path': b'/worker', 'query_string': b'state=&arch=armv8l&port=40185&workerid=worker%3A1', 'root_path': '', 'headers': [(b'host', b'127.0.0.1:49937'), (b'accept', b'*/*'), (b'accept-encoding', b'gzip, deflate'), (b'connection', b'keep-alive'), (b'user-agent', b'python-httpx/0.28.1'), (b'content-length', b'278')], 'client': ('127.0.0.1', 46374), 'server': ('127.0.0.1', 49937), 'state': {}, 'extensions': {}}, 'body_timeout': 60, 'content_length': 278, 'body': <quart.wrappers.request.Body object at 0x7f006bea0590>, '_cached_json': {False: Ellipsis, True: Ellipsis}, '_form': None, '_files': None, '_parsing_lock': <asyncio.locks.Lock object at 0x7f006bea2f60 [unlocked]>, '_send_push_promise': functools.partial(<bound method ASGIHTTPConnection._send_push_promise of <quart.asgi.ASGIHTTPConnection object at 0x7f006bea0920>>, <bound method HTTPStream.app_send of <hypercorn.protocol.http_stream.HTTPStream object at 0x7f006bea2330>>), 'host': '127.0.0.1:49937', 'routing_exception': None, 'json_module': <quart.json.provider.DefaultJSONProvider object at 0x7f006ca4eb40>, 'url_rule': <QuartRule '/<path>' (PUT, POST, OPTIONS, HEAD, GET) -> consume>, 'view_args': {'path': 'worker'}}
.
Consumed 278 bytes.
[2025-01-02 10:01:06 +0000] [38] [INFO] 127.0.0.1:46374 POST /worker 1.1 200 2 1307
obs_proxy.server: timestamp=2025-01-02T10:01:06Z event="(o) worker:1 online" level=info func_name=worker_events_ws logger=__main__
obs_proxy.server: timestamp=2025-01-02T10:01:06Z event="... awaiting" level=info func_name=recv logger=__main__
obs_proxy.server: timestamp=2025-01-02T10:01:06Z event="127.0.0.1:40564 GET /worker/worker:1/events 1.1 101 - 5792" level=info logger=http.server
obs_proxy.server: timestamp=2025-01-02T10:01:06Z event=>>> kind=call level=info worker="{'port': 6050, 'hostarch': 'armv8l', 'ip': '127.0.0.1', 'meta': {'sandbox': 'chroot', 'linux': {'version': '4.19.0-14', 'flavor': 'arm64'}, 'hardware': {'cpu': None, 'processors': '8'}}, 'workerid': 'worker:1'}" state= worker_id=worker:1 id=() method=worker_ping func_name=recv logger=__main__
obs_proxy.server: timestamp=2025-01-02T10:01:06Z event="allocated external port" level=debug port=40185 func_name=worker_ping logger=__main__
obs_proxy.server: timestamp=2025-01-02T10:01:06Z event="updating worker state" level=info state= arch=armv8l port=40185 workerid=worker:1 func_name=post_worker_state logger=__main__
obs_proxy.server: timestamp=2025-01-02T10:01:06Z event="HTTP Request: POST http://127.0.0.1:49937/worker?state=&arch=armv8l&port=40185&workerid=worker%3A1 \"HTTP/1.1 200 \"" level=info logger=httpx
obs_proxy.server: timestamp=2025-01-02T10:01:06Z event=updated level=info code=200 reason= func_name=post_worker_state logger=__main__
obs_proxy.server: timestamp=2025-01-02T10:01:06Z event=<x- kind=call.result.unsent level=info result=ok id=() jsonrpc=2.0 func_name=recv logger=__main__
obs_proxy.server: timestamp=2025-01-02T10:01:06Z event="... awaiting" level=info func_name=recv logger=__main__
obs_proxy.server: timestamp=2025-01-02T10:01:06Z event="Received a signal, will terminate" level=info func_name=_signal_handler logger=__main__
obs_proxy.server: timestamp=2025-01-02T10:01:07Z event=Terminating. level=info func_name=_terminate logger=__main__
obs_proxy.client: timestamp=2025-01-02T10:01:06Z event="    worker data: Worker(port=6050, hostarch='armv8l', ip='127.0.0.1', meta={'sandbox': 'chroot', 'linux': {'version': '4.19.0-14', 'flavor': 'arm64'}, 'hardware': {'cpu': None, 'processors': '8'}}, workerid='worker:1')" level=info upstream=repserver http_port=41771 worker_id= func_name=worker_ping logger=obs_proxy.repserver
obs_proxy.client: timestamp=2025-01-02T10:01:06Z event="    armv8l:worker:1 unknown on 6050" level=info upstream=repserver http_port=41771 worker_id= func_name=worker_ping logger=obs_proxy.repserver
obs_proxy.client: timestamp=2025-01-02T10:01:06Z event="127.0.0.1:36666 POST /worker 1.1 200 2 4124" level=info upstream=repserver http_port=41771 worker_id= logger=http.server
obs_proxy.client: timestamp=2025-01-02T10:01:06Z event="Proxying http://127.0.0.1:47469/repserver/worker:1/putjob" level=info upstream=repserver job_id=62d106cb98d80ec44b18691e6bb5b487 http_port=41771 worker_id=worker:1 func_name=putjob logger=obs_proxy.repserver
obs_proxy.client: timestamp=2025-01-02T10:01:06Z event="Connected to ws://127.0.0.1:47469/worker/worker:1/events using WebSockets, authenticated with a token" level=info func_name=wsclient logger=obs_proxy.wsclient
obs_proxy.client: timestamp=2025-01-02T10:01:06Z event="Exception on request POST /repserver/worker:1/putjob" level=error exc_info="(<class 'AttributeError'>, AttributeError(\"'_io.BufferedRandom' object has no attribute 'delete'\"), <traceback object at 0x7ff3d9e43600>)" upstream=repserver job_id=62d106cb98d80ec44b18691e6bb5b487 http_port=41771 worker_id=worker:1 logger=obs_proxy.repserver
obs_proxy.client: timestamp=2025-01-02T10:01:06Z event="127.0.0.1:36666 POST /repserver/worker:1/putjob?jobid=62d106cb98d80ec44b18691e6bb5b487 1.1 500 265 10348" level=info upstream=repserver job_id=62d106cb98d80ec44b18691e6bb5b487 http_port=41771 worker_id=worker:1 logger=http.server
obs_proxy.client: timestamp=2025-01-02T10:01:06Z event="<<< #() [worker_ping] {worker:1}" level=info logger=root
obs_proxy.client: timestamp=2025-01-02T10:01:07Z event="Caught an exception" level=error exc_info func_name=wsclient logger=obs_proxy.wsclient
obs_proxy.client: timestamp=2025-01-02T10:01:07Z event="Waiting for 2 seconds before reconnecting" level=info func_name=wsclient logger=obs_proxy.wsclient
obs_proxy.client: timestamp=2025-01-02T10:01:07Z event="Received a signal, will terminate" level=info func_name=_signal_handler logger=__main__
obs_proxy.client: timestamp=2025-01-02T10:01:08Z event=Terminating. level=info func_name=_terminate logger=__main__
=============================== warnings summary ===============================
../../../usr/local/lib/python3.12/site-packages/quart/helpers.py:246: 2 warnings
tests/chunked_uploads/test_upload_client_server.py: 1 warning
tests/chunked_uploads/test_upload_endpoint.py: 8 warnings
tests/test_auth.py: 2 warnings
tests/upload/test_upload.py: 3 warnings
tests/upload/test_upload_five_gigazeroes.py: 2 warnings
tests/upload/test_upload_prefix.py: 2 warnings
  /usr/local/lib/python3.12/site-packages/quart/helpers.py:246: DeprecationWarning: 'pkgutil.get_loader' is deprecated and slated for removal in Python 3.14; use importlib.util.find_spec() instead
    loader = pkgutil.get_loader(module)

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: 3 warnings
tests/upload/test_upload_prefix.py: 2 warnings
  /usr/local/lib/python3.12/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__'
FAILED tests/upload/test_upload.py::test_upload_data_no_error - AttributeError: '_io.BufferedRandom' object has no attribute 'delete'
FAILED tests/upload/test_upload.py::test_upload_data_req_error - AttributeError: '_io.BufferedRandom' object has no attribute 'delete'
FAILED tests/upload/test_upload_five_gigazeroes.py::test_five_gigazero_upload - httpx.ReadError
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 0x7f006cafcb90>]
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 0x7f006ca45a00>]
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 0x7f006ca47e30>]
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 0x7f006ca53b60>]
ERROR tests/upload/test_upload.py::test_upload_data_no_error - AssertionError: The following responses are mocked but not requested:
  - Match any 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 0x7f006bea3e00>]
ERROR tests/upload/test_upload.py::test_upload_data_req_error - AssertionError: The following responses are mocked but not requested:
  - Match any 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 0x7f006ca4cc50>]
============= 7 failed, 23 passed, 47 warnings, 6 errors in 50.76s =============
section_end:1735812076:step_script
section_start:1735812076: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=3636263 responseStatus=201 Created token=glcbt-64
section_end:1735812077:upload_artifacts_on_failure
section_start:1735812077:cleanup_file_variables
Cleaning up project directory and file based variables
section_end:1735812077:cleanup_file_variables
ERROR: Job failed: exit code 1