Warning: Permanently added '2620:52:3:1:dead:beef:cafe:c1ca' (ED25519) to the list of known hosts. You can reproduce this build on your computer by running: sudo dnf install copr-rpmbuild /usr/bin/copr-rpmbuild --verbose --drop-resultdir --task-url https://copr.fedorainfracloud.org/backend/get-build-task/8458190-fedora-41-x86_64 --chroot fedora-41-x86_64 Version: 1.2 PID: 9806 Logging PID: 9807 Task: {'allow_user_ssh': False, 'appstream': False, 'background': True, 'build_id': 8458190, 'buildroot_pkgs': [], 'chroot': 'fedora-41-x86_64', 'enable_net': False, 'fedora_review': False, 'git_hash': '4d0c4e7ec6db953e57f5c82d06bb804a773f5453', 'git_repo': 'https://copr-dist-git.fedorainfracloud.org/git/torsava/automatic-obsoletes:pr:21/python-starlette', 'isolation': 'default', 'memory_reqs': 2048, 'package_name': 'python-starlette', 'package_version': '0.45.1-1', 'project_dirname': 'automatic-obsoletes:pr:21', 'project_name': 'automatic-obsoletes', 'project_owner': 'torsava', 'repo_priority': None, 'repos': [{'baseurl': 'https://download.copr.fedorainfracloud.org/results/torsava/automatic-obsoletes/fedora-41-x86_64/', 'id': 'copr_base', 'name': 'Copr repository', 'priority': None}], 'sandbox': 'torsava/automatic-obsoletes--https://src.fedoraproject.org/user/music', 'source_json': {}, 'source_type': None, 'ssh_public_keys': None, 'storage': None, 'submitter': 'https://src.fedoraproject.org/user/music', 'tags': [], 'task_id': '8458190-fedora-41-x86_64', 'timeout': 18000, 'uses_devel_repo': False, 'with_opts': [], 'without_opts': []} Running: git clone https://copr-dist-git.fedorainfracloud.org/git/torsava/automatic-obsoletes:pr:21/python-starlette /var/lib/copr-rpmbuild/workspace/workdir-plcfsrp9/python-starlette --depth 500 --no-single-branch --recursive cmd: ['git', 'clone', 'https://copr-dist-git.fedorainfracloud.org/git/torsava/automatic-obsoletes:pr:21/python-starlette', '/var/lib/copr-rpmbuild/workspace/workdir-plcfsrp9/python-starlette', '--depth', '500', '--no-single-branch', '--recursive'] cwd: . rc: 0 stdout: stderr: Cloning into '/var/lib/copr-rpmbuild/workspace/workdir-plcfsrp9/python-starlette'... Running: git checkout 4d0c4e7ec6db953e57f5c82d06bb804a773f5453 -- cmd: ['git', 'checkout', '4d0c4e7ec6db953e57f5c82d06bb804a773f5453', '--'] cwd: /var/lib/copr-rpmbuild/workspace/workdir-plcfsrp9/python-starlette rc: 0 stdout: stderr: Note: switching to '4d0c4e7ec6db953e57f5c82d06bb804a773f5453'. You are in 'detached HEAD' state. You can look around, make experimental changes and commit them, and you can discard any commits you make in this state without impacting any branches by switching back to a branch. If you want to create a new branch to retain commits you create, you may do so (now or later) by using -c with the switch command. Example: git switch -c Or undo this operation with: git switch - Turn off this advice by setting config variable advice.detachedHead to false HEAD is now at 4d0c4e7 automatic import of python-starlette Running: dist-git-client sources /usr/bin/tail: /var/lib/copr-rpmbuild/main.log: file truncated cmd: ['dist-git-client', 'sources'] cwd: /var/lib/copr-rpmbuild/workspace/workdir-plcfsrp9/python-starlette rc: 0 stdout: stderr: INFO: Reading stdout from command: git rev-parse --abbrev-ref HEAD INFO: Reading stdout from command: git rev-parse HEAD INFO: Reading sources specification file: sources INFO: Downloading starlette-0.45.1.tar.gz INFO: Reading stdout from command: curl --help all INFO: Calling: curl -H Pragma: -o starlette-0.45.1.tar.gz --location --connect-timeout 60 --retry 3 --retry-delay 10 --remote-time --show-error --fail --retry-all-errors https://copr-dist-git.fedorainfracloud.org/repo/pkgs/torsava/automatic-obsoletes:pr:21/python-starlette/starlette-0.45.1.tar.gz/md5/0731c71f6ddff1dd150e5a67d15ef79d/starlette-0.45.1.tar.gz % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 2513k 100 2513k 0 0 19.4M 0 --:--:-- --:--:-- --:--:-- 19.4M INFO: Reading stdout from command: md5sum starlette-0.45.1.tar.gz Running (timeout=18000): unbuffer mock --spec /var/lib/copr-rpmbuild/workspace/workdir-plcfsrp9/python-starlette/python-starlette.spec --sources /var/lib/copr-rpmbuild/workspace/workdir-plcfsrp9/python-starlette --resultdir /var/lib/copr-rpmbuild/results --uniqueext 1735650614.339304 -r /var/lib/copr-rpmbuild/results/configs/child.cfg INFO: mock.py version 6.0 starting (python version = 3.13.0, NVR = mock-6.0-1.fc41), args: /usr/libexec/mock/mock --spec /var/lib/copr-rpmbuild/workspace/workdir-plcfsrp9/python-starlette/python-starlette.spec --sources /var/lib/copr-rpmbuild/workspace/workdir-plcfsrp9/python-starlette --resultdir /var/lib/copr-rpmbuild/results --uniqueext 1735650614.339304 -r /var/lib/copr-rpmbuild/results/configs/child.cfg Start(bootstrap): init plugins INFO: tmpfs initialized INFO: selinux enabled INFO: chroot_scan: initialized INFO: compress_logs: initialized Finish(bootstrap): init plugins Start: init plugins INFO: tmpfs initialized INFO: selinux enabled INFO: chroot_scan: initialized INFO: compress_logs: initialized Finish: init plugins INFO: Signal handler active Start: run INFO: Start(/var/lib/copr-rpmbuild/workspace/workdir-plcfsrp9/python-starlette/python-starlette.spec) Config(fedora-41-x86_64) Start: clean chroot Finish: clean chroot Mock Version: 6.0 INFO: Mock Version: 6.0 Start(bootstrap): chroot init INFO: mounting tmpfs at /var/lib/mock/fedora-41-x86_64-bootstrap-1735650614.339304/root. INFO: calling preinit hooks INFO: enabled root cache INFO: enabled package manager cache Start(bootstrap): cleaning package manager metadata Finish(bootstrap): cleaning package manager metadata INFO: Guessed host environment type: unknown INFO: Using container image: registry.fedoraproject.org/fedora:41 INFO: Pulling image: registry.fedoraproject.org/fedora:41 INFO: Tagging container image as mock-bootstrap-34b9b5e0-55bd-408f-aa5e-3673192969be INFO: Checking that 2aece84ed33cc03aee21fd23147b562c24a31ad2cd4a792ed9e0d914fc7a61c0 image matches host's architecture INFO: Copy content of container 2aece84ed33cc03aee21fd23147b562c24a31ad2cd4a792ed9e0d914fc7a61c0 to /var/lib/mock/fedora-41-x86_64-bootstrap-1735650614.339304/root INFO: mounting 2aece84ed33cc03aee21fd23147b562c24a31ad2cd4a792ed9e0d914fc7a61c0 with podman image mount INFO: image 2aece84ed33cc03aee21fd23147b562c24a31ad2cd4a792ed9e0d914fc7a61c0 as /var/lib/containers/storage/overlay/2da97670db15d889dac9a8c82b671c8b0fc81672c3c8f4fa4d875ff0ffed99bf/merged INFO: umounting image 2aece84ed33cc03aee21fd23147b562c24a31ad2cd4a792ed9e0d914fc7a61c0 (/var/lib/containers/storage/overlay/2da97670db15d889dac9a8c82b671c8b0fc81672c3c8f4fa4d875ff0ffed99bf/merged) with podman image umount INFO: Removing image mock-bootstrap-34b9b5e0-55bd-408f-aa5e-3673192969be INFO: Package manager dnf5 detected and used (fallback) INFO: Not updating bootstrap chroot, bootstrap_image_ready=True Start(bootstrap): creating root cache Finish(bootstrap): creating root cache Finish(bootstrap): chroot init Start: chroot init INFO: mounting tmpfs at /var/lib/mock/fedora-41-x86_64-1735650614.339304/root. INFO: calling preinit hooks INFO: enabled root cache INFO: enabled package manager cache Start: cleaning package manager metadata Finish: cleaning package manager metadata INFO: enabled HW Info plugin INFO: Package manager dnf5 detected and used (direct choice) INFO: Buildroot is handled by package management downloaded with a bootstrap image: rpm-4.20.0-1.fc41.x86_64 rpm-sequoia-1.7.0-3.fc41.x86_64 dnf5-5.2.8.1-2.fc41.x86_64 dnf5-plugins-5.2.8.1-2.fc41.x86_64 Start: installing minimal buildroot with dnf5 Updating and loading repositories: updates 100% | 4.9 MiB/s | 7.7 MiB | 00m02s fedora 100% | 16.1 MiB/s | 35.4 MiB | 00m02s Copr repository 100% | 19.3 MiB/s | 3.8 MiB | 00m00s Repositories loaded. Package Arch Version Repository Size Installing group/module packages: bash x86_64 5.2.32-1.fc41 fedora 8.2 MiB bzip2 x86_64 1.0.8-19.fc41 fedora 95.7 KiB coreutils x86_64 9.5-11.fc41 updates 5.7 MiB cpio x86_64 2.15-2.fc41 fedora 1.1 MiB diffutils x86_64 3.10-8.fc41 fedora 1.6 MiB fedora-release-common noarch 41-29 updates 19.7 KiB findutils x86_64 1:4.10.0-4.fc41 fedora 1.8 MiB gawk x86_64 5.3.0-4.fc41 fedora 1.7 MiB glibc-minimal-langpack x86_64 2.40-17.fc41 updates 0.0 B grep x86_64 3.11-9.fc41 fedora 1.0 MiB gzip x86_64 1.13-2.fc41 fedora 389.0 KiB info x86_64 7.1-3.fc41 fedora 361.8 KiB patch x86_64 2.7.6-25.fc41 fedora 266.7 KiB redhat-rpm-config noarch 293-1.fc41 fedora 183.5 KiB rpm-build x86_64 4.20.0-3.fc41 copr_base 185.8 KiB sed x86_64 4.9-3.fc41 fedora 861.5 KiB shadow-utils x86_64 2:4.15.1-12.fc41 fedora 4.1 MiB tar x86_64 2:1.35-4.fc41 fedora 2.9 MiB unzip x86_64 6.0-64.fc41 fedora 386.8 KiB util-linux x86_64 2.40.2-8.fc41 copr_base 3.6 MiB which x86_64 2.21-42.fc41 fedora 80.2 KiB xz x86_64 1:5.6.2-2.fc41 fedora 1.2 MiB Installing dependencies: add-determinism x86_64 0.3.6-3.fc41 updates 2.4 MiB alternatives x86_64 1.31-1.fc41 updates 64.8 KiB ansible-srpm-macros noarch 1-16.fc41 fedora 35.7 KiB audit-libs x86_64 4.0.2-1.fc41 copr_base 331.3 KiB authselect x86_64 1.5.0-8.fc41 fedora 157.6 KiB authselect-libs x86_64 1.5.0-8.fc41 fedora 822.2 KiB basesystem noarch 11-21.fc41 fedora 0.0 B binutils x86_64 2.43.1-5.fc41 updates 27.4 MiB build-reproducibility-srpm-macros noarch 0.3.6-3.fc41 updates 735.0 B bzip2-libs x86_64 1.0.8-19.fc41 fedora 80.7 KiB ca-certificates noarch 2024.2.69_v8.0.401-1.0.fc41 fedora 2.4 MiB coreutils-common x86_64 9.5-11.fc41 updates 11.2 MiB cracklib x86_64 2.9.11-6.fc41 fedora 238.9 KiB crypto-policies noarch 20241029-1.git8baf557.fc41 updates 136.9 KiB curl x86_64 8.9.1-2.fc41 fedora 796.2 KiB cyrus-sasl-lib x86_64 2.1.28-27.fc41 fedora 2.3 MiB debugedit x86_64 5.1-2.fc41 updates 200.6 KiB dwz x86_64 0.15-8.fc41 fedora 298.9 KiB ed x86_64 1.20.2-2.fc41 fedora 146.9 KiB efi-srpm-macros noarch 5-13.fc41 updates 40.2 KiB elfutils x86_64 0.192-7.fc41 updates 2.6 MiB elfutils-debuginfod-client x86_64 0.192-7.fc41 updates 81.4 KiB elfutils-default-yama-scope noarch 0.192-7.fc41 updates 1.8 KiB elfutils-libelf x86_64 0.192-7.fc41 updates 1.2 MiB elfutils-libs x86_64 0.192-7.fc41 updates 654.9 KiB fedora-gpg-keys noarch 41-1 fedora 126.4 KiB fedora-release noarch 41-29 updates 0.0 B fedora-release-identity-basic noarch 41-29 updates 682.0 B fedora-repos noarch 41-1 fedora 4.9 KiB file x86_64 5.45-8.fc41 copr_base 103.5 KiB file-libs x86_64 5.45-8.fc41 copr_base 9.9 MiB filesystem x86_64 3.18-23.fc41 fedora 106.0 B fonts-srpm-macros noarch 1:2.0.5-17.fc41 fedora 55.8 KiB forge-srpm-macros noarch 0.4.0-1.fc41 updates 38.9 KiB fpc-srpm-macros noarch 1.3-13.fc41 fedora 144.0 B gdb-minimal x86_64 15.2-3.fc41 updates 13.0 MiB gdbm x86_64 1:1.23-7.fc41 fedora 460.9 KiB gdbm-libs x86_64 1:1.23-7.fc41 fedora 121.9 KiB ghc-srpm-macros noarch 1.9.1-2.fc41 fedora 747.0 B glibc x86_64 2.40-17.fc41 updates 6.6 MiB glibc-common x86_64 2.40-17.fc41 updates 1.0 MiB glibc-gconv-extra x86_64 2.40-17.fc41 updates 7.8 MiB gmp x86_64 1:6.3.0-2.fc41 fedora 811.4 KiB gnat-srpm-macros noarch 6-6.fc41 fedora 1.0 KiB go-srpm-macros noarch 3.6.0-5.fc41 updates 60.8 KiB jansson x86_64 2.13.1-10.fc41 fedora 88.3 KiB json-c x86_64 0.17-4.fc41 fedora 82.4 KiB kernel-srpm-macros noarch 1.0-24.fc41 fedora 1.9 KiB keyutils-libs x86_64 1.6.3-4.fc41 fedora 54.4 KiB krb5-libs x86_64 1.21.3-3.fc41 updates 2.3 MiB libacl x86_64 2.3.2-2.fc41 fedora 40.0 KiB libarchive x86_64 3.7.4-4.fc41 updates 926.6 KiB libattr x86_64 2.5.2-4.fc41 fedora 28.5 KiB libblkid x86_64 2.40.2-8.fc41 copr_base 262.5 KiB libbrotli x86_64 1.1.0-5.fc41 fedora 837.6 KiB libcap x86_64 2.70-4.fc41 fedora 220.2 KiB libcap-ng x86_64 0.8.5-3.fc41 fedora 69.2 KiB libcom_err x86_64 1.47.1-6.fc41 fedora 67.2 KiB libcurl x86_64 8.9.1-2.fc41 fedora 818.1 KiB libeconf x86_64 0.6.2-3.fc41 fedora 58.0 KiB libevent x86_64 2.1.12-14.fc41 fedora 895.7 KiB libfdisk x86_64 2.40.2-8.fc41 copr_base 362.9 KiB libffi x86_64 3.4.6-3.fc41 fedora 86.4 KiB libgcc x86_64 14.2.1-3.fc41 fedora 274.6 KiB libgomp x86_64 14.2.1-3.fc41 fedora 523.5 KiB libidn2 x86_64 2.3.7-2.fc41 fedora 329.1 KiB libmount x86_64 2.40.2-8.fc41 copr_base 351.8 KiB libnghttp2 x86_64 1.62.1-2.fc41 fedora 166.1 KiB libnsl2 x86_64 2.0.1-2.fc41 fedora 57.9 KiB libpkgconf x86_64 2.3.0-1.fc41 fedora 78.2 KiB libpsl x86_64 0.21.5-4.fc41 fedora 80.5 KiB libpwquality x86_64 1.4.5-11.fc41 fedora 417.8 KiB libselinux x86_64 3.7-7.fc41 copr_base 181.0 KiB libsemanage x86_64 3.7-4.fc41 copr_base 297.5 KiB libsepol x86_64 3.7-2.fc41 fedora 817.8 KiB libsmartcols x86_64 2.40.2-8.fc41 copr_base 180.4 KiB libssh x86_64 0.10.6-8.fc41 fedora 513.3 KiB libssh-config noarch 0.10.6-8.fc41 fedora 277.0 B libstdc++ x86_64 14.2.1-3.fc41 fedora 2.8 MiB libtasn1 x86_64 4.19.0-9.fc41 fedora 175.7 KiB libtirpc x86_64 1.3.6-1.fc41 updates 202.7 KiB libtool-ltdl x86_64 2.4.7-12.fc41 fedora 66.2 KiB libunistring x86_64 1.1-8.fc41 fedora 1.7 MiB libuuid x86_64 2.40.2-8.fc41 copr_base 41.4 KiB libverto x86_64 0.3.2-9.fc41 fedora 29.5 KiB libxcrypt x86_64 4.4.36-12.fc41 updates 269.3 KiB libxml2 x86_64 2.12.9-1.fc41 copr_base 1.7 MiB libzstd x86_64 1.5.6-2.fc41 fedora 795.9 KiB lua-libs x86_64 5.4.6-6.fc41 fedora 285.0 KiB lua-srpm-macros noarch 1-14.fc41 fedora 1.3 KiB lz4-libs x86_64 1.10.0-1.fc41 fedora 145.5 KiB mpfr x86_64 4.2.1-5.fc41 fedora 832.1 KiB ncurses-base noarch 6.5-2.20240629.fc41 fedora 326.3 KiB ncurses-libs x86_64 6.5-2.20240629.fc41 fedora 975.2 KiB ocaml-srpm-macros noarch 10-3.fc41 fedora 1.9 KiB openblas-srpm-macros noarch 2-18.fc41 fedora 112.0 B openldap x86_64 2.6.8-6.fc41 updates 635.4 KiB openssl-libs x86_64 1:3.2.2-9.fc41 fedora 7.8 MiB p11-kit x86_64 0.25.5-3.fc41 fedora 2.2 MiB p11-kit-trust x86_64 0.25.5-3.fc41 fedora 391.4 KiB package-notes-srpm-macros noarch 0.5-12.fc41 fedora 1.6 KiB pam x86_64 1.6.1-7.fc41 updates 1.8 MiB pam-libs x86_64 1.6.1-7.fc41 updates 139.0 KiB pcre2 x86_64 10.44-1.fc41.1 fedora 653.5 KiB pcre2-syntax noarch 10.44-1.fc41.1 fedora 251.6 KiB perl-srpm-macros noarch 1-56.fc41 fedora 861.0 B pkgconf x86_64 2.3.0-1.fc41 fedora 88.6 KiB pkgconf-m4 noarch 2.3.0-1.fc41 fedora 14.4 KiB pkgconf-pkg-config x86_64 2.3.0-1.fc41 fedora 989.0 B popt x86_64 1.19-7.fc41 fedora 136.9 KiB publicsuffix-list-dafsa noarch 20240107-4.fc41 fedora 67.5 KiB pyproject-srpm-macros noarch 1.16.3-1.fc41 updates 1.9 KiB python-srpm-macros noarch 3.13-3.fc41 fedora 51.0 KiB qt5-srpm-macros noarch 5.15.15-1.fc41 fedora 500.0 B qt6-srpm-macros noarch 6.8.1-4.fc41 updates 456.0 B readline x86_64 8.2-10.fc41 fedora 493.2 KiB rpm x86_64 4.20.0-3.fc41 copr_base 3.1 MiB rpm-build-libs x86_64 4.20.0-3.fc41 copr_base 204.1 KiB rpm-libs x86_64 4.20.0-3.fc41 copr_base 710.4 KiB rpm-sequoia x86_64 1.7.0-3.fc41 updates 2.3 MiB rust-srpm-macros noarch 26.3-3.fc41 copr_base 4.8 KiB setup noarch 2.15.0-8.fc41 updates 720.7 KiB sqlite-libs x86_64 3.46.1-1.fc41 fedora 1.4 MiB systemd-libs x86_64 256.10-1.fc41 updates 2.0 MiB util-linux-core x86_64 2.40.2-8.fc41 copr_base 1.5 MiB xxhash-libs x86_64 0.8.2-4.fc41 fedora 88.4 KiB xz-libs x86_64 1:5.6.2-2.fc41 fedora 214.4 KiB zig-srpm-macros noarch 1-3.fc41 fedora 1.1 KiB zip x86_64 3.0-41.fc41 fedora 703.2 KiB zlib-ng-compat x86_64 2.1.7-3.fc41 fedora 134.0 KiB zstd x86_64 1.5.6-2.fc41 fedora 1.7 MiB Installing groups: Buildsystem building group Transaction Summary: Installing: 153 packages Total size of inbound packages is 52 MiB. Need to download 52 MiB. After this operation, 180 MiB extra will be used (install 180 MiB, remove 0 B). [ 1/153] bzip2-0:1.0.8-19.fc41.x86_64 100% | 172.2 KiB/s | 52.5 KiB | 00m00s [ 2/153] cpio-0:2.15-2.fc41.x86_64 100% | 631.6 KiB/s | 291.8 KiB | 00m00s [ 3/153] diffutils-0:3.10-8.fc41.x86_6 100% | 1.0 MiB/s | 405.4 KiB | 00m00s [ 4/153] bash-0:5.2.32-1.fc41.x86_64 100% | 2.0 MiB/s | 1.8 MiB | 00m01s [ 5/153] findutils-1:4.10.0-4.fc41.x86 100% | 1.1 MiB/s | 548.5 KiB | 00m00s [ 6/153] gzip-0:1.13-2.fc41.x86_64 100% | 2.2 MiB/s | 170.2 KiB | 00m00s [ 7/153] grep-0:3.11-9.fc41.x86_64 100% | 976.4 KiB/s | 299.7 KiB | 00m00s [ 8/153] patch-0:2.7.6-25.fc41.x86_64 100% | 1.7 MiB/s | 131.0 KiB | 00m00s [ 9/153] info-0:7.1-3.fc41.x86_64 100% | 1.2 MiB/s | 182.5 KiB | 00m00s [ 10/153] redhat-rpm-config-0:293-1.fc4 100% | 1.1 MiB/s | 82.0 KiB | 00m00s [ 11/153] sed-0:4.9-3.fc41.x86_64 100% | 4.1 MiB/s | 317.7 KiB | 00m00s [ 12/153] unzip-0:6.0-64.fc41.x86_64 100% | 2.4 MiB/s | 184.9 KiB | 00m00s [ 13/153] which-0:2.21-42.fc41.x86_64 100% | 539.7 KiB/s | 41.6 KiB | 00m00s [ 14/153] xz-1:5.6.2-2.fc41.x86_64 100% | 3.0 MiB/s | 471.5 KiB | 00m00s [ 15/153] tar-2:1.35-4.fc41.x86_64 100% | 1.8 MiB/s | 860.7 KiB | 00m00s [ 16/153] shadow-utils-2:4.15.1-12.fc41 100% | 2.2 MiB/s | 1.3 MiB | 00m01s [ 17/153] fedora-release-common-0:41-29 100% | 102.1 KiB/s | 23.6 KiB | 00m00s [ 18/153] gawk-0:5.3.0-4.fc41.x86_64 100% | 4.5 MiB/s | 1.1 MiB | 00m00s [ 19/153] glibc-minimal-langpack-0:2.40 100% | 619.4 KiB/s | 104.1 KiB | 00m00s [ 20/153] rpm-build-0:4.20.0-3.fc41.x86 100% | 890.9 KiB/s | 67.7 KiB | 00m00s [ 21/153] util-linux-0:2.40.2-8.fc41.x8 100% | 6.0 MiB/s | 1.1 MiB | 00m00s [ 22/153] filesystem-0:3.18-23.fc41.x86 100% | 4.7 MiB/s | 1.1 MiB | 00m00s [ 23/153] bzip2-libs-0:1.0.8-19.fc41.x8 100% | 548.2 KiB/s | 41.1 KiB | 00m00s [ 24/153] pcre2-0:10.44-1.fc41.1.x86_64 100% | 3.1 MiB/s | 243.1 KiB | 00m00s [ 25/153] ncurses-libs-0:6.5-2.20240629 100% | 1.1 MiB/s | 334.0 KiB | 00m00s [ 26/153] ed-0:1.20.2-2.fc41.x86_64 100% | 1.1 MiB/s | 81.8 KiB | 00m00s [ 27/153] libattr-0:2.5.2-4.fc41.x86_64 100% | 248.9 KiB/s | 18.2 KiB | 00m00s [ 28/153] ansible-srpm-macros-0:1-16.fc 100% | 284.6 KiB/s | 20.8 KiB | 00m00s [ 29/153] dwz-0:0.15-8.fc41.x86_64 100% | 1.7 MiB/s | 138.9 KiB | 00m00s [ 30/153] fonts-srpm-macros-1:2.0.5-17. 100% | 354.8 KiB/s | 27.0 KiB | 00m00s [ 31/153] fpc-srpm-macros-0:1.3-13.fc41 100% | 107.6 KiB/s | 8.0 KiB | 00m00s [ 32/153] ghc-srpm-macros-0:1.9.1-2.fc4 100% | 116.1 KiB/s | 9.1 KiB | 00m00s [ 33/153] gnat-srpm-macros-0:6-6.fc41.n 100% | 121.0 KiB/s | 9.0 KiB | 00m00s [ 34/153] kernel-srpm-macros-0:1.0-24.f 100% | 123.4 KiB/s | 9.9 KiB | 00m00s [ 35/153] lua-srpm-macros-0:1-14.fc41.n 100% | 115.3 KiB/s | 8.9 KiB | 00m00s [ 36/153] ocaml-srpm-macros-0:10-3.fc41 100% | 127.8 KiB/s | 9.2 KiB | 00m00s [ 37/153] openblas-srpm-macros-0:2-18.f 100% | 105.7 KiB/s | 7.7 KiB | 00m00s [ 38/153] package-notes-srpm-macros-0:0 100% | 134.6 KiB/s | 9.8 KiB | 00m00s [ 39/153] perl-srpm-macros-0:1-56.fc41. 100% | 116.6 KiB/s | 8.5 KiB | 00m00s [ 40/153] python-srpm-macros-0:3.13-3.f 100% | 325.0 KiB/s | 23.7 KiB | 00m00s [ 41/153] qt5-srpm-macros-0:5.15.15-1.f 100% | 121.9 KiB/s | 8.9 KiB | 00m00s [ 42/153] zig-srpm-macros-0:1-3.fc41.no 100% | 112.8 KiB/s | 8.1 KiB | 00m00s [ 43/153] libacl-0:2.3.2-2.fc41.x86_64 100% | 335.6 KiB/s | 24.5 KiB | 00m00s [ 44/153] zip-0:3.0-41.fc41.x86_64 100% | 1.8 MiB/s | 264.8 KiB | 00m00s [ 45/153] libeconf-0:0.6.2-3.fc41.x86_6 100% | 446.9 KiB/s | 32.2 KiB | 00m00s [ 46/153] xz-libs-1:5.6.2-2.fc41.x86_64 100% | 1.5 MiB/s | 111.8 KiB | 00m00s [ 47/153] gmp-1:6.3.0-2.fc41.x86_64 100% | 3.9 MiB/s | 318.0 KiB | 00m00s [ 48/153] libcap-0:2.70-4.fc41.x86_64 100% | 1.2 MiB/s | 86.7 KiB | 00m00s [ 49/153] openssl-libs-1:3.2.2-9.fc41.x 100% | 5.2 MiB/s | 2.3 MiB | 00m00s [ 50/153] coreutils-common-0:9.5-11.fc4 100% | 3.2 MiB/s | 2.1 MiB | 00m01s [ 51/153] fedora-repos-0:41-1.noarch 100% | 126.5 KiB/s | 9.2 KiB | 00m00s [ 52/153] coreutils-0:9.5-11.fc41.x86_6 100% | 447.3 KiB/s | 1.1 MiB | 00m03s [ 53/153] readline-0:8.2-10.fc41.x86_64 100% | 2.8 MiB/s | 213.2 KiB | 00m00s [ 54/153] popt-0:1.19-7.fc41.x86_64 100% | 803.8 KiB/s | 65.9 KiB | 00m00s [ 55/153] mpfr-0:4.2.1-5.fc41.x86_64 100% | 638.9 KiB/s | 346.3 KiB | 00m01s [ 56/153] zstd-0:1.5.6-2.fc41.x86_64 100% | 1.2 MiB/s | 481.5 KiB | 00m00s [ 57/153] zlib-ng-compat-0:2.1.7-3.fc41 100% | 1.0 MiB/s | 77.7 KiB | 00m00s [ 58/153] rpm-0:4.20.0-3.fc41.x86_64 100% | 3.1 MiB/s | 512.3 KiB | 00m00s [ 59/153] libblkid-0:2.40.2-8.fc41.x86_ 100% | 4.5 MiB/s | 125.5 KiB | 00m00s [ 60/153] libfdisk-0:2.40.2-8.fc41.x86_ 100% | 5.0 MiB/s | 159.9 KiB | 00m00s [ 61/153] libmount-0:2.40.2-8.fc41.x86_ 100% | 4.8 MiB/s | 156.2 KiB | 00m00s [ 62/153] libuuid-0:2.40.2-8.fc41.x86_6 100% | 1.6 MiB/s | 29.5 KiB | 00m00s [ 63/153] libsmartcols-0:2.40.2-8.fc41. 100% | 3.1 MiB/s | 84.4 KiB | 00m00s [ 64/153] util-linux-core-0:2.40.2-8.fc 100% | 24.3 MiB/s | 521.5 KiB | 00m00s [ 65/153] ncurses-base-0:6.5-2.20240629 100% | 1.2 MiB/s | 88.3 KiB | 00m00s [ 66/153] libgcc-0:14.2.1-3.fc41.x86_64 100% | 1.8 MiB/s | 133.3 KiB | 00m00s [ 67/153] pcre2-syntax-0:10.44-1.fc41.1 100% | 687.6 KiB/s | 149.9 KiB | 00m00s [ 68/153] ca-certificates-0:2024.2.69_v 100% | 3.8 MiB/s | 871.2 KiB | 00m00s [ 69/153] fedora-gpg-keys-0:41-1.noarch 100% | 909.8 KiB/s | 133.7 KiB | 00m00s [ 70/153] lz4-libs-0:1.10.0-1.fc41.x86_ 100% | 955.2 KiB/s | 70.7 KiB | 00m00s [ 71/153] libstdc++-0:14.2.1-3.fc41.x86 100% | 3.9 MiB/s | 887.8 KiB | 00m00s [ 72/153] curl-0:8.9.1-2.fc41.x86_64 100% | 863.4 KiB/s | 315.1 KiB | 00m00s [ 73/153] glibc-0:2.40-17.fc41.x86_64 100% | 4.7 MiB/s | 2.2 MiB | 00m00s [ 74/153] basesystem-0:11-21.fc41.noarc 100% | 101.0 KiB/s | 7.4 KiB | 00m00s [ 75/153] rpm-libs-0:4.20.0-3.fc41.x86_ 100% | 20.5 MiB/s | 294.2 KiB | 00m00s [ 76/153] glibc-common-0:2.40-17.fc41.x 100% | 199.5 KiB/s | 377.3 KiB | 00m02s [ 77/153] libzstd-0:1.5.6-2.fc41.x86_64 100% | 2.1 MiB/s | 310.3 KiB | 00m00s [ 78/153] lua-libs-0:5.4.6-6.fc41.x86_6 100% | 592.0 KiB/s | 132.0 KiB | 00m00s [ 79/153] sqlite-libs-0:3.46.1-1.fc41.x 100% | 3.2 MiB/s | 712.7 KiB | 00m00s [ 80/153] libgomp-0:14.2.1-3.fc41.x86_6 100% | 4.4 MiB/s | 354.1 KiB | 00m00s [ 81/153] rpm-build-libs-0:4.20.0-3.fc4 100% | 625.1 KiB/s | 96.3 KiB | 00m00s [ 82/153] libxcrypt-0:4.4.36-12.fc41.x8 100% | 732.2 KiB/s | 115.7 KiB | 00m00s [ 83/153] systemd-libs-0:256.10-1.fc41. 100% | 3.8 MiB/s | 691.2 KiB | 00m00s [ 84/153] libselinux-0:3.7-7.fc41.x86_6 100% | 2.3 MiB/s | 89.2 KiB | 00m00s [ 85/153] libsepol-0:3.7-2.fc41.x86_64 100% | 4.2 MiB/s | 342.2 KiB | 00m00s [ 86/153] pam-0:1.6.1-7.fc41.x86_64 100% | 4.0 MiB/s | 555.0 KiB | 00m00s [ 87/153] pam-libs-0:1.6.1-7.fc41.x86_6 100% | 717.4 KiB/s | 57.4 KiB | 00m00s [ 88/153] authselect-libs-0:1.5.0-8.fc4 100% | 738.9 KiB/s | 218.0 KiB | 00m00s [ 89/153] authselect-0:1.5.0-8.fc41.x86 100% | 1.9 MiB/s | 145.8 KiB | 00m00s [ 90/153] gdbm-libs-1:1.23-7.fc41.x86_6 100% | 750.6 KiB/s | 56.3 KiB | 00m00s [ 91/153] audit-libs-0:4.0.2-1.fc41.x86 100% | 2.9 MiB/s | 126.7 KiB | 00m00s [ 92/153] libnsl2-0:2.0.1-2.fc41.x86_64 100% | 405.6 KiB/s | 29.6 KiB | 00m00s [ 93/153] libcap-ng-0:0.8.5-3.fc41.x86_ 100% | 446.1 KiB/s | 32.6 KiB | 00m00s [ 94/153] rpm-sequoia-0:1.7.0-3.fc41.x8 100% | 4.8 MiB/s | 825.7 KiB | 00m00s [ 95/153] elfutils-libelf-0:0.192-7.fc4 100% | 1.5 MiB/s | 204.6 KiB | 00m00s [ 96/153] elfutils-libs-0:0.192-7.fc41. 100% | 2.2 MiB/s | 250.8 KiB | 00m00s [ 97/153] elfutils-0:0.192-7.fc41.x86_6 100% | 3.0 MiB/s | 501.3 KiB | 00m00s [ 98/153] elfutils-debuginfod-client-0: 100% | 534.8 KiB/s | 43.9 KiB | 00m00s [ 99/153] json-c-0:0.17-4.fc41.x86_64 100% | 602.4 KiB/s | 44.0 KiB | 00m00s [100/153] file-0:5.45-8.fc41.x86_64 100% | 2.2 MiB/s | 49.2 KiB | 00m00s [101/153] file-libs-0:5.45-8.fc41.x86_6 100% | 9.1 MiB/s | 762.6 KiB | 00m00s [102/153] jansson-0:2.13.1-10.fc41.x86_ 100% | 608.6 KiB/s | 44.4 KiB | 00m00s [103/153] debugedit-0:5.1-2.fc41.x86_64 100% | 880.1 KiB/s | 78.3 KiB | 00m00s [104/153] libarchive-0:3.7.4-4.fc41.x86 100% | 3.1 MiB/s | 409.1 KiB | 00m00s [105/153] pkgconf-pkg-config-0:2.3.0-1. 100% | 139.0 KiB/s | 10.0 KiB | 00m00s [106/153] pkgconf-0:2.3.0-1.fc41.x86_64 100% | 619.2 KiB/s | 45.2 KiB | 00m00s [107/153] pkgconf-m4-0:2.3.0-1.fc41.noa 100% | 196.2 KiB/s | 14.3 KiB | 00m00s [108/153] glibc-gconv-extra-0:2.40-17.f 100% | 644.3 KiB/s | 1.5 MiB | 00m02s [109/153] libpkgconf-0:2.3.0-1.fc41.x86 100% | 527.2 KiB/s | 38.5 KiB | 00m00s [110/153] setup-0:2.15.0-8.fc41.noarch 100% | 1.6 MiB/s | 154.6 KiB | 00m00s [111/153] libsemanage-0:3.7-4.fc41.x86_ 100% | 3.6 MiB/s | 117.9 KiB | 00m00s [112/153] build-reproducibility-srpm-ma 100% | 128.9 KiB/s | 10.8 KiB | 00m00s [113/153] efi-srpm-macros-0:5-13.fc41.n 100% | 277.3 KiB/s | 22.5 KiB | 00m00s [114/153] add-determinism-0:0.3.6-3.fc4 100% | 3.5 MiB/s | 875.9 KiB | 00m00s [115/153] forge-srpm-macros-0:0.4.0-1.f 100% | 243.3 KiB/s | 19.7 KiB | 00m00s [116/153] go-srpm-macros-0:3.6.0-5.fc41 100% | 358.5 KiB/s | 28.0 KiB | 00m00s [117/153] pyproject-srpm-macros-0:1.16. 100% | 178.3 KiB/s | 13.9 KiB | 00m00s [118/153] rust-srpm-macros-0:26.3-3.fc4 100% | 603.9 KiB/s | 12.7 KiB | 00m00s [119/153] qt6-srpm-macros-0:6.8.1-4.fc4 100% | 118.8 KiB/s | 9.3 KiB | 00m00s [120/153] crypto-policies-0:20241029-1. 100% | 994.4 KiB/s | 97.5 KiB | 00m00s [121/153] libtirpc-0:1.3.6-1.fc41.x86_6 100% | 1.0 MiB/s | 94.4 KiB | 00m00s [122/153] libcom_err-0:1.47.1-6.fc41.x8 100% | 184.5 KiB/s | 26.6 KiB | 00m00s [123/153] binutils-0:2.43.1-5.fc41.x86_ 100% | 5.1 MiB/s | 6.3 MiB | 00m01s [124/153] libffi-0:3.4.6-3.fc41.x86_64 100% | 275.5 KiB/s | 39.9 KiB | 00m00s [125/153] p11-kit-trust-0:0.25.5-3.fc41 100% | 606.2 KiB/s | 132.1 KiB | 00m00s [126/153] p11-kit-0:0.25.5-3.fc41.x86_6 100% | 1.6 MiB/s | 490.9 KiB | 00m00s [127/153] libtasn1-0:4.19.0-9.fc41.x86_ 100% | 254.1 KiB/s | 74.2 KiB | 00m00s [128/153] libpwquality-0:1.4.5-11.fc41. 100% | 1.6 MiB/s | 119.0 KiB | 00m00s [129/153] gdbm-1:1.23-7.fc41.x86_64 100% | 1.0 MiB/s | 151.8 KiB | 00m00s [130/153] cracklib-0:2.9.11-6.fc41.x86_ 100% | 630.5 KiB/s | 92.1 KiB | 00m00s [131/153] keyutils-libs-0:1.6.3-4.fc41. 100% | 439.6 KiB/s | 31.6 KiB | 00m00s [132/153] libverto-0:0.3.2-9.fc41.x86_6 100% | 283.4 KiB/s | 20.7 KiB | 00m00s [133/153] libxml2-0:2.12.9-1.fc41.x86_6 100% | 9.9 MiB/s | 657.3 KiB | 00m00s [134/153] krb5-libs-0:1.21.3-3.fc41.x86 100% | 3.8 MiB/s | 757.9 KiB | 00m00s [135/153] elfutils-default-yama-scope-0 100% | 164.0 KiB/s | 12.5 KiB | 00m00s [136/153] alternatives-0:1.31-1.fc41.x8 100% | 458.4 KiB/s | 39.4 KiB | 00m00s [137/153] xxhash-libs-0:0.8.2-4.fc41.x8 100% | 408.6 KiB/s | 36.8 KiB | 00m00s [138/153] fedora-release-0:41-29.noarch 100% | 150.2 KiB/s | 12.8 KiB | 00m00s [139/153] libcurl-0:8.9.1-2.fc41.x86_64 100% | 2.4 MiB/s | 361.9 KiB | 00m00s [140/153] libidn2-0:2.3.7-2.fc41.x86_64 100% | 811.0 KiB/s | 118.4 KiB | 00m00s [141/153] libnghttp2-0:1.62.1-2.fc41.x8 100% | 1.0 MiB/s | 76.6 KiB | 00m00s [142/153] libpsl-0:0.21.5-4.fc41.x86_64 100% | 877.8 KiB/s | 64.1 KiB | 00m00s [143/153] libssh-0:0.10.6-8.fc41.x86_64 100% | 2.8 MiB/s | 211.8 KiB | 00m00s [144/153] publicsuffix-list-dafsa-0:202 100% | 798.3 KiB/s | 58.3 KiB | 00m00s [145/153] libssh-config-0:0.10.6-8.fc41 100% | 128.3 KiB/s | 9.2 KiB | 00m00s [146/153] gdb-minimal-0:15.2-3.fc41.x86 100% | 7.1 MiB/s | 4.3 MiB | 00m01s [147/153] fedora-release-identity-basic 100% | 173.9 KiB/s | 13.6 KiB | 00m00s [148/153] openldap-0:2.6.8-6.fc41.x86_6 100% | 2.3 MiB/s | 243.0 KiB | 00m00s [149/153] cyrus-sasl-lib-0:2.1.28-27.fc 100% | 3.6 MiB/s | 794.9 KiB | 00m00s [150/153] libunistring-0:1.1-8.fc41.x86 100% | 1.0 MiB/s | 544.8 KiB | 00m01s [151/153] libtool-ltdl-0:2.4.7-12.fc41. 100% | 487.5 KiB/s | 35.6 KiB | 00m00s [152/153] libevent-0:2.1.12-14.fc41.x86 100% | 576.1 KiB/s | 257.5 KiB | 00m00s [153/153] libbrotli-0:1.1.0-5.fc41.x86_ 100% | 1.1 MiB/s | 340.5 KiB | 00m00s -------------------------------------------------------------------------------- [153/153] Total 100% | 5.1 MiB/s | 52.4 MiB | 00m10s Running transaction Importing OpenPGP key 0xE99D6AD1: UserID : "Fedora (41) " Fingerprint: 466CF2D8B60BC3057AA9453ED0622462E99D6AD1 From : file:///usr/share/distribution-gpg-keys/fedora/RPM-GPG-KEY-fedora-41-primary The key was successfully imported. [ 1/155] Verify package files 100% | 757.0 B/s | 153.0 B | 00m00s >>> Running pre-transaction scriptlet: filesystem-0:3.18-23.fc41.x86_64 >>> Finished pre-transaction scriptlet: filesystem-0:3.18-23.fc41.x86_64 >>> [RPM] /var/lib/mock/fedora-41-x86_64-1735650614.339304/root/var/cache/dnf/co [ 2/155] Prepare transaction 100% | 1.8 KiB/s | 153.0 B | 00m00s [ 3/155] Installing libgcc-0:14.2.1-3. 100% | 134.9 MiB/s | 276.3 KiB | 00m00s [ 4/155] Installing fedora-release-ide 100% | 918.0 KiB/s | 940.0 B | 00m00s [ 5/155] Installing fedora-gpg-keys-0: 100% | 18.7 MiB/s | 172.2 KiB | 00m00s [ 6/155] Installing fedora-repos-0:41- 100% | 5.6 MiB/s | 5.7 KiB | 00m00s [ 7/155] Installing fedora-release-com 100% | 11.7 MiB/s | 24.0 KiB | 00m00s [ 8/155] Installing fedora-release-0:4 100% | 0.0 B/s | 124.0 B | 00m00s [ 9/155] Installing setup-0:2.15.0-8.f 100% | 47.3 MiB/s | 726.5 KiB | 00m00s >>> [RPM] /etc/hosts created as /etc/hosts.rpmnew [ 10/155] Installing filesystem-0:3.18- 100% | 1.7 MiB/s | 212.5 KiB | 00m00s [ 11/155] Installing basesystem-0:11-21 100% | 121.1 KiB/s | 124.0 B | 00m00s [ 12/155] Installing libssh-config-0:0. 100% | 796.9 KiB/s | 816.0 B | 00m00s [ 13/155] Installing publicsuffix-list- 100% | 66.7 MiB/s | 68.3 KiB | 00m00s [ 14/155] Installing rust-srpm-macros-0 100% | 5.4 MiB/s | 5.6 KiB | 00m00s [ 15/155] Installing qt6-srpm-macros-0: 100% | 0.0 B/s | 732.0 B | 00m00s [ 16/155] Installing pkgconf-m4-0:2.3.0 100% | 0.0 B/s | 14.8 KiB | 00m00s [ 17/155] Installing pcre2-syntax-0:10. 100% | 82.7 MiB/s | 254.1 KiB | 00m00s [ 18/155] Installing ncurses-base-0:6.5 100% | 38.2 MiB/s | 351.7 KiB | 00m00s [ 19/155] Installing glibc-minimal-lang 100% | 121.1 KiB/s | 124.0 B | 00m00s [ 20/155] Installing ncurses-libs-0:6.5 100% | 137.0 MiB/s | 981.8 KiB | 00m00s [ 21/155] Installing glibc-0:2.40-17.fc 100% | 220.5 MiB/s | 6.6 MiB | 00m00s [ 22/155] Installing bash-0:5.2.32-1.fc 100% | 281.7 MiB/s | 8.2 MiB | 00m00s [ 23/155] Installing glibc-common-0:2.4 100% | 115.0 MiB/s | 1.0 MiB | 00m00s [ 24/155] Installing glibc-gconv-extra- 100% | 151.2 MiB/s | 7.9 MiB | 00m00s [ 25/155] Installing zlib-ng-compat-0:2 100% | 131.6 MiB/s | 134.8 KiB | 00m00s [ 26/155] Installing bzip2-libs-0:1.0.8 100% | 79.9 MiB/s | 81.8 KiB | 00m00s [ 27/155] Installing xz-libs-1:5.6.2-2. 100% | 105.2 MiB/s | 215.5 KiB | 00m00s [ 28/155] Installing readline-0:8.2-10. 100% | 161.2 MiB/s | 495.3 KiB | 00m00s [ 29/155] Installing popt-0:1.19-7.fc41 100% | 35.0 MiB/s | 143.5 KiB | 00m00s [ 30/155] Installing libuuid-0:2.40.2-8 100% | 41.5 MiB/s | 42.5 KiB | 00m00s [ 31/155] Installing libblkid-0:2.40.2- 100% | 128.7 MiB/s | 263.6 KiB | 00m00s [ 32/155] Installing libattr-0:2.5.2-4. 100% | 28.8 MiB/s | 29.5 KiB | 00m00s [ 33/155] Installing libacl-0:2.3.2-2.f 100% | 39.8 MiB/s | 40.7 KiB | 00m00s [ 34/155] Installing gmp-1:6.3.0-2.fc41 100% | 198.6 MiB/s | 813.7 KiB | 00m00s [ 35/155] Installing libstdc++-0:14.2.1 100% | 276.6 MiB/s | 2.8 MiB | 00m00s [ 36/155] Installing libzstd-0:1.5.6-2. 100% | 259.5 MiB/s | 797.2 KiB | 00m00s [ 37/155] Installing elfutils-libelf-0: 100% | 233.4 MiB/s | 1.2 MiB | 00m00s [ 38/155] Installing libxcrypt-0:4.4.36 100% | 132.8 MiB/s | 272.0 KiB | 00m00s [ 39/155] Installing libeconf-0:0.6.2-3 100% | 58.3 MiB/s | 59.7 KiB | 00m00s [ 40/155] Installing gdbm-libs-1:1.23-7 100% | 120.7 MiB/s | 123.6 KiB | 00m00s [ 41/155] Installing dwz-0:0.15-8.fc41. 100% | 146.6 MiB/s | 300.3 KiB | 00m00s [ 42/155] Installing mpfr-0:4.2.1-5.fc4 100% | 203.5 MiB/s | 833.7 KiB | 00m00s [ 43/155] Installing gawk-0:5.3.0-4.fc4 100% | 173.2 MiB/s | 1.7 MiB | 00m00s [ 44/155] Installing unzip-0:6.0-64.fc4 100% | 190.6 MiB/s | 390.3 KiB | 00m00s [ 45/155] Installing file-libs-0:5.45-8 100% | 496.7 MiB/s | 9.9 MiB | 00m00s [ 46/155] Installing file-0:5.45-8.fc41 100% | 5.4 MiB/s | 105.0 KiB | 00m00s >>> Running pre-install scriptlet: crypto-policies-0:20241029-1.git8baf557.fc41. >>> Finished pre-install scriptlet: crypto-policies-0:20241029-1.git8baf557.fc41 >>> Scriptlet output: >>> /var/tmp/rpm-tmp.uVjDH0: line 2: rm: command not found >>> [ 47/155] Installing crypto-policies-0: 100% | 14.5 MiB/s | 163.3 KiB | 00m00s [ 48/155] Installing pcre2-0:10.44-1.fc 100% | 213.2 MiB/s | 654.9 KiB | 00m00s [ 49/155] Installing grep-0:3.11-9.fc41 100% | 111.5 MiB/s | 1.0 MiB | 00m00s [ 50/155] Installing xz-1:5.6.2-2.fc41. 100% | 120.5 MiB/s | 1.2 MiB | 00m00s [ 51/155] Installing libsmartcols-0:2.4 100% | 177.2 MiB/s | 181.5 KiB | 00m00s [ 52/155] Installing lz4-libs-0:1.10.0- 100% | 143.1 MiB/s | 146.6 KiB | 00m00s [ 53/155] Installing lua-libs-0:5.4.6-6 100% | 139.8 MiB/s | 286.2 KiB | 00m00s [ 54/155] Installing libsepol-0:3.7-2.f 100% | 266.5 MiB/s | 818.8 KiB | 00m00s [ 55/155] Installing libselinux-0:3.7-7 100% | 178.0 MiB/s | 182.3 KiB | 00m00s [ 56/155] Installing sed-0:4.9-3.fc41.x 100% | 121.3 MiB/s | 869.7 KiB | 00m00s [ 57/155] Installing findutils-1:4.10.0 100% | 185.8 MiB/s | 1.9 MiB | 00m00s [ 58/155] Installing libmount-0:2.40.2- 100% | 172.3 MiB/s | 352.9 KiB | 00m00s [ 59/155] Installing libcap-ng-0:0.8.5- 100% | 69.4 MiB/s | 71.0 KiB | 00m00s [ 60/155] Installing audit-libs-0:4.0.2 100% | 162.8 MiB/s | 333.4 KiB | 00m00s [ 61/155] Installing pam-libs-0:1.6.1-7 100% | 69.0 MiB/s | 141.3 KiB | 00m00s [ 62/155] Installing libcap-0:2.70-4.fc 100% | 73.3 MiB/s | 225.2 KiB | 00m00s [ 63/155] Installing systemd-libs-0:256 100% | 248.7 MiB/s | 2.0 MiB | 00m00s [ 64/155] Installing libcom_err-0:1.47. 100% | 66.7 MiB/s | 68.3 KiB | 00m00s [ 65/155] Installing libffi-0:3.4.6-3.f 100% | 85.7 MiB/s | 87.8 KiB | 00m00s [ 66/155] Installing libtasn1-0:4.19.0- 100% | 86.7 MiB/s | 177.5 KiB | 00m00s [ 67/155] Installing p11-kit-0:0.25.5-3 100% | 147.2 MiB/s | 2.2 MiB | 00m00s [ 68/155] Installing alternatives-0:1.3 100% | 64.8 MiB/s | 66.4 KiB | 00m00s [ 69/155] Installing libunistring-0:1.1 100% | 288.5 MiB/s | 1.7 MiB | 00m00s [ 70/155] Installing libidn2-0:2.3.7-2. 100% | 81.8 MiB/s | 335.1 KiB | 00m00s [ 71/155] Installing libpsl-0:0.21.5-4. 100% | 79.7 MiB/s | 81.7 KiB | 00m00s [ 72/155] Installing p11-kit-trust-0:0. 100% | 22.6 MiB/s | 393.1 KiB | 00m00s [ 73/155] Installing util-linux-core-0: 100% | 126.7 MiB/s | 1.5 MiB | 00m00s [ 74/155] Installing libsemanage-0:3.7- 100% | 97.4 MiB/s | 299.3 KiB | 00m00s [ 75/155] Installing shadow-utils-2:4.1 100% | 122.5 MiB/s | 4.2 MiB | 00m00s [ 76/155] Installing tar-2:1.35-4.fc41. 100% | 227.6 MiB/s | 3.0 MiB | 00m00s [ 77/155] Installing zstd-0:1.5.6-2.fc4 100% | 281.9 MiB/s | 1.7 MiB | 00m00s [ 78/155] Installing zip-0:3.0-41.fc41. 100% | 172.6 MiB/s | 707.1 KiB | 00m00s [ 79/155] Installing gdbm-1:1.23-7.fc41 100% | 113.7 MiB/s | 465.8 KiB | 00m00s [ 80/155] Installing cyrus-sasl-lib-0:2 100% | 256.2 MiB/s | 2.3 MiB | 00m00s [ 81/155] Installing libfdisk-0:2.40.2- 100% | 177.7 MiB/s | 363.9 KiB | 00m00s [ 82/155] Installing libxml2-0:2.12.9-1 100% | 240.9 MiB/s | 1.7 MiB | 00m00s [ 83/155] Installing bzip2-0:1.0.8-19.f 100% | 48.9 MiB/s | 100.2 KiB | 00m00s [ 84/155] Installing sqlite-libs-0:3.46 100% | 238.2 MiB/s | 1.4 MiB | 00m00s [ 85/155] Installing add-determinism-0: 100% | 294.5 MiB/s | 2.4 MiB | 00m00s [ 86/155] Installing build-reproducibil 100% | 0.0 B/s | 1.0 KiB | 00m00s [ 87/155] Installing ed-0:1.20.2-2.fc41 100% | 72.8 MiB/s | 149.2 KiB | 00m00s [ 88/155] Installing patch-0:2.7.6-25.f 100% | 131.0 MiB/s | 268.2 KiB | 00m00s [ 89/155] Installing elfutils-default-y 100% | 170.2 KiB/s | 2.0 KiB | 00m00s [ 90/155] Installing elfutils-libs-0:0. 100% | 160.3 MiB/s | 656.7 KiB | 00m00s [ 91/155] Installing cpio-0:2.15-2.fc41 100% | 157.1 MiB/s | 1.1 MiB | 00m00s [ 92/155] Installing diffutils-0:3.10-8 100% | 159.0 MiB/s | 1.6 MiB | 00m00s [ 93/155] Installing libgomp-0:14.2.1-3 100% | 256.2 MiB/s | 524.8 KiB | 00m00s [ 94/155] Installing json-c-0:0.17-4.fc 100% | 81.7 MiB/s | 83.6 KiB | 00m00s [ 95/155] Installing jansson-0:2.13.1-1 100% | 87.6 MiB/s | 89.7 KiB | 00m00s [ 96/155] Installing libpkgconf-0:2.3.0 100% | 77.5 MiB/s | 79.3 KiB | 00m00s [ 97/155] Installing pkgconf-0:2.3.0-1. 100% | 44.5 MiB/s | 91.1 KiB | 00m00s [ 98/155] Installing pkgconf-pkg-config 100% | 1.7 MiB/s | 1.8 KiB | 00m00s [ 99/155] Installing keyutils-libs-0:1. 100% | 54.5 MiB/s | 55.8 KiB | 00m00s [100/155] Installing libverto-0:0.3.2-9 100% | 30.5 MiB/s | 31.3 KiB | 00m00s [101/155] Installing xxhash-libs-0:0.8. 100% | 87.7 MiB/s | 89.8 KiB | 00m00s [102/155] Installing libnghttp2-0:1.62. 100% | 163.2 MiB/s | 167.1 KiB | 00m00s [103/155] Installing libtool-ltdl-0:2.4 100% | 65.7 MiB/s | 67.3 KiB | 00m00s [104/155] Installing libbrotli-0:1.1.0- 100% | 164.0 MiB/s | 839.9 KiB | 00m00s [105/155] Installing coreutils-common-0 100% | 228.4 MiB/s | 11.2 MiB | 00m00s [106/155] Installing openssl-libs-1:3.2 100% | 313.2 MiB/s | 7.8 MiB | 00m00s [107/155] Installing coreutils-0:9.5-11 100% | 139.2 MiB/s | 5.7 MiB | 00m00s [108/155] Installing ca-certificates-0: 100% | 2.3 MiB/s | 2.4 MiB | 00m01s [109/155] Installing krb5-libs-0:1.21.3 100% | 178.4 MiB/s | 2.3 MiB | 00m00s [110/155] Installing libarchive-0:3.7.4 100% | 226.7 MiB/s | 928.6 KiB | 00m00s [111/155] Installing libtirpc-0:1.3.6-1 100% | 99.8 MiB/s | 204.5 KiB | 00m00s [112/155] Installing gzip-0:1.13-2.fc41 100% | 96.3 MiB/s | 394.6 KiB | 00m00s [113/155] Installing authselect-libs-0: 100% | 90.8 MiB/s | 837.2 KiB | 00m00s [114/155] Installing cracklib-0:2.9.11- 100% | 34.9 MiB/s | 250.3 KiB | 00m00s [115/155] Installing libpwquality-0:1.4 100% | 52.5 MiB/s | 430.1 KiB | 00m00s [116/155] Installing libnsl2-0:2.0.1-2. 100% | 28.8 MiB/s | 59.1 KiB | 00m00s [117/155] Installing pam-0:1.6.1-7.fc41 100% | 72.2 MiB/s | 1.9 MiB | 00m00s [118/155] Installing libssh-0:0.10.6-8. 100% | 83.9 MiB/s | 515.4 KiB | 00m00s [119/155] Installing rpm-sequoia-0:1.7. 100% | 258.2 MiB/s | 2.3 MiB | 00m00s [120/155] Installing rpm-libs-0:4.20.0- 100% | 231.7 MiB/s | 711.9 KiB | 00m00s [121/155] Installing rpm-build-libs-0:4 100% | 100.0 MiB/s | 204.9 KiB | 00m00s [122/155] Installing libevent-0:2.1.12- 100% | 125.5 MiB/s | 899.5 KiB | 00m00s [123/155] Installing openldap-0:2.6.8-6 100% | 78.0 MiB/s | 639.2 KiB | 00m00s [124/155] Installing libcurl-0:8.9.1-2. 100% | 200.0 MiB/s | 819.2 KiB | 00m00s [125/155] Installing elfutils-debuginfo 100% | 40.9 MiB/s | 83.8 KiB | 00m00s [126/155] Installing elfutils-0:0.192-7 100% | 239.0 MiB/s | 2.6 MiB | 00m00s [127/155] Installing binutils-0:2.43.1- 100% | 244.5 MiB/s | 27.4 MiB | 00m00s [128/155] Installing gdb-minimal-0:15.2 100% | 302.1 MiB/s | 13.0 MiB | 00m00s [129/155] Installing debugedit-0:5.1-2. 100% | 99.3 MiB/s | 203.3 KiB | 00m00s [130/155] Installing curl-0:8.9.1-2.fc4 100% | 31.2 MiB/s | 798.6 KiB | 00m00s [131/155] Installing rpm-0:4.20.0-3.fc4 100% | 89.2 MiB/s | 2.5 MiB | 00m00s [132/155] Installing lua-srpm-macros-0: 100% | 1.9 MiB/s | 1.9 KiB | 00m00s [133/155] Installing zig-srpm-macros-0: 100% | 0.0 B/s | 1.7 KiB | 00m00s [134/155] Installing efi-srpm-macros-0: 100% | 40.2 MiB/s | 41.2 KiB | 00m00s [135/155] Installing qt5-srpm-macros-0: 100% | 0.0 B/s | 776.0 B | 00m00s [136/155] Installing perl-srpm-macros-0 100% | 0.0 B/s | 1.1 KiB | 00m00s [137/155] Installing package-notes-srpm 100% | 0.0 B/s | 2.0 KiB | 00m00s [138/155] Installing openblas-srpm-macr 100% | 0.0 B/s | 392.0 B | 00m00s [139/155] Installing ocaml-srpm-macros- 100% | 0.0 B/s | 2.2 KiB | 00m00s [140/155] Installing kernel-srpm-macros 100% | 0.0 B/s | 2.3 KiB | 00m00s [141/155] Installing gnat-srpm-macros-0 100% | 0.0 B/s | 1.3 KiB | 00m00s [142/155] Installing ghc-srpm-macros-0: 100% | 0.0 B/s | 1.0 KiB | 00m00s [143/155] Installing fpc-srpm-macros-0: 100% | 0.0 B/s | 420.0 B | 00m00s [144/155] Installing ansible-srpm-macro 100% | 35.4 MiB/s | 36.2 KiB | 00m00s [145/155] Installing python-srpm-macros 100% | 50.9 MiB/s | 52.2 KiB | 00m00s [146/155] Installing fonts-srpm-macros- 100% | 55.7 MiB/s | 57.0 KiB | 00m00s [147/155] Installing forge-srpm-macros- 100% | 39.3 MiB/s | 40.3 KiB | 00m00s [148/155] Installing go-srpm-macros-0:3 100% | 60.5 MiB/s | 62.0 KiB | 00m00s [149/155] Installing redhat-rpm-config- 100% | 61.9 MiB/s | 190.1 KiB | 00m00s [150/155] Installing rpm-build-0:4.20.0 100% | 47.5 MiB/s | 194.5 KiB | 00m00s [151/155] Installing pyproject-srpm-mac 100% | 2.4 MiB/s | 2.5 KiB | 00m00s [152/155] Installing util-linux-0:2.40. 100% | 81.9 MiB/s | 3.7 MiB | 00m00s [153/155] Installing authselect-0:1.5.0 100% | 39.5 MiB/s | 161.9 KiB | 00m00s [154/155] Installing which-0:2.21-42.fc 100% | 40.2 MiB/s | 82.4 KiB | 00m00s [155/155] Installing info-0:7.1-3.fc41. 100% | 267.7 KiB/s | 362.2 KiB | 00m01s Warning: skipped OpenPGP checks for 18 packages from repository: copr_base Complete! Finish: installing minimal buildroot with dnf5 Start: creating root cache Finish: creating root cache Finish: chroot init INFO: Installed packages: INFO: add-determinism-0.3.6-3.fc41.x86_64 alternatives-1.31-1.fc41.x86_64 ansible-srpm-macros-1-16.fc41.noarch audit-libs-4.0.2-1.fc41.x86_64 authselect-1.5.0-8.fc41.x86_64 authselect-libs-1.5.0-8.fc41.x86_64 basesystem-11-21.fc41.noarch bash-5.2.32-1.fc41.x86_64 binutils-2.43.1-5.fc41.x86_64 build-reproducibility-srpm-macros-0.3.6-3.fc41.noarch bzip2-1.0.8-19.fc41.x86_64 bzip2-libs-1.0.8-19.fc41.x86_64 ca-certificates-2024.2.69_v8.0.401-1.0.fc41.noarch coreutils-9.5-11.fc41.x86_64 coreutils-common-9.5-11.fc41.x86_64 cpio-2.15-2.fc41.x86_64 cracklib-2.9.11-6.fc41.x86_64 crypto-policies-20241029-1.git8baf557.fc41.noarch curl-8.9.1-2.fc41.x86_64 cyrus-sasl-lib-2.1.28-27.fc41.x86_64 debugedit-5.1-2.fc41.x86_64 diffutils-3.10-8.fc41.x86_64 dwz-0.15-8.fc41.x86_64 ed-1.20.2-2.fc41.x86_64 efi-srpm-macros-5-13.fc41.noarch elfutils-0.192-7.fc41.x86_64 elfutils-debuginfod-client-0.192-7.fc41.x86_64 elfutils-default-yama-scope-0.192-7.fc41.noarch elfutils-libelf-0.192-7.fc41.x86_64 elfutils-libs-0.192-7.fc41.x86_64 fedora-gpg-keys-41-1.noarch fedora-release-41-29.noarch fedora-release-common-41-29.noarch fedora-release-identity-basic-41-29.noarch fedora-repos-41-1.noarch file-5.45-8.fc41.x86_64 file-libs-5.45-8.fc41.x86_64 filesystem-3.18-23.fc41.x86_64 findutils-4.10.0-4.fc41.x86_64 fonts-srpm-macros-2.0.5-17.fc41.noarch forge-srpm-macros-0.4.0-1.fc41.noarch fpc-srpm-macros-1.3-13.fc41.noarch gawk-5.3.0-4.fc41.x86_64 gdb-minimal-15.2-3.fc41.x86_64 gdbm-1.23-7.fc41.x86_64 gdbm-libs-1.23-7.fc41.x86_64 ghc-srpm-macros-1.9.1-2.fc41.noarch glibc-2.40-17.fc41.x86_64 glibc-common-2.40-17.fc41.x86_64 glibc-gconv-extra-2.40-17.fc41.x86_64 glibc-minimal-langpack-2.40-17.fc41.x86_64 gmp-6.3.0-2.fc41.x86_64 gnat-srpm-macros-6-6.fc41.noarch go-srpm-macros-3.6.0-5.fc41.noarch gpg-pubkey-e99d6ad1-64d2612c grep-3.11-9.fc41.x86_64 gzip-1.13-2.fc41.x86_64 info-7.1-3.fc41.x86_64 jansson-2.13.1-10.fc41.x86_64 json-c-0.17-4.fc41.x86_64 kernel-srpm-macros-1.0-24.fc41.noarch keyutils-libs-1.6.3-4.fc41.x86_64 krb5-libs-1.21.3-3.fc41.x86_64 libacl-2.3.2-2.fc41.x86_64 libarchive-3.7.4-4.fc41.x86_64 libattr-2.5.2-4.fc41.x86_64 libblkid-2.40.2-8.fc41.x86_64 libbrotli-1.1.0-5.fc41.x86_64 libcap-2.70-4.fc41.x86_64 libcap-ng-0.8.5-3.fc41.x86_64 libcom_err-1.47.1-6.fc41.x86_64 libcurl-8.9.1-2.fc41.x86_64 libeconf-0.6.2-3.fc41.x86_64 libevent-2.1.12-14.fc41.x86_64 libfdisk-2.40.2-8.fc41.x86_64 libffi-3.4.6-3.fc41.x86_64 libgcc-14.2.1-3.fc41.x86_64 libgomp-14.2.1-3.fc41.x86_64 libidn2-2.3.7-2.fc41.x86_64 libmount-2.40.2-8.fc41.x86_64 libnghttp2-1.62.1-2.fc41.x86_64 libnsl2-2.0.1-2.fc41.x86_64 libpkgconf-2.3.0-1.fc41.x86_64 libpsl-0.21.5-4.fc41.x86_64 libpwquality-1.4.5-11.fc41.x86_64 libselinux-3.7-7.fc41.x86_64 libsemanage-3.7-4.fc41.x86_64 libsepol-3.7-2.fc41.x86_64 libsmartcols-2.40.2-8.fc41.x86_64 libssh-0.10.6-8.fc41.x86_64 libssh-config-0.10.6-8.fc41.noarch libstdc++-14.2.1-3.fc41.x86_64 libtasn1-4.19.0-9.fc41.x86_64 libtirpc-1.3.6-1.fc41.x86_64 libtool-ltdl-2.4.7-12.fc41.x86_64 libunistring-1.1-8.fc41.x86_64 libuuid-2.40.2-8.fc41.x86_64 libverto-0.3.2-9.fc41.x86_64 libxcrypt-4.4.36-12.fc41.x86_64 libxml2-2.12.9-1.fc41.x86_64 libzstd-1.5.6-2.fc41.x86_64 lua-libs-5.4.6-6.fc41.x86_64 lua-srpm-macros-1-14.fc41.noarch lz4-libs-1.10.0-1.fc41.x86_64 mpfr-4.2.1-5.fc41.x86_64 ncurses-base-6.5-2.20240629.fc41.noarch ncurses-libs-6.5-2.20240629.fc41.x86_64 ocaml-srpm-macros-10-3.fc41.noarch openblas-srpm-macros-2-18.fc41.noarch openldap-2.6.8-6.fc41.x86_64 openssl-libs-3.2.2-9.fc41.x86_64 p11-kit-0.25.5-3.fc41.x86_64 p11-kit-trust-0.25.5-3.fc41.x86_64 package-notes-srpm-macros-0.5-12.fc41.noarch pam-1.6.1-7.fc41.x86_64 pam-libs-1.6.1-7.fc41.x86_64 patch-2.7.6-25.fc41.x86_64 pcre2-10.44-1.fc41.1.x86_64 pcre2-syntax-10.44-1.fc41.1.noarch perl-srpm-macros-1-56.fc41.noarch pkgconf-2.3.0-1.fc41.x86_64 pkgconf-m4-2.3.0-1.fc41.noarch pkgconf-pkg-config-2.3.0-1.fc41.x86_64 popt-1.19-7.fc41.x86_64 publicsuffix-list-dafsa-20240107-4.fc41.noarch pyproject-srpm-macros-1.16.3-1.fc41.noarch python-srpm-macros-3.13-3.fc41.noarch qt5-srpm-macros-5.15.15-1.fc41.noarch qt6-srpm-macros-6.8.1-4.fc41.noarch readline-8.2-10.fc41.x86_64 redhat-rpm-config-293-1.fc41.noarch rpm-4.20.0-3.fc41.x86_64 rpm-build-4.20.0-3.fc41.x86_64 rpm-build-libs-4.20.0-3.fc41.x86_64 rpm-libs-4.20.0-3.fc41.x86_64 rpm-sequoia-1.7.0-3.fc41.x86_64 rust-srpm-macros-26.3-3.fc41.noarch sed-4.9-3.fc41.x86_64 setup-2.15.0-8.fc41.noarch shadow-utils-4.15.1-12.fc41.x86_64 sqlite-libs-3.46.1-1.fc41.x86_64 systemd-libs-256.10-1.fc41.x86_64 tar-1.35-4.fc41.x86_64 unzip-6.0-64.fc41.x86_64 util-linux-2.40.2-8.fc41.x86_64 util-linux-core-2.40.2-8.fc41.x86_64 which-2.21-42.fc41.x86_64 xxhash-libs-0.8.2-4.fc41.x86_64 xz-5.6.2-2.fc41.x86_64 xz-libs-5.6.2-2.fc41.x86_64 zig-srpm-macros-1-3.fc41.noarch zip-3.0-41.fc41.x86_64 zlib-ng-compat-2.1.7-3.fc41.x86_64 zstd-1.5.6-2.fc41.x86_64 Start: buildsrpm Start: rpmbuild -bs Building target platforms: x86_64 Building for target x86_64 Reading /var/tmp/rpm-tmp.1k4JDl setting SOURCE_DATE_EPOCH=1735603200 Wrote: /builddir/build/SRPMS/python-starlette-0.45.1-1.fc41.src.rpm Finish: rpmbuild -bs INFO: chroot_scan: 1 files copied to /var/lib/copr-rpmbuild/results/chroot_scan INFO: /var/lib/mock/fedora-41-x86_64-1735650614.339304/root/var/log/dnf5.log INFO: chroot_scan: creating tarball /var/lib/copr-rpmbuild/results/chroot_scan.tar.gz /bin/tar: Removing leading `/' from member names Finish: buildsrpm INFO: Done(/var/lib/copr-rpmbuild/workspace/workdir-plcfsrp9/python-starlette/python-starlette.spec) Config(child) 0 minutes 39 seconds INFO: Results and/or logs in: /var/lib/copr-rpmbuild/results INFO: Cleaning up build root ('cleanup_on_success=True') Start: clean chroot INFO: unmounting tmpfs. Finish: clean chroot INFO: Start(/var/lib/copr-rpmbuild/results/python-starlette-0.45.1-1.fc41.src.rpm) Config(fedora-41-x86_64) Start(bootstrap): chroot init INFO: mounting tmpfs at /var/lib/mock/fedora-41-x86_64-bootstrap-1735650614.339304/root. INFO: reusing tmpfs at /var/lib/mock/fedora-41-x86_64-bootstrap-1735650614.339304/root. INFO: calling preinit hooks INFO: enabled root cache INFO: enabled package manager cache Start(bootstrap): cleaning package manager metadata Finish(bootstrap): cleaning package manager metadata Finish(bootstrap): chroot init Start: chroot init INFO: mounting tmpfs at /var/lib/mock/fedora-41-x86_64-1735650614.339304/root. INFO: calling preinit hooks INFO: enabled root cache Start: unpacking root cache Finish: unpacking root cache INFO: enabled package manager cache Start: cleaning package manager metadata Finish: cleaning package manager metadata INFO: enabled HW Info plugin INFO: Buildroot is handled by package management downloaded with a bootstrap image: rpm-4.20.0-1.fc41.x86_64 rpm-sequoia-1.7.0-3.fc41.x86_64 dnf5-5.2.8.1-2.fc41.x86_64 dnf5-plugins-5.2.8.1-2.fc41.x86_64 Finish: chroot init Start: build phase for python-starlette-0.45.1-1.fc41.src.rpm Start: build setup for python-starlette-0.45.1-1.fc41.src.rpm Building target platforms: x86_64 Building for target x86_64 Reading /var/tmp/rpm-tmp.Wx0M00 setting SOURCE_DATE_EPOCH=1735603200 Wrote: /builddir/build/SRPMS/python-starlette-0.45.1-1.fc41.src.rpm Updating and loading repositories: updates 100% | 1.1 MiB/s | 30.7 KiB | 00m00s fedora 100% | 1.2 MiB/s | 30.8 KiB | 00m00s Copr repository 100% | 43.9 KiB/s | 1.5 KiB | 00m00s Repositories loaded. Package Arch Version Repository Size Installing: python3-pytest noarch 8.3.4-1.fc41 copr_base 20.9 MiB python3-trio noarch 0.23.1-6.fc41 fedora 4.9 MiB python3-typing-extensions noarch 4.12.2-3.fc41 fedora 464.5 KiB Installing dependencies: expat x86_64 2.6.4-1.fc41 updates 292.9 KiB libb2 x86_64 0.98.1-12.fc41 fedora 42.2 KiB mpdecimal x86_64 2.5.1-16.fc41 fedora 204.9 KiB python-pip-wheel noarch 24.3.1-1.fc41 copr_base 1.2 MiB python3 x86_64 3.13.1-2.fc41 updates 30.6 KiB python3-attrs noarch 24.3.0-2.fc41 copr_base 398.6 KiB python3-idna noarch 3.10-1.fc41 copr_base 629.0 KiB python3-iniconfig noarch 1.1.1-24.fc41 copr_base 20.6 KiB python3-libs x86_64 3.13.1-2.fc41 updates 40.2 MiB python3-outcome noarch 1.2.0-6.fc41 fedora 30.1 KiB python3-packaging noarch 24.2-2.fc41 copr_base 558.2 KiB python3-pluggy noarch 1.5.0-1.fc41 copr_base 193.2 KiB python3-sniffio noarch 1.3.1-3.fc41 fedora 35.0 KiB python3-sortedcontainers noarch 2.4.0-18.fc41 fedora 391.2 KiB tzdata noarch 2024b-1.fc41 updates 1.6 MiB Transaction Summary: Installing: 18 packages Total size of inbound packages is 15 MiB. Need to download 15 MiB. After this operation, 72 MiB extra will be used (install 72 MiB, remove 0 B). [ 1/18] python3-outcome-0:1.2.0-6.fc41. 100% | 85.4 KiB/s | 21.9 KiB | 00m00s [ 2/18] python3-typing-extensions-0:4.1 100% | 214.7 KiB/s | 93.8 KiB | 00m00s [ 3/18] python3-sortedcontainers-0:2.4. 100% | 263.5 KiB/s | 63.2 KiB | 00m00s [ 4/18] python3-sniffio-0:1.3.1-3.fc41. 100% | 49.6 KiB/s | 27.1 KiB | 00m01s [ 5/18] python3-0:3.13.1-2.fc41.x86_64 100% | 426.1 KiB/s | 26.8 KiB | 00m00s [ 6/18] python3-pytest-0:8.3.4-1.fc41.n 100% | 9.3 MiB/s | 2.0 MiB | 00m00s [ 7/18] libb2-0:0.98.1-12.fc41.x86_64 100% | 270.3 KiB/s | 25.7 KiB | 00m00s [ 8/18] python3-trio-0:0.23.1-6.fc41.no 100% | 1.0 MiB/s | 1.0 MiB | 00m01s [ 9/18] python3-iniconfig-0:1.1.1-24.fc 100% | 1.3 MiB/s | 18.6 KiB | 00m00s [10/18] python3-packaging-0:24.2-2.fc41 100% | 4.7 MiB/s | 144.0 KiB | 00m00s [11/18] python3-libs-0:3.13.1-2.fc41.x8 100% | 43.5 MiB/s | 8.9 MiB | 00m00s [12/18] python3-pluggy-0:1.5.0-1.fc41.n 100% | 2.2 MiB/s | 53.7 KiB | 00m00s [13/18] python3-idna-0:3.10-1.fc41.noar 100% | 3.2 MiB/s | 112.1 KiB | 00m00s [14/18] python3-attrs-0:24.3.0-2.fc41.n 100% | 2.8 MiB/s | 119.1 KiB | 00m00s [15/18] expat-0:2.6.4-1.fc41.x86_64 100% | 6.6 MiB/s | 114.5 KiB | 00m00s [16/18] mpdecimal-0:2.5.1-16.fc41.x86_6 100% | 593.0 KiB/s | 89.0 KiB | 00m00s [17/18] python-pip-wheel-0:24.3.1-1.fc4 100% | 13.4 MiB/s | 1.2 MiB | 00m00s [18/18] tzdata-0:2024b-1.fc41.noarch 100% | 2.0 MiB/s | 712.6 KiB | 00m00s >>> Status code: 404 for http://mirror.siena.edu/fedora/linux/updates/41/Everyth -------------------------------------------------------------------------------- [18/18] Total 100% | 9.7 MiB/s | 14.8 MiB | 00m02s Running transaction [ 1/20] Verify package files 100% | 352.0 B/s | 18.0 B | 00m00s [ 2/20] Prepare transaction 100% | 360.0 B/s | 18.0 B | 00m00s [ 3/20] Installing python-pip-wheel-0:2 100% | 155.5 MiB/s | 1.2 MiB | 00m00s [ 4/20] Installing tzdata-0:2024b-1.fc4 100% | 25.8 MiB/s | 1.9 MiB | 00m00s [ 5/20] Installing expat-0:2.6.4-1.fc41 100% | 96.0 MiB/s | 295.0 KiB | 00m00s [ 6/20] Installing mpdecimal-0:2.5.1-16 100% | 100.6 MiB/s | 206.0 KiB | 00m00s [ 7/20] Installing libb2-0:0.98.1-12.fc 100% | 7.0 MiB/s | 43.3 KiB | 00m00s [ 8/20] Installing python3-libs-0:3.13. 100% | 203.0 MiB/s | 40.6 MiB | 00m00s [ 9/20] Installing python3-0:3.13.1-2.f 100% | 31.6 MiB/s | 32.4 KiB | 00m00s [10/20] Installing python3-attrs-0:24.3 100% | 80.6 MiB/s | 412.9 KiB | 00m00s [11/20] Installing python3-outcome-0:1. 100% | 16.8 MiB/s | 34.4 KiB | 00m00s [12/20] Installing python3-sniffio-0:1. 100% | 19.7 MiB/s | 40.4 KiB | 00m00s [13/20] Installing python3-sortedcontai 100% | 193.2 MiB/s | 395.6 KiB | 00m00s [14/20] Installing python3-iniconfig-0: 100% | 11.5 MiB/s | 23.6 KiB | 00m00s [15/20] Installing python3-packaging-0: 100% | 111.4 MiB/s | 570.5 KiB | 00m00s [16/20] Installing python3-pluggy-0:1.5 100% | 64.9 MiB/s | 199.4 KiB | 00m00s [17/20] Installing python3-idna-0:3.10- 100% | 124.1 MiB/s | 635.3 KiB | 00m00s [18/20] Installing python3-trio-0:0.23. 100% | 162.0 MiB/s | 5.0 MiB | 00m00s [19/20] Installing python3-pytest-0:8.3 100% | 266.3 MiB/s | 21.0 MiB | 00m00s [20/20] Installing python3-typing-exten 100% | 15.2 MiB/s | 466.9 KiB | 00m00s Warning: skipped OpenPGP checks for 7 packages from repository: copr_base Complete! Finish: build setup for python-starlette-0.45.1-1.fc41.src.rpm Start: rpmbuild python-starlette-0.45.1-1.fc41.src.rpm Building target platforms: x86_64 Building for target x86_64 Reading /var/tmp/rpm-tmp.qrak41 setting SOURCE_DATE_EPOCH=1735603200 Executing(%mkbuilddir): /bin/sh -e /var/tmp/rpm-tmp.4BM8ed + umask 022 + cd /builddir/build/BUILD/python-starlette-0.45.1-build + test -d /builddir/build/BUILD/python-starlette-0.45.1-build + /usr/bin/chmod -Rf a+rX,u+w,g-w,o-w /builddir/build/BUILD/python-starlette-0.45.1-build + /usr/bin/rm -rf /builddir/build/BUILD/python-starlette-0.45.1-build + /usr/bin/mkdir -p /builddir/build/BUILD/python-starlette-0.45.1-build + /usr/bin/mkdir -p /builddir/build/BUILD/python-starlette-0.45.1-build/SPECPARTS + RPM_EC=0 ++ jobs -p + exit 0 Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.V92lht + umask 022 + cd /builddir/build/BUILD/python-starlette-0.45.1-build + cd /builddir/build/BUILD/python-starlette-0.45.1-build + rm -rf python-starlette-0.45.1 + /usr/lib/rpm/rpmuncompress -x -C python-starlette-0.45.1 /builddir/build/SOURCES/starlette-0.45.1.tar.gz + STATUS=0 + '[' 0 -ne 0 ']' + cd python-starlette-0.45.1 + /usr/bin/chmod -Rf a+rX,u+w,g-w,o-w . + /usr/lib/rpm/rpmuncompress /builddir/build/SOURCES/0001-Revert-test-adjustments-from-5ccbc62175eece867b49811.patch + /usr/bin/patch -p1 -s --fuzz=0 --no-backup-if-mismatch -f + RPM_EC=0 ++ jobs -p + exit 0 Executing(%generate_buildrequires): /bin/sh -e /var/tmp/rpm-tmp.jf4lLD + umask 022 + cd /builddir/build/BUILD/python-starlette-0.45.1-build + cd python-starlette-0.45.1 + echo pyproject-rpm-macros + exit 0 Wrote: /builddir/build/SRPMS/python-starlette-0.45.1-1.fc41.buildreqs.nosrc.rpm INFO: Going to install missing dynamic buildrequires Updating and loading repositories: updates 100% | 1.1 MiB/s | 30.7 KiB | 00m00s fedora 100% | 1.1 MiB/s | 30.8 KiB | 00m00s Copr repository 100% | 31.4 KiB/s | 1.5 KiB | 00m00s Repositories loaded. Package "python3-pytest-8.3.4-1.fc41.noarch" is already installed. Package "python3-trio-0.23.1-6.fc41.noarch" is already installed. Package "python3-typing-extensions-4.12.2-3.fc41.noarch" is already installed. Package Arch Version Repository Size Installing: pyproject-rpm-macros noarch 1.16.3-1.fc41 updates 113.7 KiB Installing dependencies: python-rpm-macros noarch 3.13-3.fc41 fedora 22.1 KiB python3-rpm-macros noarch 3.13-3.fc41 fedora 6.4 KiB Transaction Summary: Installing: 3 packages Total size of inbound packages is 75 KiB. Need to download 75 KiB. After this operation, 142 KiB extra will be used (install 142 KiB, remove 0 B). [1/3] python3-rpm-macros-0:3.13-3.fc41. 100% | 153.6 KiB/s | 12.4 KiB | 00m00s [2/3] python-rpm-macros-0:3.13-3.fc41.n 100% | 212.9 KiB/s | 17.7 KiB | 00m00s [3/3] pyproject-rpm-macros-0:1.16.3-1.f 100% | 164.9 KiB/s | 44.7 KiB | 00m00s -------------------------------------------------------------------------------- [3/3] Total 100% | 228.7 KiB/s | 74.8 KiB | 00m00s Running transaction [1/5] Verify package files 100% | 0.0 B/s | 3.0 B | 00m00s [2/5] Prepare transaction 100% | 600.0 B/s | 3.0 B | 00m00s [3/5] Installing python-rpm-macros-0:3. 100% | 22.3 MiB/s | 22.8 KiB | 00m00s [4/5] Installing python3-rpm-macros-0:3 100% | 0.0 B/s | 6.7 KiB | 00m00s [5/5] Installing pyproject-rpm-macros-0 100% | 8.1 MiB/s | 115.7 KiB | 00m00s Complete! Building target platforms: x86_64 Building for target x86_64 Reading /var/tmp/rpm-tmp.xC5mAU setting SOURCE_DATE_EPOCH=1735603200 Executing(%generate_buildrequires): /bin/sh -e /var/tmp/rpm-tmp.tl3Bpy + umask 022 + cd /builddir/build/BUILD/python-starlette-0.45.1-build + cd python-starlette-0.45.1 + echo pyproject-rpm-macros + echo python3-devel + echo 'python3dist(packaging)' + echo 'python3dist(pip) >= 19' + '[' -f pyproject.toml ']' + echo '(python3dist(tomli) if python3-devel < 3.11)' + rm -rfv '*.dist-info/' + '[' -f /usr/bin/python3 ']' + mkdir -p /builddir/build/BUILD/python-starlette-0.45.1-build/python-starlette-0.45.1/.pyproject-builddir + echo -n + CFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer ' + CXXFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer ' + FFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -I/usr/lib64/gfortran/modules ' + FCFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -I/usr/lib64/gfortran/modules ' + VALAFLAGS=-g + RUSTFLAGS='-Copt-level=3 -Cdebuginfo=2 -Ccodegen-units=1 -Cstrip=none -Cforce-frame-pointers=yes --cap-lints=warn' + LDFLAGS='-Wl,-z,relro -Wl,--as-needed -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 ' + LT_SYS_LIBRARY_PATH=/usr/lib64: + CC=gcc + CXX=g++ + TMPDIR=/builddir/build/BUILD/python-starlette-0.45.1-build/python-starlette-0.45.1/.pyproject-builddir + RPM_TOXENV=py313 + HOSTNAME=rpmbuild + /usr/bin/python3 -Bs /usr/lib/rpm/redhat/pyproject_buildrequires.py --generate-extras --python3_pkgversion 3 --wheeldir /builddir/build/BUILD/python-starlette-0.45.1-build/python-starlette-0.45.1/pyproject-wheeldir --output /builddir/build/BUILD/python-starlette-0.45.1-build/python-starlette-0.45.1-1.fc41.x86_64-pyproject-buildrequires -x full Handling hatchling from build-system.requires Requirement not satisfied: hatchling Exiting dependency generation pass: build backend + cat /builddir/build/BUILD/python-starlette-0.45.1-build/python-starlette-0.45.1-1.fc41.x86_64-pyproject-buildrequires + rm -rfv '*.dist-info/' + RPM_EC=0 ++ jobs -p + exit 0 Wrote: /builddir/build/SRPMS/python-starlette-0.45.1-1.fc41.buildreqs.nosrc.rpm INFO: Going to install missing dynamic buildrequires Updating and loading repositories: fedora 100% | 1.2 MiB/s | 30.8 KiB | 00m00s updates 100% | 1.1 MiB/s | 30.7 KiB | 00m00s Copr repository 100% | 49.6 KiB/s | 1.5 KiB | 00m00s Repositories loaded. Package "pyproject-rpm-macros-1.16.3-1.fc41.noarch" is already installed. Package "python3-packaging-24.2-2.fc41.noarch" is already installed. Package "python3-pytest-8.3.4-1.fc41.noarch" is already installed. Package "python3-trio-0.23.1-6.fc41.noarch" is already installed. Package "python3-typing-extensions-4.12.2-3.fc41.noarch" is already installed. Package Arch Version Repository Size Installing: python3-devel x86_64 3.13.1-2.fc41 updates 1.8 MiB python3-hatchling noarch 1.25.0-1.fc41 fedora 709.9 KiB python3-pip noarch 24.3.1-1.fc41 copr_base 11.4 MiB Installing dependencies: python3-pathspec noarch 0.12.1-7.fc41 copr_base 195.2 KiB python3-rpm-generators noarch 14-11.fc41 fedora 81.7 KiB python3-trove-classifiers noarch 2024.7.2-1.fc41 fedora 91.8 KiB Transaction Summary: Installing: 6 packages Total size of inbound packages is 3 MiB. Need to download 3 MiB. After this operation, 14 MiB extra will be used (install 14 MiB, remove 0 B). [1/6] python3-pip-0:24.3.1-1.fc41.noarc 100% | 24.9 MiB/s | 2.5 MiB | 00m00s [2/6] python3-devel-0:3.13.1-2.fc41.x86 100% | 1.8 MiB/s | 403.1 KiB | 00m00s [3/6] python3-pathspec-0:0.12.1-7.fc41. 100% | 2.1 MiB/s | 56.8 KiB | 00m00s [4/6] python3-trove-classifiers-0:2024. 100% | 107.3 KiB/s | 26.7 KiB | 00m00s [5/6] python3-rpm-generators-0:14-11.fc 100% | 122.6 KiB/s | 29.3 KiB | 00m00s [6/6] python3-hatchling-0:1.25.0-1.fc41 100% | 495.7 KiB/s | 241.4 KiB | 00m00s -------------------------------------------------------------------------------- [6/6] Total 100% | 5.9 MiB/s | 3.3 MiB | 00m01s Running transaction [1/8] Verify package files 100% | 428.0 B/s | 6.0 B | 00m00s [2/8] Prepare transaction 100% | 206.0 B/s | 6.0 B | 00m00s [3/8] Installing python3-rpm-generators 100% | 81.0 MiB/s | 82.9 KiB | 00m00s [4/8] Installing python3-pathspec-0:0.1 100% | 65.8 MiB/s | 202.0 KiB | 00m00s [5/8] Installing python3-trove-classifi 100% | 46.4 MiB/s | 95.0 KiB | 00m00s [6/8] Installing python3-hatchling-0:1. 100% | 46.3 MiB/s | 759.1 KiB | 00m00s [7/8] Installing python3-devel-0:3.13.1 100% | 95.6 MiB/s | 1.8 MiB | 00m00s [8/8] Installing python3-pip-0:24.3.1-1 100% | 101.6 MiB/s | 11.7 MiB | 00m00s Warning: skipped OpenPGP checks for 2 packages from repository: copr_base Complete! Building target platforms: x86_64 Building for target x86_64 Reading /var/tmp/rpm-tmp.xnDJCc setting SOURCE_DATE_EPOCH=1735603200 Executing(%generate_buildrequires): /bin/sh -e /var/tmp/rpm-tmp.w67g8E + umask 022 + cd /builddir/build/BUILD/python-starlette-0.45.1-build + cd python-starlette-0.45.1 + echo pyproject-rpm-macros + echo python3-devel + echo 'python3dist(packaging)' + echo 'python3dist(pip) >= 19' + '[' -f pyproject.toml ']' + echo '(python3dist(tomli) if python3-devel < 3.11)' + rm -rfv '*.dist-info/' + '[' -f /usr/bin/python3 ']' + mkdir -p /builddir/build/BUILD/python-starlette-0.45.1-build/python-starlette-0.45.1/.pyproject-builddir + echo -n + CFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer ' + CXXFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer ' + FFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -I/usr/lib64/gfortran/modules ' + FCFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -I/usr/lib64/gfortran/modules ' + VALAFLAGS=-g + RUSTFLAGS='-Copt-level=3 -Cdebuginfo=2 -Ccodegen-units=1 -Cstrip=none -Cforce-frame-pointers=yes --cap-lints=warn' + LDFLAGS='-Wl,-z,relro -Wl,--as-needed -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 ' + LT_SYS_LIBRARY_PATH=/usr/lib64: + CC=gcc + CXX=g++ + TMPDIR=/builddir/build/BUILD/python-starlette-0.45.1-build/python-starlette-0.45.1/.pyproject-builddir + RPM_TOXENV=py313 + HOSTNAME=rpmbuild + /usr/bin/python3 -Bs /usr/lib/rpm/redhat/pyproject_buildrequires.py --generate-extras --python3_pkgversion 3 --wheeldir /builddir/build/BUILD/python-starlette-0.45.1-build/python-starlette-0.45.1/pyproject-wheeldir --output /builddir/build/BUILD/python-starlette-0.45.1-build/python-starlette-0.45.1-1.fc41.x86_64-pyproject-buildrequires -x full Handling hatchling from build-system.requires Requirement satisfied: hatchling (installed: hatchling 1.25.0) Handling anyio<5,>=3.4.0 from hook generated metadata: Requires-Dist (starlette) Requirement not satisfied: anyio<5,>=3.4.0 Handling typing-extensions>=3.10.0; python_version < '3.10' from hook generated metadata: Requires-Dist (starlette) Ignoring alien requirement: typing-extensions>=3.10.0; python_version < '3.10' Handling httpx<0.29.0,>=0.27.0; extra == 'full' from hook generated metadata: Requires-Dist (starlette) Requirement not satisfied: httpx<0.29.0,>=0.27.0; extra == 'full' Handling itsdangerous; extra == 'full' from hook generated metadata: Requires-Dist (starlette) Requirement not satisfied: itsdangerous; extra == 'full' Handling jinja2; extra == 'full' from hook generated metadata: Requires-Dist (starlette) Requirement not satisfied: jinja2; extra == 'full' Handling python-multipart>=0.0.18; extra == 'full' from hook generated metadata: Requires-Dist (starlette) Requirement not satisfied: python-multipart>=0.0.18; extra == 'full' Handling pyyaml; extra == 'full' from hook generated metadata: Requires-Dist (starlette) Requirement not satisfied: pyyaml; extra == 'full' + cat /builddir/build/BUILD/python-starlette-0.45.1-build/python-starlette-0.45.1-1.fc41.x86_64-pyproject-buildrequires + rm -rfv starlette-0.45.1.dist-info/ removed 'starlette-0.45.1.dist-info/METADATA' removed directory 'starlette-0.45.1.dist-info/' + RPM_EC=0 ++ jobs -p + exit 0 Wrote: /builddir/build/SRPMS/python-starlette-0.45.1-1.fc41.buildreqs.nosrc.rpm INFO: Going to install missing dynamic buildrequires Updating and loading repositories: fedora 100% | 1.1 MiB/s | 30.8 KiB | 00m00s updates 100% | 1.1 MiB/s | 30.7 KiB | 00m00s Copr repository 100% | 51.2 KiB/s | 1.5 KiB | 00m00s Repositories loaded. Package "pyproject-rpm-macros-1.16.3-1.fc41.noarch" is already installed. Package "python3-devel-3.13.1-2.fc41.x86_64" is already installed. Package "python3-hatchling-1.25.0-1.fc41.noarch" is already installed. Package "python3-packaging-24.2-2.fc41.noarch" is already installed. Package "python3-pip-24.3.1-1.fc41.noarch" is already installed. Package "python3-pytest-8.3.4-1.fc41.noarch" is already installed. Package "python3-trio-0.23.1-6.fc41.noarch" is already installed. Package "python3-typing-extensions-4.12.2-3.fc41.noarch" is already installed. Package Arch Version Repository Size Installing: python3-anyio noarch 3.7.1-5.fc41 fedora 851.7 KiB python3-httpx noarch 0.27.2-1.fc41 copr_base 932.8 KiB python3-itsdangerous noarch 2.2.0-1.fc41 copr_base 101.9 KiB python3-jinja2 noarch 3.1.4-5.fc41 copr_base 2.9 MiB python3-python-multipart noarch 0.0.20-1.fc41 updates 231.6 KiB python3-pyyaml x86_64 6.0.1-18.fc41 fedora 791.1 KiB Installing dependencies: libyaml x86_64 0.2.5-15.fc41 fedora 134.4 KiB python3-certifi noarch 2024.08.30-1.fc41 copr_base 6.8 KiB python3-h11 noarch 0.14.0-5.fc41 fedora 550.6 KiB python3-httpcore noarch 1.0.7-1.fc41 copr_base 785.9 KiB python3-markupsafe x86_64 3.0.2-1.fc41 copr_base 61.4 KiB Transaction Summary: Installing: 11 packages Total size of inbound packages is 2 MiB. Need to download 2 MiB. After this operation, 7 MiB extra will be used (install 7 MiB, remove 0 B). [ 1/11] python3-httpx-0:0.27.2-1.fc41.n 100% | 2.8 MiB/s | 194.6 KiB | 00m00s [ 2/11] python3-itsdangerous-0:2.2.0-1. 100% | 1.3 MiB/s | 41.7 KiB | 00m00s [ 3/11] python3-jinja2-0:3.1.4-5.fc41.n 100% | 11.0 MiB/s | 471.8 KiB | 00m00s [ 4/11] python3-python-multipart-0:0.0. 100% | 379.3 KiB/s | 62.2 KiB | 00m00s [ 5/11] libyaml-0:0.2.5-15.fc41.x86_64 100% | 942.8 KiB/s | 59.4 KiB | 00m00s [ 6/11] python3-anyio-0:3.7.1-5.fc41.no 100% | 882.1 KiB/s | 217.9 KiB | 00m00s [ 7/11] python3-pyyaml-0:6.0.1-18.fc41. 100% | 2.2 MiB/s | 231.6 KiB | 00m00s [ 8/11] python3-markupsafe-0:3.0.2-1.fc 100% | 1.1 MiB/s | 30.5 KiB | 00m00s [ 9/11] python3-certifi-0:2024.08.30-1. 100% | 678.6 KiB/s | 14.9 KiB | 00m00s [10/11] python3-httpcore-0:1.0.7-1.fc41 100% | 5.7 MiB/s | 133.9 KiB | 00m00s [11/11] python3-h11-0:0.14.0-5.fc41.noa 100% | 2.3 MiB/s | 139.5 KiB | 00m00s -------------------------------------------------------------------------------- [11/11] Total 100% | 4.2 MiB/s | 1.6 MiB | 00m00s Running transaction [ 1/13] Verify package files 100% | 1.5 KiB/s | 11.0 B | 00m00s [ 2/13] Prepare transaction 100% | 440.0 B/s | 11.0 B | 00m00s [ 3/13] Installing python3-certifi-0:20 100% | 5.1 MiB/s | 10.4 KiB | 00m00s [ 4/13] Installing python3-h11-0:0.14.0 100% | 92.0 MiB/s | 565.3 KiB | 00m00s [ 5/13] Installing python3-httpcore-0:1 100% | 112.5 MiB/s | 806.7 KiB | 00m00s [ 6/13] Installing python3-markupsafe-0 100% | 32.0 MiB/s | 65.5 KiB | 00m00s [ 7/13] Installing libyaml-0:0.2.5-15.f 100% | 132.6 MiB/s | 135.8 KiB | 00m00s [ 8/13] Installing python3-anyio-0:3.7. 100% | 85.5 MiB/s | 875.6 KiB | 00m00s [ 9/13] Installing python3-httpx-0:0.27 100% | 103.0 MiB/s | 948.8 KiB | 00m00s [10/13] Installing python3-pyyaml-0:6.0 100% | 112.3 MiB/s | 804.9 KiB | 00m00s [11/13] Installing python3-jinja2-0:3.1 100% | 181.6 MiB/s | 2.9 MiB | 00m00s [12/13] Installing python3-itsdangerous 100% | 35.4 MiB/s | 108.6 KiB | 00m00s [13/13] Installing python3-python-multi 100% | 11.6 MiB/s | 238.5 KiB | 00m00s Warning: skipped OpenPGP checks for 6 packages from repository: copr_base Complete! Building target platforms: x86_64 Building for target x86_64 Reading /var/tmp/rpm-tmp.fHSixA setting SOURCE_DATE_EPOCH=1735603200 Executing(%generate_buildrequires): /bin/sh -e /var/tmp/rpm-tmp.Gn4u6T + umask 022 + cd /builddir/build/BUILD/python-starlette-0.45.1-build + cd python-starlette-0.45.1 + echo pyproject-rpm-macros + echo python3-devel + echo 'python3dist(packaging)' + echo 'python3dist(pip) >= 19' + '[' -f pyproject.toml ']' + echo '(python3dist(tomli) if python3-devel < 3.11)' + rm -rfv '*.dist-info/' + '[' -f /usr/bin/python3 ']' + mkdir -p /builddir/build/BUILD/python-starlette-0.45.1-build/python-starlette-0.45.1/.pyproject-builddir + echo -n + CFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer ' + CXXFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer ' + FFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -I/usr/lib64/gfortran/modules ' + FCFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -I/usr/lib64/gfortran/modules ' + VALAFLAGS=-g + RUSTFLAGS='-Copt-level=3 -Cdebuginfo=2 -Ccodegen-units=1 -Cstrip=none -Cforce-frame-pointers=yes --cap-lints=warn' + LDFLAGS='-Wl,-z,relro -Wl,--as-needed -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 ' + LT_SYS_LIBRARY_PATH=/usr/lib64: + CC=gcc + CXX=g++ + TMPDIR=/builddir/build/BUILD/python-starlette-0.45.1-build/python-starlette-0.45.1/.pyproject-builddir + RPM_TOXENV=py313 + HOSTNAME=rpmbuild + /usr/bin/python3 -Bs /usr/lib/rpm/redhat/pyproject_buildrequires.py --generate-extras --python3_pkgversion 3 --wheeldir /builddir/build/BUILD/python-starlette-0.45.1-build/python-starlette-0.45.1/pyproject-wheeldir --output /builddir/build/BUILD/python-starlette-0.45.1-build/python-starlette-0.45.1-1.fc41.x86_64-pyproject-buildrequires -x full Handling hatchling from build-system.requires Requirement satisfied: hatchling (installed: hatchling 1.25.0) Handling anyio<5,>=3.4.0 from hook generated metadata: Requires-Dist (starlette) Requirement satisfied: anyio<5,>=3.4.0 (installed: anyio 3.7.1) Handling typing-extensions>=3.10.0; python_version < '3.10' from hook generated metadata: Requires-Dist (starlette) Ignoring alien requirement: typing-extensions>=3.10.0; python_version < '3.10' Handling httpx<0.29.0,>=0.27.0; extra == 'full' from hook generated metadata: Requires-Dist (starlette) Requirement satisfied: httpx<0.29.0,>=0.27.0; extra == 'full' (installed: httpx 0.27.2) Handling itsdangerous; extra == 'full' from hook generated metadata: Requires-Dist (starlette) Requirement satisfied: itsdangerous; extra == 'full' (installed: itsdangerous 2.2.0) Handling jinja2; extra == 'full' from hook generated metadata: Requires-Dist (starlette) Requirement satisfied: jinja2; extra == 'full' (installed: jinja2 3.1.4) Handling python-multipart>=0.0.18; extra == 'full' from hook generated metadata: Requires-Dist (starlette) Requirement satisfied: python-multipart>=0.0.18; extra == 'full' (installed: python-multipart 0.0.20) Handling pyyaml; extra == 'full' from hook generated metadata: Requires-Dist (starlette) Requirement satisfied: pyyaml; extra == 'full' (installed: pyyaml 6.0.1) + cat /builddir/build/BUILD/python-starlette-0.45.1-build/python-starlette-0.45.1-1.fc41.x86_64-pyproject-buildrequires + rm -rfv starlette-0.45.1.dist-info/ removed 'starlette-0.45.1.dist-info/METADATA' removed directory 'starlette-0.45.1.dist-info/' + RPM_EC=0 ++ jobs -p + exit 0 Wrote: /builddir/build/SRPMS/python-starlette-0.45.1-1.fc41.buildreqs.nosrc.rpm INFO: Going to install missing dynamic buildrequires Updating and loading repositories: fedora 100% | 1.1 MiB/s | 30.8 KiB | 00m00s Copr repository 100% | 51.2 KiB/s | 1.5 KiB | 00m00s updates 100% | 1.0 MiB/s | 30.7 KiB | 00m00s Repositories loaded. Package "pyproject-rpm-macros-1.16.3-1.fc41.noarch" is already installed. Package "python3-devel-3.13.1-2.fc41.x86_64" is already installed. Package "python3-hatchling-1.25.0-1.fc41.noarch" is already installed. Package "python3-itsdangerous-2.2.0-1.fc41.noarch" is already installed. Package "python3-jinja2-3.1.4-5.fc41.noarch" is already installed. Package "python3-packaging-24.2-2.fc41.noarch" is already installed. Package "python3-pip-24.3.1-1.fc41.noarch" is already installed. Package "python3-pytest-8.3.4-1.fc41.noarch" is already installed. Package "python3-python-multipart-0.0.20-1.fc41.noarch" is already installed. Package "python3-pyyaml-6.0.1-18.fc41.x86_64" is already installed. Package "python3-trio-0.23.1-6.fc41.noarch" is already installed. Package "python3-typing-extensions-4.12.2-3.fc41.noarch" is already installed. Nothing to do. Building target platforms: x86_64 Building for target x86_64 Reading /var/tmp/rpm-tmp.9WadKB setting SOURCE_DATE_EPOCH=1735603200 Executing(%generate_buildrequires): /bin/sh -e /var/tmp/rpm-tmp.JpyKa2 + umask 022 + cd /builddir/build/BUILD/python-starlette-0.45.1-build + cd python-starlette-0.45.1 + echo pyproject-rpm-macros + echo python3-devel + echo 'python3dist(packaging)' + echo 'python3dist(pip) >= 19' + '[' -f pyproject.toml ']' + echo '(python3dist(tomli) if python3-devel < 3.11)' + rm -rfv '*.dist-info/' + '[' -f /usr/bin/python3 ']' + mkdir -p /builddir/build/BUILD/python-starlette-0.45.1-build/python-starlette-0.45.1/.pyproject-builddir + echo -n + CFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer ' + CXXFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer ' + FFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -I/usr/lib64/gfortran/modules ' + FCFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -I/usr/lib64/gfortran/modules ' + VALAFLAGS=-g + RUSTFLAGS='-Copt-level=3 -Cdebuginfo=2 -Ccodegen-units=1 -Cstrip=none -Cforce-frame-pointers=yes --cap-lints=warn' + LDFLAGS='-Wl,-z,relro -Wl,--as-needed -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 ' + LT_SYS_LIBRARY_PATH=/usr/lib64: + CC=gcc + CXX=g++ + TMPDIR=/builddir/build/BUILD/python-starlette-0.45.1-build/python-starlette-0.45.1/.pyproject-builddir + RPM_TOXENV=py313 + HOSTNAME=rpmbuild + /usr/bin/python3 -Bs /usr/lib/rpm/redhat/pyproject_buildrequires.py --generate-extras --python3_pkgversion 3 --wheeldir /builddir/build/BUILD/python-starlette-0.45.1-build/python-starlette-0.45.1/pyproject-wheeldir --output /builddir/build/BUILD/python-starlette-0.45.1-build/python-starlette-0.45.1-1.fc41.x86_64-pyproject-buildrequires -x full Handling hatchling from build-system.requires Requirement satisfied: hatchling (installed: hatchling 1.25.0) Handling anyio<5,>=3.4.0 from hook generated metadata: Requires-Dist (starlette) Requirement satisfied: anyio<5,>=3.4.0 (installed: anyio 3.7.1) Handling typing-extensions>=3.10.0; python_version < '3.10' from hook generated metadata: Requires-Dist (starlette) Ignoring alien requirement: typing-extensions>=3.10.0; python_version < '3.10' Handling httpx<0.29.0,>=0.27.0; extra == 'full' from hook generated metadata: Requires-Dist (starlette) Requirement satisfied: httpx<0.29.0,>=0.27.0; extra == 'full' (installed: httpx 0.27.2) Handling itsdangerous; extra == 'full' from hook generated metadata: Requires-Dist (starlette) Requirement satisfied: itsdangerous; extra == 'full' (installed: itsdangerous 2.2.0) Handling jinja2; extra == 'full' from hook generated metadata: Requires-Dist (starlette) Requirement satisfied: jinja2; extra == 'full' (installed: jinja2 3.1.4) Handling python-multipart>=0.0.18; extra == 'full' from hook generated metadata: Requires-Dist (starlette) Requirement satisfied: python-multipart>=0.0.18; extra == 'full' (installed: python-multipart 0.0.20) Handling pyyaml; extra == 'full' from hook generated metadata: Requires-Dist (starlette) Requirement satisfied: pyyaml; extra == 'full' (installed: pyyaml 6.0.1) + cat /builddir/build/BUILD/python-starlette-0.45.1-build/python-starlette-0.45.1-1.fc41.x86_64-pyproject-buildrequires + rm -rfv starlette-0.45.1.dist-info/ removed 'starlette-0.45.1.dist-info/METADATA' removed directory 'starlette-0.45.1.dist-info/' + RPM_EC=0 ++ jobs -p + exit 0 Executing(%conf): /bin/sh -e /var/tmp/rpm-tmp.CDpVqQ + umask 022 + cd /builddir/build/BUILD/python-starlette-0.45.1-build + CFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer ' + export CFLAGS + CXXFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer ' + export CXXFLAGS + FFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -I/usr/lib64/gfortran/modules ' + export FFLAGS + FCFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -I/usr/lib64/gfortran/modules ' + export FCFLAGS + VALAFLAGS=-g + export VALAFLAGS + RUSTFLAGS='-Copt-level=3 -Cdebuginfo=2 -Ccodegen-units=1 -Cstrip=none -Cforce-frame-pointers=yes -Clink-arg=-specs=/usr/lib/rpm/redhat/redhat-package-notes --cap-lints=warn' + export RUSTFLAGS + LDFLAGS='-Wl,-z,relro -Wl,--as-needed -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes ' + export LDFLAGS + LT_SYS_LIBRARY_PATH=/usr/lib64: + export LT_SYS_LIBRARY_PATH + CC=gcc + export CC + CXX=g++ + export CXX + cd python-starlette-0.45.1 + RPM_EC=0 ++ jobs -p + exit 0 Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.rfC5cp + umask 022 + cd /builddir/build/BUILD/python-starlette-0.45.1-build + CFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer ' + export CFLAGS + CXXFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer ' + export CXXFLAGS + FFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -I/usr/lib64/gfortran/modules ' + export FFLAGS + FCFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -I/usr/lib64/gfortran/modules ' + export FCFLAGS + VALAFLAGS=-g + export VALAFLAGS + RUSTFLAGS='-Copt-level=3 -Cdebuginfo=2 -Ccodegen-units=1 -Cstrip=none -Cforce-frame-pointers=yes -Clink-arg=-specs=/usr/lib/rpm/redhat/redhat-package-notes --cap-lints=warn' + export RUSTFLAGS + LDFLAGS='-Wl,-z,relro -Wl,--as-needed -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes ' + export LDFLAGS + LT_SYS_LIBRARY_PATH=/usr/lib64: + export LT_SYS_LIBRARY_PATH + CC=gcc + export CC + CXX=g++ + export CXX + cd python-starlette-0.45.1 + mkdir -p /builddir/build/BUILD/python-starlette-0.45.1-build/python-starlette-0.45.1/.pyproject-builddir + CFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer ' + CXXFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer ' + FFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -I/usr/lib64/gfortran/modules ' + FCFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -I/usr/lib64/gfortran/modules ' + VALAFLAGS=-g + RUSTFLAGS='-Copt-level=3 -Cdebuginfo=2 -Ccodegen-units=1 -Cstrip=none -Cforce-frame-pointers=yes -Clink-arg=-specs=/usr/lib/rpm/redhat/redhat-package-notes --cap-lints=warn' + LDFLAGS='-Wl,-z,relro -Wl,--as-needed -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes ' + LT_SYS_LIBRARY_PATH=/usr/lib64: + CC=gcc + CXX=g++ + TMPDIR=/builddir/build/BUILD/python-starlette-0.45.1-build/python-starlette-0.45.1/.pyproject-builddir + /usr/bin/python3 -Bs /usr/lib/rpm/redhat/pyproject_wheel.py /builddir/build/BUILD/python-starlette-0.45.1-build/python-starlette-0.45.1/pyproject-wheeldir Processing /builddir/build/BUILD/python-starlette-0.45.1-build/python-starlette-0.45.1 Preparing metadata (pyproject.toml): started Running command Preparing metadata (pyproject.toml) Preparing metadata (pyproject.toml): finished with status 'done' Building wheels for collected packages: starlette Building wheel for starlette (pyproject.toml): started Running command Building wheel for starlette (pyproject.toml) Building wheel for starlette (pyproject.toml): finished with status 'done' Created wheel for starlette: filename=starlette-0.45.1-py3-none-any.whl size=71259 sha256=eaaec706a7d8453dc88aec382647b7a5a84450b44f641578b8d2b9fe6de42d57 Stored in directory: /builddir/.cache/pip/wheels/66/3c/79/83bb529496f93240329ff0a70fae7305e1691146cea0d281ef Successfully built starlette + RPM_EC=0 ++ jobs -p + exit 0 Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.fIBIwM + umask 022 + cd /builddir/build/BUILD/python-starlette-0.45.1-build + '[' /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT '!=' / ']' + rm -rf /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT ++ dirname /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT + mkdir -p /builddir/build/BUILD/python-starlette-0.45.1-build + mkdir /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT + CFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer ' + export CFLAGS + CXXFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer ' + export CXXFLAGS + FFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -I/usr/lib64/gfortran/modules ' + export FFLAGS + FCFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -I/usr/lib64/gfortran/modules ' + export FCFLAGS + VALAFLAGS=-g + export VALAFLAGS + RUSTFLAGS='-Copt-level=3 -Cdebuginfo=2 -Ccodegen-units=1 -Cstrip=none -Cforce-frame-pointers=yes -Clink-arg=-specs=/usr/lib/rpm/redhat/redhat-package-notes --cap-lints=warn' + export RUSTFLAGS + LDFLAGS='-Wl,-z,relro -Wl,--as-needed -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes ' + export LDFLAGS + LT_SYS_LIBRARY_PATH=/usr/lib64: + export LT_SYS_LIBRARY_PATH + CC=gcc + export CC + CXX=g++ + export CXX + cd python-starlette-0.45.1 ++ ls /builddir/build/BUILD/python-starlette-0.45.1-build/python-starlette-0.45.1/pyproject-wheeldir/starlette-0.45.1-py3-none-any.whl ++ xargs basename --multiple ++ sed -E 's/([^-]+)-([^-]+)-.+\.whl/\1==\2/' + specifier=starlette==0.45.1 + '[' -z starlette==0.45.1 ']' + TMPDIR=/builddir/build/BUILD/python-starlette-0.45.1-build/python-starlette-0.45.1/.pyproject-builddir + /usr/bin/python3 -m pip install --root /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT --prefix /usr --no-deps --disable-pip-version-check --progress-bar off --verbose --ignore-installed --no-warn-script-location --no-index --no-cache-dir --find-links /builddir/build/BUILD/python-starlette-0.45.1-build/python-starlette-0.45.1/pyproject-wheeldir starlette==0.45.1 Using pip 24.3.1 from /usr/lib/python3.13/site-packages/pip (python 3.13) Looking in links: /builddir/build/BUILD/python-starlette-0.45.1-build/python-starlette-0.45.1/pyproject-wheeldir Processing ./pyproject-wheeldir/starlette-0.45.1-py3-none-any.whl Installing collected packages: starlette Successfully installed starlette-0.45.1 + '[' -d /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/bin ']' + rm -f /builddir/build/BUILD/python-starlette-0.45.1-build/python-starlette-0.45.1-1.fc41.x86_64-pyproject-ghost-distinfo + site_dirs=() + '[' -d /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/lib/python3.13/site-packages ']' + site_dirs+=("/usr/lib/python3.13/site-packages") + '[' /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/lib64/python3.13/site-packages '!=' /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/lib/python3.13/site-packages ']' + '[' -d /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/lib64/python3.13/site-packages ']' + for site_dir in ${site_dirs[@]} + for distinfo in /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT$site_dir/*.dist-info + echo '%ghost /usr/lib/python3.13/site-packages/starlette-0.45.1.dist-info' + sed -i s/pip/rpm/ /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/lib/python3.13/site-packages/starlette-0.45.1.dist-info/INSTALLER + PYTHONPATH=/usr/lib/rpm/redhat + /usr/bin/python3 -B /usr/lib/rpm/redhat/pyproject_preprocess_record.py --buildroot /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT --record /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/lib/python3.13/site-packages/starlette-0.45.1.dist-info/RECORD --output /builddir/build/BUILD/python-starlette-0.45.1-build/python-starlette-0.45.1-1.fc41.x86_64-pyproject-record + rm -fv /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/lib/python3.13/site-packages/starlette-0.45.1.dist-info/RECORD removed '/builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/lib/python3.13/site-packages/starlette-0.45.1.dist-info/RECORD' + rm -fv /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/lib/python3.13/site-packages/starlette-0.45.1.dist-info/REQUESTED removed '/builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/lib/python3.13/site-packages/starlette-0.45.1.dist-info/REQUESTED' ++ wc -l /builddir/build/BUILD/python-starlette-0.45.1-build/python-starlette-0.45.1-1.fc41.x86_64-pyproject-ghost-distinfo ++ cut -f1 '-d ' + lines=1 + '[' 1 -ne 1 ']' + RPM_FILES_ESCAPE=4.19 + /usr/bin/python3 /usr/lib/rpm/redhat/pyproject_save_files.py --output-files /builddir/build/BUILD/python-starlette-0.45.1-build/python-starlette-0.45.1-1.fc41.x86_64-pyproject-files --output-modules /builddir/build/BUILD/python-starlette-0.45.1-build/python-starlette-0.45.1-1.fc41.x86_64-pyproject-modules --buildroot /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT --sitelib /usr/lib/python3.13/site-packages --sitearch /usr/lib64/python3.13/site-packages --python-version 3.13 --pyproject-record /builddir/build/BUILD/python-starlette-0.45.1-build/python-starlette-0.45.1-1.fc41.x86_64-pyproject-record --prefix /usr -l starlette + /usr/lib/rpm/check-buildroot + /usr/lib/rpm/redhat/brp-ldconfig + /usr/lib/rpm/brp-compress + /usr/lib/rpm/brp-strip /usr/bin/strip + /usr/lib/rpm/brp-strip-comment-note /usr/bin/strip /usr/bin/objdump + /usr/lib/rpm/redhat/brp-strip-lto /usr/bin/strip + /usr/lib/rpm/brp-strip-static-archive /usr/bin/strip + /usr/lib/rpm/check-rpaths + /usr/lib/rpm/redhat/brp-mangle-shebangs + /usr/lib/rpm/brp-remove-la-files + env /usr/lib/rpm/redhat/brp-python-bytecompile '' 1 0 -j2 Bytecompiling .py files below /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/lib/python3.13 using python3.13 + /usr/lib/rpm/redhat/brp-python-hardlink + /usr/bin/add-determinism --brp -j2 /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/lib/python3.13/site-packages/starlette/middleware/__pycache__/__init__.cpython-313.pyc: rewriting with normalized contents /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/lib/python3.13/site-packages/starlette/middleware/__pycache__/authentication.cpython-313.pyc: rewriting with normalized contents /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/lib/python3.13/site-packages/starlette/middleware/__pycache__/base.cpython-313.pyc: replacing with normalized version /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/lib/python3.13/site-packages/starlette/middleware/__pycache__/cors.cpython-313.pyc: rewriting with normalized contents /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/lib/python3.13/site-packages/starlette/middleware/__pycache__/errors.cpython-313.pyc: rewriting with normalized contents /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/lib/python3.13/site-packages/starlette/middleware/__pycache__/exceptions.cpython-313.pyc: replacing with normalized version /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/lib/python3.13/site-packages/starlette/middleware/__pycache__/gzip.cpython-313.pyc: rewriting with normalized contents /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/lib/python3.13/site-packages/starlette/middleware/__pycache__/httpsredirect.cpython-313.pyc: rewriting with normalized contents /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/lib/python3.13/site-packages/starlette/middleware/__pycache__/sessions.cpython-313.pyc: rewriting with normalized contents /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/lib/python3.13/site-packages/starlette/middleware/__pycache__/trustedhost.cpython-313.pyc: replacing with normalized version /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/lib/python3.13/site-packages/starlette/middleware/__pycache__/wsgi.cpython-313.pyc: replacing with normalized version /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/lib/python3.13/site-packages/starlette/middleware/__pycache__/base.cpython-313.opt-1.pyc: replacing with normalized version /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/lib/python3.13/site-packages/starlette/middleware/__pycache__/exceptions.cpython-313.opt-1.pyc: replacing with normalized version /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/lib/python3.13/site-packages/starlette/middleware/__pycache__/trustedhost.cpython-313.opt-1.pyc: replacing with normalized version /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/lib/python3.13/site-packages/starlette/middleware/__pycache__/wsgi.cpython-313.opt-1.pyc: replacing with normalized version /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/lib/python3.13/site-packages/starlette/__pycache__/__init__.cpython-313.pyc: rewriting with normalized contents /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/lib/python3.13/site-packages/starlette/__pycache__/_exception_handler.cpython-313.pyc: rewriting with normalized contents /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/lib/python3.13/site-packages/starlette/__pycache__/_utils.cpython-313.pyc: rewriting with normalized contents /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/lib/python3.13/site-packages/starlette/__pycache__/authentication.cpython-313.pyc: replacing with normalized version /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/lib/python3.13/site-packages/starlette/__pycache__/applications.cpython-313.pyc: replacing with normalized version /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/lib/python3.13/site-packages/starlette/__pycache__/background.cpython-313.pyc: rewriting with normalized contents /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/lib/python3.13/site-packages/starlette/__pycache__/concurrency.cpython-313.pyc: rewriting with normalized contents /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/lib/python3.13/site-packages/starlette/__pycache__/convertors.cpython-313.pyc: replacing with normalized version /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/lib/python3.13/site-packages/starlette/__pycache__/config.cpython-313.pyc: rewriting with normalized contents /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/lib/python3.13/site-packages/starlette/__pycache__/endpoints.cpython-313.pyc: replacing with normalized version /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/lib/python3.13/site-packages/starlette/__pycache__/exceptions.cpython-313.pyc: rewriting with normalized contents /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/lib/python3.13/site-packages/starlette/__pycache__/datastructures.cpython-313.pyc: replacing with normalized version /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/lib/python3.13/site-packages/starlette/__pycache__/formparsers.cpython-313.pyc: replacing with normalized version /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/lib/python3.13/site-packages/starlette/__pycache__/requests.cpython-313.pyc: replacing with normalized version /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/lib/python3.13/site-packages/starlette/__pycache__/responses.cpython-313.pyc: replacing with normalized version /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/lib/python3.13/site-packages/starlette/__pycache__/schemas.cpython-313.pyc: replacing with normalized version /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/lib/python3.13/site-packages/starlette/__pycache__/routing.cpython-313.pyc: replacing with normalized version /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/lib/python3.13/site-packages/starlette/__pycache__/staticfiles.cpython-313.pyc: replacing with normalized version /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/lib/python3.13/site-packages/starlette/__pycache__/status.cpython-313.pyc: rewriting with normalized contents /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/lib/python3.13/site-packages/starlette/__pycache__/templating.cpython-313.pyc: replacing with normalized version /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/lib/python3.13/site-packages/starlette/__pycache__/testclient.cpython-313.pyc: replacing with normalized version /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/lib/python3.13/site-packages/starlette/__pycache__/types.cpython-313.pyc: rewriting with normalized contents /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/lib/python3.13/site-packages/starlette/__pycache__/websockets.cpython-313.pyc: replacing with normalized version /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/lib/python3.13/site-packages/starlette/__pycache__/authentication.cpython-313.opt-1.pyc: replacing with normalized version /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/lib/python3.13/site-packages/starlette/__pycache__/applications.cpython-313.opt-1.pyc: replacing with normalized version /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/lib/python3.13/site-packages/starlette/__pycache__/convertors.cpython-313.opt-1.pyc: replacing with normalized version /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/lib/python3.13/site-packages/starlette/__pycache__/formparsers.cpython-313.opt-1.pyc: replacing with normalized version /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/lib/python3.13/site-packages/starlette/__pycache__/datastructures.cpython-313.opt-1.pyc: replacing with normalized version /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/lib/python3.13/site-packages/starlette/__pycache__/endpoints.cpython-313.opt-1.pyc: replacing with normalized version /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/lib/python3.13/site-packages/starlette/__pycache__/requests.cpython-313.opt-1.pyc: replacing with normalized version /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/lib/python3.13/site-packages/starlette/__pycache__/schemas.cpython-313.opt-1.pyc: replacing with normalized version /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/lib/python3.13/site-packages/starlette/__pycache__/staticfiles.cpython-313.opt-1.pyc: replacing with normalized version /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/lib/python3.13/site-packages/starlette/__pycache__/templating.cpython-313.opt-1.pyc: replacing with normalized version /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/lib/python3.13/site-packages/starlette/__pycache__/responses.cpython-313.opt-1.pyc: replacing with normalized version /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/lib/python3.13/site-packages/starlette/__pycache__/websockets.cpython-313.opt-1.pyc: replacing with normalized version /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/lib/python3.13/site-packages/starlette/__pycache__/routing.cpython-313.opt-1.pyc: replacing with normalized version /builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/lib/python3.13/site-packages/starlette/__pycache__/testclient.cpython-313.opt-1.pyc: replacing with normalized version Scanned 11 directories and 107 files, processed 52 inodes, 52 modified (36 replaced + 16 rewritten), 0 unsupported format, 0 errors Executing(%check): /bin/sh -e /var/tmp/rpm-tmp.KkHLX6 + umask 022 + cd /builddir/build/BUILD/python-starlette-0.45.1-build + CFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer ' + export CFLAGS + CXXFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer ' + export CXXFLAGS + FFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -I/usr/lib64/gfortran/modules ' + export FFLAGS + FCFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -I/usr/lib64/gfortran/modules ' + export FCFLAGS + VALAFLAGS=-g + export VALAFLAGS + RUSTFLAGS='-Copt-level=3 -Cdebuginfo=2 -Ccodegen-units=1 -Cstrip=none -Cforce-frame-pointers=yes -Clink-arg=-specs=/usr/lib/rpm/redhat/redhat-package-notes --cap-lints=warn' + export RUSTFLAGS + LDFLAGS='-Wl,-z,relro -Wl,--as-needed -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes ' + export LDFLAGS + LT_SYS_LIBRARY_PATH=/usr/lib64: + export LT_SYS_LIBRARY_PATH + CC=gcc + export CC + CXX=g++ + export CXX + cd python-starlette-0.45.1 + '[' '!' -f /builddir/build/BUILD/python-starlette-0.45.1-build/python-starlette-0.45.1-1.fc41.x86_64-pyproject-modules ']' + PATH=/builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin + PYTHONPATH=/builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/lib64/python3.13/site-packages:/builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/lib/python3.13/site-packages + _PYTHONSITE=/builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/lib64/python3.13/site-packages:/builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/lib/python3.13/site-packages + PYTHONDONTWRITEBYTECODE=1 + /usr/bin/python3 -sP /usr/lib/rpm/redhat/import_all_modules.py -f /builddir/build/BUILD/python-starlette-0.45.1-build/python-starlette-0.45.1-1.fc41.x86_64-pyproject-modules Check import: starlette Check import: starlette.applications Check import: starlette.authentication Check import: starlette.background Check import: starlette.concurrency Check import: starlette.config Check import: starlette.convertors Check import: starlette.datastructures Check import: starlette.endpoints Check import: starlette.exceptions Check import: starlette.formparsers Check import: starlette.middleware Check import: starlette.middleware.authentication Check import: starlette.middleware.base Check import: starlette.middleware.cors Check import: starlette.middleware.errors Check import: starlette.middleware.exceptions Check import: starlette.middleware.gzip Check import: starlette.middleware.httpsredirect Check import: starlette.middleware.sessions Check import: starlette.middleware.trustedhost Check import: starlette.middleware.wsgi Check import: starlette.requests Check import: starlette.responses Check import: starlette.routing Check import: starlette.schemas Check import: starlette.staticfiles Check import: starlette.status Check import: starlette.templating Check import: starlette.testclient Check import: starlette.types Check import: starlette.websockets + warningsfilter=' -W ignore::trio.TrioDeprecationWarning' + k='not test_lifespan_with_on_events' + CFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer ' + LDFLAGS='-Wl,-z,relro -Wl,--as-needed -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes ' + PATH=/builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin + PYTHONPATH=/builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/lib64/python3.13/site-packages:/builddir/build/BUILD/python-starlette-0.45.1-build/BUILDROOT/usr/lib/python3.13/site-packages + PYTHONDONTWRITEBYTECODE=1 + PYTEST_XDIST_AUTO_NUM_WORKERS=2 + /usr/bin/pytest -W ignore::trio.TrioDeprecationWarning -k 'not test_lifespan_with_on_events' -v ============================= test session starts ============================== platform linux -- Python 3.13.1, pytest-8.3.4, pluggy-1.5.0 -- /usr/bin/python3 cachedir: .pytest_cache rootdir: /builddir/build/BUILD/python-starlette-0.45.1-build/python-starlette-0.45.1 configfile: pyproject.toml plugins: anyio-3.7.1 collecting ... collected 888 items / 2 deselected / 886 selected tests/middleware/test_base.py::test_custom_middleware[asyncio] FAILED [ 0%] tests/middleware/test_base.py::test_custom_middleware[trio] FAILED [ 0%] tests/middleware/test_base.py::test_state_data_across_multiple_middlewares[asyncio] FAILED [ 0%] tests/middleware/test_base.py::test_state_data_across_multiple_middlewares[trio] FAILED [ 0%] tests/middleware/test_base.py::test_app_middleware_argument[asyncio] FAILED [ 0%] tests/middleware/test_base.py::test_app_middleware_argument[trio] FAILED [ 0%] tests/middleware/test_base.py::test_fully_evaluated_response[asyncio] FAILED [ 0%] tests/middleware/test_base.py::test_fully_evaluated_response[trio] FAILED [ 0%] tests/middleware/test_base.py::test_contextvars[asyncio-CustomMiddlewareWithoutBaseHTTPMiddleware] PASSED [ 1%] tests/middleware/test_base.py::test_contextvars[asyncio-CustomMiddlewareUsingBaseHTTPMiddleware] FAILED [ 1%] tests/middleware/test_base.py::test_contextvars[trio-CustomMiddlewareWithoutBaseHTTPMiddleware] PASSED [ 1%] tests/middleware/test_base.py::test_contextvars[trio-CustomMiddlewareUsingBaseHTTPMiddleware] FAILED [ 1%] tests/middleware/test_base.py::test_run_background_tasks_even_if_client_disconnects[asyncio] FAILED [ 1%] tests/middleware/test_base.py::test_run_background_tasks_even_if_client_disconnects[trio] FAILED [ 1%] tests/middleware/test_base.py::test_do_not_block_on_background_tasks[asyncio] FAILED [ 1%] tests/middleware/test_base.py::test_do_not_block_on_background_tasks[trio] FAILED [ 1%] tests/middleware/test_base.py::test_run_context_manager_exit_even_if_client_disconnects[asyncio] FAILED [ 1%] tests/middleware/test_base.py::test_run_context_manager_exit_even_if_client_disconnects[trio] FAILED [ 2%] tests/middleware/test_base.py::test_app_receives_http_disconnect_while_sending_if_discarded[asyncio] FAILED [ 2%] tests/middleware/test_base.py::test_app_receives_http_disconnect_while_sending_if_discarded[trio] FAILED [ 2%] tests/middleware/test_base.py::test_app_receives_http_disconnect_after_sending_if_discarded[asyncio] FAILED [ 2%] tests/middleware/test_base.py::test_app_receives_http_disconnect_after_sending_if_discarded[trio] FAILED [ 2%] tests/middleware/test_base.py::test_read_request_stream_in_app_after_middleware_calls_stream[asyncio] FAILED [ 2%] tests/middleware/test_base.py::test_read_request_stream_in_app_after_middleware_calls_stream[trio] FAILED [ 2%] tests/middleware/test_base.py::test_read_request_stream_in_app_after_middleware_calls_body[asyncio] FAILED [ 2%] tests/middleware/test_base.py::test_read_request_stream_in_app_after_middleware_calls_body[trio] FAILED [ 2%] tests/middleware/test_base.py::test_read_request_body_in_app_after_middleware_calls_stream[asyncio] FAILED [ 3%] tests/middleware/test_base.py::test_read_request_body_in_app_after_middleware_calls_stream[trio] FAILED [ 3%] tests/middleware/test_base.py::test_read_request_body_in_app_after_middleware_calls_body[asyncio] FAILED [ 3%] tests/middleware/test_base.py::test_read_request_body_in_app_after_middleware_calls_body[trio] FAILED [ 3%] tests/middleware/test_base.py::test_read_request_stream_in_dispatch_after_app_calls_stream[asyncio] FAILED [ 3%] tests/middleware/test_base.py::test_read_request_stream_in_dispatch_after_app_calls_stream[trio] FAILED [ 3%] tests/middleware/test_base.py::test_read_request_stream_in_dispatch_after_app_calls_body[asyncio] FAILED [ 3%] tests/middleware/test_base.py::test_read_request_stream_in_dispatch_after_app_calls_body[trio] FAILED [ 3%] tests/middleware/test_base.py::test_read_request_stream_in_dispatch_wrapping_app_calls_body[asyncio] FAILED [ 3%] tests/middleware/test_base.py::test_read_request_stream_in_dispatch_wrapping_app_calls_body[trio] FAILED [ 4%] tests/middleware/test_base.py::test_read_request_stream_in_dispatch_after_app_calls_body_with_middleware_calling_body_before_call_next[asyncio] FAILED [ 4%] tests/middleware/test_base.py::test_read_request_stream_in_dispatch_after_app_calls_body_with_middleware_calling_body_before_call_next[trio] FAILED [ 4%] tests/middleware/test_base.py::test_read_request_body_in_dispatch_after_app_calls_body_with_middleware_calling_body_before_call_next[asyncio] FAILED [ 4%] tests/middleware/test_base.py::test_read_request_body_in_dispatch_after_app_calls_body_with_middleware_calling_body_before_call_next[trio] FAILED [ 4%] tests/middleware/test_base.py::test_read_request_disconnected_client[asyncio] FAILED [ 4%] tests/middleware/test_base.py::test_read_request_disconnected_client[trio] FAILED [ 4%] tests/middleware/test_base.py::test_read_request_disconnected_after_consuming_steam[asyncio] FAILED [ 4%] tests/middleware/test_base.py::test_read_request_disconnected_after_consuming_steam[trio] FAILED [ 4%] tests/middleware/test_base.py::test_downstream_middleware_modifies_receive[asyncio] FAILED [ 5%] tests/middleware/test_base.py::test_downstream_middleware_modifies_receive[trio] FAILED [ 5%] tests/middleware/test_base.py::test_pr_1519_comment_1236166180_example FAILED [ 5%] tests/middleware/test_base.py::test_multiple_middlewares_stacked_client_disconnected[asyncio] FAILED [ 5%] tests/middleware/test_base.py::test_multiple_middlewares_stacked_client_disconnected[trio] FAILED [ 5%] tests/middleware/test_base.py::test_poll_for_disconnect_repeated[asyncio-True] FAILED [ 5%] tests/middleware/test_base.py::test_poll_for_disconnect_repeated[asyncio-False] FAILED [ 5%] tests/middleware/test_base.py::test_poll_for_disconnect_repeated[trio-True] FAILED [ 5%] tests/middleware/test_base.py::test_poll_for_disconnect_repeated[trio-False] FAILED [ 5%] tests/middleware/test_cors.py::test_cors_allow_all[asyncio] PASSED [ 6%] tests/middleware/test_cors.py::test_cors_allow_all[trio] PASSED [ 6%] tests/middleware/test_cors.py::test_cors_allow_all_except_credentials[asyncio] PASSED [ 6%] tests/middleware/test_cors.py::test_cors_allow_all_except_credentials[trio] PASSED [ 6%] tests/middleware/test_cors.py::test_cors_allow_specific_origin[asyncio] PASSED [ 6%] tests/middleware/test_cors.py::test_cors_allow_specific_origin[trio] PASSED [ 6%] tests/middleware/test_cors.py::test_cors_disallowed_preflight[asyncio] PASSED [ 6%] tests/middleware/test_cors.py::test_cors_disallowed_preflight[trio] PASSED [ 6%] tests/middleware/test_cors.py::test_preflight_allows_request_origin_if_origins_wildcard_and_credentials_allowed[asyncio] PASSED [ 6%] tests/middleware/test_cors.py::test_preflight_allows_request_origin_if_origins_wildcard_and_credentials_allowed[trio] PASSED [ 7%] tests/middleware/test_cors.py::test_cors_preflight_allow_all_methods[asyncio] PASSED [ 7%] tests/middleware/test_cors.py::test_cors_preflight_allow_all_methods[trio] PASSED [ 7%] tests/middleware/test_cors.py::test_cors_allow_all_methods[asyncio] PASSED [ 7%] tests/middleware/test_cors.py::test_cors_allow_all_methods[trio] PASSED [ 7%] tests/middleware/test_cors.py::test_cors_allow_origin_regex[asyncio] PASSED [ 7%] tests/middleware/test_cors.py::test_cors_allow_origin_regex[trio] PASSED [ 7%] tests/middleware/test_cors.py::test_cors_allow_origin_regex_fullmatch[asyncio] PASSED [ 7%] tests/middleware/test_cors.py::test_cors_allow_origin_regex_fullmatch[trio] PASSED [ 8%] tests/middleware/test_cors.py::test_cors_credentialed_requests_return_specific_origin[asyncio] PASSED [ 8%] tests/middleware/test_cors.py::test_cors_credentialed_requests_return_specific_origin[trio] PASSED [ 8%] tests/middleware/test_cors.py::test_cors_vary_header_defaults_to_origin[asyncio] PASSED [ 8%] tests/middleware/test_cors.py::test_cors_vary_header_defaults_to_origin[trio] PASSED [ 8%] tests/middleware/test_cors.py::test_cors_vary_header_is_not_set_for_non_credentialed_request[asyncio] PASSED [ 8%] tests/middleware/test_cors.py::test_cors_vary_header_is_not_set_for_non_credentialed_request[trio] PASSED [ 8%] tests/middleware/test_cors.py::test_cors_vary_header_is_properly_set_for_credentialed_request[asyncio] PASSED [ 8%] tests/middleware/test_cors.py::test_cors_vary_header_is_properly_set_for_credentialed_request[trio] PASSED [ 8%] tests/middleware/test_cors.py::test_cors_vary_header_is_properly_set_when_allow_origins_is_not_wildcard[asyncio] PASSED [ 9%] tests/middleware/test_cors.py::test_cors_vary_header_is_properly_set_when_allow_origins_is_not_wildcard[trio] PASSED [ 9%] tests/middleware/test_cors.py::test_cors_allowed_origin_does_not_leak_between_credentialed_requests[asyncio] PASSED [ 9%] tests/middleware/test_cors.py::test_cors_allowed_origin_does_not_leak_between_credentialed_requests[trio] PASSED [ 9%] tests/middleware/test_errors.py::test_handler[asyncio] PASSED [ 9%] tests/middleware/test_errors.py::test_handler[trio] PASSED [ 9%] tests/middleware/test_errors.py::test_debug_text[asyncio] PASSED [ 9%] tests/middleware/test_errors.py::test_debug_text[trio] PASSED [ 9%] tests/middleware/test_errors.py::test_debug_html[asyncio] PASSED [ 9%] tests/middleware/test_errors.py::test_debug_html[trio] PASSED [ 10%] tests/middleware/test_errors.py::test_debug_after_response_sent[asyncio] PASSED [ 10%] tests/middleware/test_errors.py::test_debug_after_response_sent[trio] PASSED [ 10%] tests/middleware/test_errors.py::test_debug_not_http[asyncio] FAILED [ 10%] tests/middleware/test_errors.py::test_debug_not_http[trio] FAILED [ 10%] tests/middleware/test_errors.py::test_background_task[asyncio] PASSED [ 10%] tests/middleware/test_errors.py::test_background_task[trio] PASSED [ 10%] tests/middleware/test_gzip.py::test_gzip_responses[asyncio] PASSED [ 10%] tests/middleware/test_gzip.py::test_gzip_responses[trio] PASSED [ 10%] tests/middleware/test_gzip.py::test_gzip_not_in_accept_encoding[asyncio] PASSED [ 11%] tests/middleware/test_gzip.py::test_gzip_not_in_accept_encoding[trio] PASSED [ 11%] tests/middleware/test_gzip.py::test_gzip_ignored_for_small_responses[asyncio] PASSED [ 11%] tests/middleware/test_gzip.py::test_gzip_ignored_for_small_responses[trio] PASSED [ 11%] tests/middleware/test_gzip.py::test_gzip_streaming_response[asyncio] PASSED [ 11%] tests/middleware/test_gzip.py::test_gzip_streaming_response[trio] PASSED [ 11%] tests/middleware/test_gzip.py::test_gzip_ignored_for_responses_with_encoding_set[asyncio] PASSED [ 11%] tests/middleware/test_gzip.py::test_gzip_ignored_for_responses_with_encoding_set[trio] PASSED [ 11%] tests/middleware/test_https_redirect.py::test_https_redirect_middleware[asyncio] PASSED [ 11%] tests/middleware/test_https_redirect.py::test_https_redirect_middleware[trio] PASSED [ 12%] tests/middleware/test_middleware.py::test_middleware_repr PASSED [ 12%] tests/middleware/test_middleware.py::test_middleware_iter PASSED [ 12%] tests/middleware/test_session.py::test_session[asyncio] PASSED [ 12%] tests/middleware/test_session.py::test_session[trio] PASSED [ 12%] tests/middleware/test_session.py::test_session_expires[asyncio] PASSED [ 12%] tests/middleware/test_session.py::test_session_expires[trio] PASSED [ 12%] tests/middleware/test_session.py::test_secure_session[asyncio] PASSED [ 12%] tests/middleware/test_session.py::test_secure_session[trio] PASSED [ 12%] tests/middleware/test_session.py::test_session_cookie_subpath[asyncio] PASSED [ 13%] tests/middleware/test_session.py::test_session_cookie_subpath[trio] PASSED [ 13%] tests/middleware/test_session.py::test_invalid_session_cookie[asyncio] PASSED [ 13%] tests/middleware/test_session.py::test_invalid_session_cookie[trio] PASSED [ 13%] tests/middleware/test_session.py::test_session_cookie[asyncio] PASSED [ 13%] tests/middleware/test_session.py::test_session_cookie[trio] PASSED [ 13%] tests/middleware/test_session.py::test_domain_cookie[asyncio] PASSED [ 13%] tests/middleware/test_session.py::test_domain_cookie[trio] PASSED [ 13%] tests/middleware/test_trusted_host.py::test_trusted_host_middleware[asyncio] PASSED [ 13%] tests/middleware/test_trusted_host.py::test_trusted_host_middleware[trio] PASSED [ 14%] tests/middleware/test_trusted_host.py::test_default_allowed_hosts PASSED [ 14%] tests/middleware/test_trusted_host.py::test_www_redirect[asyncio] PASSED [ 14%] tests/middleware/test_trusted_host.py::test_www_redirect[trio] PASSED [ 14%] tests/middleware/test_wsgi.py::test_wsgi_get[asyncio] PASSED [ 14%] tests/middleware/test_wsgi.py::test_wsgi_get[trio] PASSED [ 14%] tests/middleware/test_wsgi.py::test_wsgi_post[asyncio] PASSED [ 14%] tests/middleware/test_wsgi.py::test_wsgi_post[trio] PASSED [ 14%] tests/middleware/test_wsgi.py::test_wsgi_exception[asyncio] PASSED [ 15%] tests/middleware/test_wsgi.py::test_wsgi_exception[trio] PASSED [ 15%] tests/middleware/test_wsgi.py::test_wsgi_exc_info[asyncio] PASSED [ 15%] tests/middleware/test_wsgi.py::test_wsgi_exc_info[trio] PASSED [ 15%] tests/middleware/test_wsgi.py::test_build_environ PASSED [ 15%] tests/middleware/test_wsgi.py::test_build_environ_encoding PASSED [ 15%] tests/test__utils.py::test_async_func PASSED [ 15%] tests/test__utils.py::test_async_partial PASSED [ 15%] tests/test__utils.py::test_async_method PASSED [ 15%] tests/test__utils.py::test_async_object_call PASSED [ 16%] tests/test__utils.py::test_async_partial_object_call PASSED [ 16%] tests/test__utils.py::test_async_nested_partial PASSED [ 16%] tests/test__utils.py::test_get_route_path[scope0-/foo-123/bar] PASSED [ 16%] tests/test__utils.py::test_get_route_path[scope1-/bar] PASSED [ 16%] tests/test__utils.py::test_get_route_path[scope2-] PASSED [ 16%] tests/test__utils.py::test_get_route_path[scope3-/foo/bar] PASSED [ 16%] tests/test_applications.py::test_url_path_for PASSED [ 16%] tests/test_applications.py::test_func_route[asyncio] ERROR [ 16%] tests/test_applications.py::test_func_route[trio] ERROR [ 17%] tests/test_applications.py::test_async_route[asyncio] ERROR [ 17%] tests/test_applications.py::test_async_route[trio] ERROR [ 17%] tests/test_applications.py::test_class_route[asyncio] ERROR [ 17%] tests/test_applications.py::test_class_route[trio] ERROR [ 17%] tests/test_applications.py::test_mounted_route[asyncio] ERROR [ 17%] tests/test_applications.py::test_mounted_route[trio] ERROR [ 17%] tests/test_applications.py::test_mounted_route_path_params[asyncio] ERROR [ 17%] tests/test_applications.py::test_mounted_route_path_params[trio] ERROR [ 17%] tests/test_applications.py::test_subdomain_route[asyncio] PASSED [ 18%] tests/test_applications.py::test_subdomain_route[trio] PASSED [ 18%] tests/test_applications.py::test_websocket_route[asyncio] ERROR [ 18%] tests/test_applications.py::test_websocket_route[trio] ERROR [ 18%] tests/test_applications.py::test_400[asyncio] ERROR [ 18%] tests/test_applications.py::test_400[trio] ERROR [ 18%] tests/test_applications.py::test_405[asyncio] ERROR [ 18%] tests/test_applications.py::test_405[trio] ERROR [ 18%] tests/test_applications.py::test_500[asyncio] PASSED [ 18%] tests/test_applications.py::test_500[trio] PASSED [ 19%] tests/test_applications.py::test_websocket_raise_websocket_exception[asyncio] ERROR [ 19%] tests/test_applications.py::test_websocket_raise_websocket_exception[trio] ERROR [ 19%] tests/test_applications.py::test_websocket_raise_http_exception[asyncio] ERROR [ 19%] tests/test_applications.py::test_websocket_raise_http_exception[trio] ERROR [ 19%] tests/test_applications.py::test_websocket_raise_custom_exception[asyncio] ERROR [ 19%] tests/test_applications.py::test_websocket_raise_custom_exception[trio] ERROR [ 19%] tests/test_applications.py::test_middleware[asyncio] PASSED [ 19%] tests/test_applications.py::test_middleware[trio] PASSED [ 19%] tests/test_applications.py::test_routes PASSED [ 20%] tests/test_applications.py::test_app_mount[asyncio] PASSED [ 20%] tests/test_applications.py::test_app_mount[trio] PASSED [ 20%] tests/test_applications.py::test_app_debug[asyncio] PASSED [ 20%] tests/test_applications.py::test_app_debug[trio] PASSED [ 20%] tests/test_applications.py::test_app_add_route[asyncio] PASSED [ 20%] tests/test_applications.py::test_app_add_route[trio] PASSED [ 20%] tests/test_applications.py::test_app_add_websocket_route[asyncio] FAILED [ 20%] tests/test_applications.py::test_app_add_websocket_route[trio] FAILED [ 20%] tests/test_applications.py::test_app_add_event_handler[asyncio] FAILED [ 21%] tests/test_applications.py::test_app_add_event_handler[trio] FAILED [ 21%] tests/test_applications.py::test_app_async_cm_lifespan[asyncio] FAILED [ 21%] tests/test_applications.py::test_app_async_cm_lifespan[trio] FAILED [ 21%] tests/test_applications.py::test_app_async_gen_lifespan[asyncio] FAILED [ 21%] tests/test_applications.py::test_app_async_gen_lifespan[trio] FAILED [ 21%] tests/test_applications.py::test_app_sync_gen_lifespan[asyncio] FAILED [ 21%] tests/test_applications.py::test_app_sync_gen_lifespan[trio] FAILED [ 21%] tests/test_applications.py::test_decorator_deprecations PASSED [ 22%] tests/test_applications.py::test_middleware_stack_init[asyncio] FAILED [ 22%] tests/test_applications.py::test_middleware_stack_init[trio] FAILED [ 22%] tests/test_applications.py::test_middleware_args[asyncio] FAILED [ 22%] tests/test_applications.py::test_middleware_args[trio] FAILED [ 22%] tests/test_applications.py::test_middleware_factory[asyncio] FAILED [ 22%] tests/test_applications.py::test_middleware_factory[trio] FAILED [ 22%] tests/test_applications.py::test_lifespan_app_subclass PASSED [ 22%] tests/test_authentication.py::test_invalid_decorator_usage PASSED [ 22%] tests/test_authentication.py::test_user_interface[asyncio] FAILED [ 23%] tests/test_authentication.py::test_user_interface[trio] FAILED [ 23%] tests/test_authentication.py::test_authentication_required[asyncio] FAILED [ 23%] tests/test_authentication.py::test_authentication_required[trio] FAILED [ 23%] tests/test_authentication.py::test_websocket_authentication_required[asyncio] FAILED [ 23%] tests/test_authentication.py::test_websocket_authentication_required[trio] FAILED [ 23%] tests/test_authentication.py::test_authentication_redirect[asyncio] FAILED [ 23%] tests/test_authentication.py::test_authentication_redirect[trio] FAILED [ 23%] tests/test_authentication.py::test_custom_on_error[asyncio] FAILED [ 23%] tests/test_authentication.py::test_custom_on_error[trio] FAILED [ 24%] tests/test_background.py::test_async_task[asyncio] PASSED [ 24%] tests/test_background.py::test_async_task[trio] PASSED [ 24%] tests/test_background.py::test_sync_task[asyncio] PASSED [ 24%] tests/test_background.py::test_sync_task[trio] PASSED [ 24%] tests/test_background.py::test_multiple_tasks[asyncio] PASSED [ 24%] tests/test_background.py::test_multiple_tasks[trio] PASSED [ 24%] tests/test_background.py::test_multi_tasks_failure_avoids_next_execution[asyncio] PASSED [ 24%] tests/test_background.py::test_multi_tasks_failure_avoids_next_execution[trio] PASSED [ 24%] tests/test_concurrency.py::test_run_until_first_complete[asyncio] PASSED [ 25%] tests/test_concurrency.py::test_run_until_first_complete[trio] PASSED [ 25%] tests/test_concurrency.py::test_accessing_context_from_threaded_sync_endpoint[asyncio] PASSED [ 25%] tests/test_concurrency.py::test_accessing_context_from_threaded_sync_endpoint[trio] PASSED [ 25%] tests/test_concurrency.py::test_iterate_in_threadpool[asyncio] PASSED [ 25%] tests/test_concurrency.py::test_iterate_in_threadpool[trio] PASSED [ 25%] tests/test_config.py::test_config_types PASSED [ 25%] tests/test_config.py::test_config PASSED [ 25%] tests/test_config.py::test_missing_env_file_raises PASSED [ 25%] tests/test_config.py::test_environ PASSED [ 26%] tests/test_config.py::test_config_with_env_prefix PASSED [ 26%] tests/test_convertors.py::test_datetime_convertor[asyncio] PASSED [ 26%] tests/test_convertors.py::test_datetime_convertor[trio] PASSED [ 26%] tests/test_convertors.py::test_default_float_convertor[asyncio-1.0-200] PASSED [ 26%] tests/test_convertors.py::test_default_float_convertor[asyncio-1-0-404] PASSED [ 26%] tests/test_convertors.py::test_default_float_convertor[trio-1.0-200] PASSED [ 26%] tests/test_convertors.py::test_default_float_convertor[trio-1-0-404] PASSED [ 26%] tests/test_convertors.py::test_default_uuid_convertor[asyncio-00000000-aaaa-ffff-9999-000000000000-200] PASSED [ 26%] tests/test_convertors.py::test_default_uuid_convertor[asyncio-00000000aaaaffff9999000000000000-200] PASSED [ 27%] tests/test_convertors.py::test_default_uuid_convertor[asyncio-00000000-AAAA-FFFF-9999-000000000000-200] PASSED [ 27%] tests/test_convertors.py::test_default_uuid_convertor[asyncio-00000000AAAAFFFF9999000000000000-200] PASSED [ 27%] tests/test_convertors.py::test_default_uuid_convertor[asyncio-not-a-uuid-404] PASSED [ 27%] tests/test_convertors.py::test_default_uuid_convertor[trio-00000000-aaaa-ffff-9999-000000000000-200] PASSED [ 27%] tests/test_convertors.py::test_default_uuid_convertor[trio-00000000aaaaffff9999000000000000-200] PASSED [ 27%] tests/test_convertors.py::test_default_uuid_convertor[trio-00000000-AAAA-FFFF-9999-000000000000-200] PASSED [ 27%] tests/test_convertors.py::test_default_uuid_convertor[trio-00000000AAAAFFFF9999000000000000-200] PASSED [ 27%] tests/test_convertors.py::test_default_uuid_convertor[trio-not-a-uuid-404] PASSED [ 27%] tests/test_datastructures.py::test_url PASSED [ 28%] tests/test_datastructures.py::test_url_query_params PASSED [ 28%] tests/test_datastructures.py::test_hidden_password PASSED [ 28%] tests/test_datastructures.py::test_csv PASSED [ 28%] tests/test_datastructures.py::test_url_from_scope PASSED [ 28%] tests/test_datastructures.py::test_headers PASSED [ 28%] tests/test_datastructures.py::test_mutable_headers PASSED [ 28%] tests/test_datastructures.py::test_mutable_headers_merge PASSED [ 28%] tests/test_datastructures.py::test_mutable_headers_merge_dict PASSED [ 29%] tests/test_datastructures.py::test_mutable_headers_update PASSED [ 29%] tests/test_datastructures.py::test_mutable_headers_update_dict PASSED [ 29%] tests/test_datastructures.py::test_mutable_headers_merge_not_mapping PASSED [ 29%] tests/test_datastructures.py::test_headers_mutablecopy PASSED [ 29%] tests/test_datastructures.py::test_mutable_headers_from_scope PASSED [ 29%] tests/test_datastructures.py::test_url_blank_params PASSED [ 29%] tests/test_datastructures.py::test_queryparams PASSED [ 29%] tests/test_datastructures.py::test_upload_file_file_input[asyncio] PASSED [ 29%] tests/test_datastructures.py::test_upload_file_file_input[trio] PASSED [ 30%] tests/test_datastructures.py::test_upload_file_without_size[asyncio] PASSED [ 30%] tests/test_datastructures.py::test_upload_file_without_size[trio] PASSED [ 30%] tests/test_datastructures.py::test_uploadfile_rolling[asyncio-rolled] PASSED [ 30%] tests/test_datastructures.py::test_uploadfile_rolling[asyncio-unrolled] PASSED [ 30%] tests/test_datastructures.py::test_uploadfile_rolling[trio-rolled] PASSED [ 30%] tests/test_datastructures.py::test_uploadfile_rolling[trio-unrolled] PASSED [ 30%] tests/test_datastructures.py::test_formdata PASSED [ 30%] tests/test_datastructures.py::test_upload_file_repr[asyncio] PASSED [ 30%] tests/test_datastructures.py::test_upload_file_repr[trio] PASSED [ 31%] tests/test_datastructures.py::test_upload_file_repr_headers[asyncio] PASSED [ 31%] tests/test_datastructures.py::test_upload_file_repr_headers[trio] PASSED [ 31%] tests/test_datastructures.py::test_multidict PASSED [ 31%] tests/test_endpoints.py::test_http_endpoint_route[asyncio] ERROR [ 31%] tests/test_endpoints.py::test_http_endpoint_route[trio] ERROR [ 31%] tests/test_endpoints.py::test_http_endpoint_route_path_params[asyncio] ERROR [ 31%] tests/test_endpoints.py::test_http_endpoint_route_path_params[trio] ERROR [ 31%] tests/test_endpoints.py::test_http_endpoint_route_method[asyncio] ERROR [ 31%] tests/test_endpoints.py::test_http_endpoint_route_method[trio] ERROR [ 32%] tests/test_endpoints.py::test_websocket_endpoint_on_connect[asyncio] FAILED [ 32%] tests/test_endpoints.py::test_websocket_endpoint_on_connect[trio] FAILED [ 32%] tests/test_endpoints.py::test_websocket_endpoint_on_receive_bytes[asyncio] FAILED [ 32%] tests/test_endpoints.py::test_websocket_endpoint_on_receive_bytes[trio] FAILED [ 32%] tests/test_endpoints.py::test_websocket_endpoint_on_receive_json[asyncio] FAILED [ 32%] tests/test_endpoints.py::test_websocket_endpoint_on_receive_json[trio] FAILED [ 32%] tests/test_endpoints.py::test_websocket_endpoint_on_receive_json_binary[asyncio] FAILED [ 32%] tests/test_endpoints.py::test_websocket_endpoint_on_receive_json_binary[trio] FAILED [ 32%] tests/test_endpoints.py::test_websocket_endpoint_on_receive_text[asyncio] FAILED [ 33%] tests/test_endpoints.py::test_websocket_endpoint_on_receive_text[trio] FAILED [ 33%] tests/test_endpoints.py::test_websocket_endpoint_on_default[asyncio] FAILED [ 33%] tests/test_endpoints.py::test_websocket_endpoint_on_default[trio] FAILED [ 33%] tests/test_endpoints.py::test_websocket_endpoint_on_disconnect[asyncio] FAILED [ 33%] tests/test_endpoints.py::test_websocket_endpoint_on_disconnect[trio] FAILED [ 33%] tests/test_exceptions.py::test_not_acceptable[asyncio] ERROR [ 33%] tests/test_exceptions.py::test_not_acceptable[trio] ERROR [ 33%] tests/test_exceptions.py::test_no_content[asyncio] ERROR [ 33%] tests/test_exceptions.py::test_no_content[trio] ERROR [ 34%] tests/test_exceptions.py::test_not_modified[asyncio] ERROR [ 34%] tests/test_exceptions.py::test_not_modified[trio] ERROR [ 34%] tests/test_exceptions.py::test_with_headers[asyncio] ERROR [ 34%] tests/test_exceptions.py::test_with_headers[trio] ERROR [ 34%] tests/test_exceptions.py::test_websockets_should_raise[asyncio] ERROR [ 34%] tests/test_exceptions.py::test_websockets_should_raise[trio] ERROR [ 34%] tests/test_exceptions.py::test_handled_exc_after_response[asyncio] ERROR [ 34%] tests/test_exceptions.py::test_handled_exc_after_response[trio] ERROR [ 34%] tests/test_exceptions.py::test_force_500_response[asyncio] PASSED [ 35%] tests/test_exceptions.py::test_force_500_response[trio] PASSED [ 35%] tests/test_exceptions.py::test_http_str PASSED [ 35%] tests/test_exceptions.py::test_http_repr PASSED [ 35%] tests/test_exceptions.py::test_websocket_str PASSED [ 35%] tests/test_exceptions.py::test_websocket_repr PASSED [ 35%] tests/test_exceptions.py::test_request_in_app_and_handler_is_the_same_object[asyncio] ERROR [ 35%] tests/test_exceptions.py::test_request_in_app_and_handler_is_the_same_object[trio] ERROR [ 35%] tests/test_formparsers.py::test_multipart_request_data[asyncio] PASSED [ 36%] tests/test_formparsers.py::test_multipart_request_data[trio] PASSED [ 36%] tests/test_formparsers.py::test_multipart_request_files[asyncio] PASSED [ 36%] tests/test_formparsers.py::test_multipart_request_files[trio] PASSED [ 36%] tests/test_formparsers.py::test_multipart_request_files_with_content_type[asyncio] PASSED [ 36%] tests/test_formparsers.py::test_multipart_request_files_with_content_type[trio] PASSED [ 36%] tests/test_formparsers.py::test_multipart_request_multiple_files[asyncio] PASSED [ 36%] tests/test_formparsers.py::test_multipart_request_multiple_files[trio] PASSED [ 36%] tests/test_formparsers.py::test_multipart_request_multiple_files_with_headers[asyncio] PASSED [ 36%] tests/test_formparsers.py::test_multipart_request_multiple_files_with_headers[trio] PASSED [ 37%] tests/test_formparsers.py::test_multi_items[asyncio] PASSED [ 37%] tests/test_formparsers.py::test_multi_items[trio] PASSED [ 37%] tests/test_formparsers.py::test_multipart_request_mixed_files_and_data[asyncio] PASSED [ 37%] tests/test_formparsers.py::test_multipart_request_mixed_files_and_data[trio] PASSED [ 37%] tests/test_formparsers.py::test_multipart_request_with_charset_for_filename[asyncio] PASSED [ 37%] tests/test_formparsers.py::test_multipart_request_with_charset_for_filename[trio] PASSED [ 37%] tests/test_formparsers.py::test_multipart_request_without_charset_for_filename[asyncio] PASSED [ 37%] tests/test_formparsers.py::test_multipart_request_without_charset_for_filename[trio] PASSED [ 37%] tests/test_formparsers.py::test_multipart_request_with_encoded_value[asyncio] PASSED [ 38%] tests/test_formparsers.py::test_multipart_request_with_encoded_value[trio] PASSED [ 38%] tests/test_formparsers.py::test_urlencoded_request_data[asyncio] PASSED [ 38%] tests/test_formparsers.py::test_urlencoded_request_data[trio] PASSED [ 38%] tests/test_formparsers.py::test_no_request_data[asyncio] PASSED [ 38%] tests/test_formparsers.py::test_no_request_data[trio] PASSED [ 38%] tests/test_formparsers.py::test_urlencoded_percent_encoding[asyncio] PASSED [ 38%] tests/test_formparsers.py::test_urlencoded_percent_encoding[trio] PASSED [ 38%] tests/test_formparsers.py::test_urlencoded_percent_encoding_keys[asyncio] PASSED [ 38%] tests/test_formparsers.py::test_urlencoded_percent_encoding_keys[trio] PASSED [ 39%] tests/test_formparsers.py::test_urlencoded_multi_field_app_reads_body[asyncio] PASSED [ 39%] tests/test_formparsers.py::test_urlencoded_multi_field_app_reads_body[trio] PASSED [ 39%] tests/test_formparsers.py::test_multipart_multi_field_app_reads_body[asyncio] PASSED [ 39%] tests/test_formparsers.py::test_multipart_multi_field_app_reads_body[trio] PASSED [ 39%] tests/test_formparsers.py::test_user_safe_decode_helper PASSED [ 39%] tests/test_formparsers.py::test_user_safe_decode_ignores_wrong_charset PASSED [ 39%] tests/test_formparsers.py::test_missing_boundary_parameter[asyncio-app-expectation0] PASSED [ 39%] tests/test_formparsers.py::test_missing_boundary_parameter[asyncio-app1-expectation1] PASSED [ 39%] tests/test_formparsers.py::test_missing_boundary_parameter[trio-app-expectation0] PASSED [ 40%] tests/test_formparsers.py::test_missing_boundary_parameter[trio-app1-expectation1] PASSED [ 40%] tests/test_formparsers.py::test_missing_name_parameter_on_content_disposition[asyncio-app-expectation0] PASSED [ 40%] tests/test_formparsers.py::test_missing_name_parameter_on_content_disposition[asyncio-app1-expectation1] PASSED [ 40%] tests/test_formparsers.py::test_missing_name_parameter_on_content_disposition[trio-app-expectation0] PASSED [ 40%] tests/test_formparsers.py::test_missing_name_parameter_on_content_disposition[trio-app1-expectation1] PASSED [ 40%] tests/test_formparsers.py::test_too_many_fields_raise[asyncio-app-expectation0] PASSED [ 40%] tests/test_formparsers.py::test_too_many_fields_raise[asyncio-app1-expectation1] PASSED [ 40%] tests/test_formparsers.py::test_too_many_fields_raise[trio-app-expectation0] PASSED [ 40%] tests/test_formparsers.py::test_too_many_fields_raise[trio-app1-expectation1] PASSED [ 41%] tests/test_formparsers.py::test_too_many_files_raise[asyncio-app-expectation0] PASSED [ 41%] tests/test_formparsers.py::test_too_many_files_raise[asyncio-app1-expectation1] PASSED [ 41%] tests/test_formparsers.py::test_too_many_files_raise[trio-app-expectation0] PASSED [ 41%] tests/test_formparsers.py::test_too_many_files_raise[trio-app1-expectation1] PASSED [ 41%] tests/test_formparsers.py::test_too_many_files_single_field_raise[asyncio-app-expectation0] PASSED [ 41%] tests/test_formparsers.py::test_too_many_files_single_field_raise[asyncio-app1-expectation1] PASSED [ 41%] tests/test_formparsers.py::test_too_many_files_single_field_raise[trio-app-expectation0] PASSED [ 41%] tests/test_formparsers.py::test_too_many_files_single_field_raise[trio-app1-expectation1] PASSED [ 41%] tests/test_formparsers.py::test_too_many_files_and_fields_raise[asyncio-app-expectation0] PASSED [ 42%] tests/test_formparsers.py::test_too_many_files_and_fields_raise[asyncio-app1-expectation1] PASSED [ 42%] tests/test_formparsers.py::test_too_many_files_and_fields_raise[trio-app-expectation0] PASSED [ 42%] tests/test_formparsers.py::test_too_many_files_and_fields_raise[trio-app1-expectation1] PASSED [ 42%] tests/test_formparsers.py::test_max_fields_is_customizable_low_raises[asyncio-app-expectation0] PASSED [ 42%] tests/test_formparsers.py::test_max_fields_is_customizable_low_raises[asyncio-app1-expectation1] PASSED [ 42%] tests/test_formparsers.py::test_max_fields_is_customizable_low_raises[trio-app-expectation0] PASSED [ 42%] tests/test_formparsers.py::test_max_fields_is_customizable_low_raises[trio-app1-expectation1] PASSED [ 42%] tests/test_formparsers.py::test_max_files_is_customizable_low_raises[asyncio-app-expectation0] PASSED [ 43%] tests/test_formparsers.py::test_max_files_is_customizable_low_raises[asyncio-app1-expectation1] PASSED [ 43%] tests/test_formparsers.py::test_max_files_is_customizable_low_raises[trio-app-expectation0] PASSED [ 43%] tests/test_formparsers.py::test_max_files_is_customizable_low_raises[trio-app1-expectation1] PASSED [ 43%] tests/test_formparsers.py::test_max_fields_is_customizable_high[asyncio] PASSED [ 43%] tests/test_formparsers.py::test_max_fields_is_customizable_high[trio] PASSED [ 43%] tests/test_formparsers.py::test_max_part_size_exceeds_limit[asyncio-app-expectation0] PASSED [ 43%] tests/test_formparsers.py::test_max_part_size_exceeds_limit[asyncio-app1-expectation1] PASSED [ 43%] tests/test_formparsers.py::test_max_part_size_exceeds_limit[trio-app-expectation0] PASSED [ 43%] tests/test_formparsers.py::test_max_part_size_exceeds_limit[trio-app1-expectation1] PASSED [ 44%] tests/test_formparsers.py::test_max_part_size_exceeds_custom_limit[asyncio-app-expectation0] PASSED [ 44%] tests/test_formparsers.py::test_max_part_size_exceeds_custom_limit[asyncio-app1-expectation1] PASSED [ 44%] tests/test_formparsers.py::test_max_part_size_exceeds_custom_limit[trio-app-expectation0] PASSED [ 44%] tests/test_formparsers.py::test_max_part_size_exceeds_custom_limit[trio-app1-expectation1] PASSED [ 44%] tests/test_requests.py::test_request_url[asyncio] PASSED [ 44%] tests/test_requests.py::test_request_url[trio] PASSED [ 44%] tests/test_requests.py::test_request_query_params[asyncio] PASSED [ 44%] tests/test_requests.py::test_request_query_params[trio] PASSED [ 44%] tests/test_requests.py::test_request_headers[asyncio] PASSED [ 45%] tests/test_requests.py::test_request_headers[trio] PASSED [ 45%] tests/test_requests.py::test_request_client[scope0-expected_client0] PASSED [ 45%] tests/test_requests.py::test_request_client[scope1-None] PASSED [ 45%] tests/test_requests.py::test_request_client[scope2-None] PASSED [ 45%] tests/test_requests.py::test_request_body[asyncio] PASSED [ 45%] tests/test_requests.py::test_request_body[trio] PASSED [ 45%] tests/test_requests.py::test_request_stream[asyncio] PASSED [ 45%] tests/test_requests.py::test_request_stream[trio] PASSED [ 45%] tests/test_requests.py::test_request_form_urlencoded[asyncio] PASSED [ 46%] tests/test_requests.py::test_request_form_urlencoded[trio] PASSED [ 46%] tests/test_requests.py::test_request_form_context_manager[asyncio] PASSED [ 46%] tests/test_requests.py::test_request_form_context_manager[trio] PASSED [ 46%] tests/test_requests.py::test_request_body_then_stream[asyncio] PASSED [ 46%] tests/test_requests.py::test_request_body_then_stream[trio] PASSED [ 46%] tests/test_requests.py::test_request_stream_then_body[asyncio] PASSED [ 46%] tests/test_requests.py::test_request_stream_then_body[trio] PASSED [ 46%] tests/test_requests.py::test_request_json[asyncio] PASSED [ 46%] tests/test_requests.py::test_request_json[trio] PASSED [ 47%] tests/test_requests.py::test_request_scope_interface PASSED [ 47%] tests/test_requests.py::test_request_raw_path[asyncio] PASSED [ 47%] tests/test_requests.py::test_request_raw_path[trio] PASSED [ 47%] tests/test_requests.py::test_request_without_setting_receive[asyncio] PASSED [ 47%] tests/test_requests.py::test_request_without_setting_receive[trio] PASSED [ 47%] tests/test_requests.py::test_request_disconnect[asyncio] PASSED [ 47%] tests/test_requests.py::test_request_disconnect[trio] PASSED [ 47%] tests/test_requests.py::test_request_is_disconnected[asyncio] PASSED [ 47%] tests/test_requests.py::test_request_is_disconnected[trio] PASSED [ 48%] tests/test_requests.py::test_request_state_object PASSED [ 48%] tests/test_requests.py::test_request_state[asyncio] PASSED [ 48%] tests/test_requests.py::test_request_state[trio] PASSED [ 48%] tests/test_requests.py::test_request_cookies[asyncio] PASSED [ 48%] tests/test_requests.py::test_request_cookies[trio] PASSED [ 48%] tests/test_requests.py::test_cookie_lenient_parsing[asyncio] PASSED [ 48%] tests/test_requests.py::test_cookie_lenient_parsing[trio] PASSED [ 48%] tests/test_requests.py::test_cookies_edge_cases[asyncio-chips=ahoy; vienna=finger-expected0] PASSED [ 48%] tests/test_requests.py::test_cookies_edge_cases[asyncio-keebler="E=mc2; L=\\"Loves\\"; fudge=\\012;"-expected1] PASSED [ 49%] tests/test_requests.py::test_cookies_edge_cases[asyncio-keebler=E=mc2-expected2] PASSED [ 49%] tests/test_requests.py::test_cookies_edge_cases[asyncio-key:term=value:term-expected3] PASSED [ 49%] tests/test_requests.py::test_cookies_edge_cases[asyncio-a=b; c=[; d=r; f=h-expected4] PASSED [ 49%] tests/test_requests.py::test_cookies_edge_cases[asyncio-a=b; Domain=example.com-expected5] PASSED [ 49%] tests/test_requests.py::test_cookies_edge_cases[asyncio-a=b; h=i; a=c-expected6] PASSED [ 49%] tests/test_requests.py::test_cookies_edge_cases[trio-chips=ahoy; vienna=finger-expected0] PASSED [ 49%] tests/test_requests.py::test_cookies_edge_cases[trio-keebler="E=mc2; L=\\"Loves\\"; fudge=\\012;"-expected1] PASSED [ 49%] tests/test_requests.py::test_cookies_edge_cases[trio-keebler=E=mc2-expected2] PASSED [ 50%] tests/test_requests.py::test_cookies_edge_cases[trio-key:term=value:term-expected3] PASSED [ 50%] tests/test_requests.py::test_cookies_edge_cases[trio-a=b; c=[; d=r; f=h-expected4] PASSED [ 50%] tests/test_requests.py::test_cookies_edge_cases[trio-a=b; Domain=example.com-expected5] PASSED [ 50%] tests/test_requests.py::test_cookies_edge_cases[trio-a=b; h=i; a=c-expected6] PASSED [ 50%] tests/test_requests.py::test_cookies_invalid[asyncio-abc=def; unnamed; django_language=en-expected0] PASSED [ 50%] tests/test_requests.py::test_cookies_invalid[asyncio-a=b; "; c=d-expected1] PASSED [ 50%] tests/test_requests.py::test_cookies_invalid[asyncio-a b c=d e = f; gh=i-expected2] PASSED [ 50%] tests/test_requests.py::test_cookies_invalid[asyncio-a b,c<>@:/[]?{}=d " =e,f g-expected3] PASSED [ 50%] tests/test_requests.py::test_cookies_invalid[asyncio- = b ; ; = ; c = ; -expected4] PASSED [ 51%] tests/test_requests.py::test_cookies_invalid[trio-abc=def; unnamed; django_language=en-expected0] PASSED [ 51%] tests/test_requests.py::test_cookies_invalid[trio-a=b; "; c=d-expected1] PASSED [ 51%] tests/test_requests.py::test_cookies_invalid[trio-a b c=d e = f; gh=i-expected2] PASSED [ 51%] tests/test_requests.py::test_cookies_invalid[trio-a b,c<>@:/[]?{}=d " =e,f g-expected3] PASSED [ 51%] tests/test_requests.py::test_cookies_invalid[trio- = b ; ; = ; c = ; -expected4] PASSED [ 51%] tests/test_requests.py::test_chunked_encoding[asyncio] PASSED [ 51%] tests/test_requests.py::test_chunked_encoding[trio] PASSED [ 51%] tests/test_requests.py::test_request_send_push_promise[asyncio] PASSED [ 51%] tests/test_requests.py::test_request_send_push_promise[trio] PASSED [ 52%] tests/test_requests.py::test_request_send_push_promise_without_push_extension[asyncio] PASSED [ 52%] tests/test_requests.py::test_request_send_push_promise_without_push_extension[trio] PASSED [ 52%] tests/test_requests.py::test_request_send_push_promise_without_setting_send[asyncio] PASSED [ 52%] tests/test_requests.py::test_request_send_push_promise_without_setting_send[trio] PASSED [ 52%] tests/test_requests.py::test_request_rcv[asyncio-messages0] PASSED [ 52%] tests/test_requests.py::test_request_rcv[asyncio-messages1] PASSED [ 52%] tests/test_requests.py::test_request_rcv[asyncio-messages2] PASSED [ 52%] tests/test_requests.py::test_request_rcv[asyncio-messages3] PASSED [ 52%] tests/test_requests.py::test_request_rcv[trio-messages0] PASSED [ 53%] tests/test_requests.py::test_request_rcv[trio-messages1] PASSED [ 53%] tests/test_requests.py::test_request_rcv[trio-messages2] PASSED [ 53%] tests/test_requests.py::test_request_rcv[trio-messages3] PASSED [ 53%] tests/test_requests.py::test_request_stream_called_twice[asyncio] PASSED [ 53%] tests/test_requests.py::test_request_stream_called_twice[trio] PASSED [ 53%] tests/test_requests.py::test_request_url_outside_starlette_context[asyncio] PASSED [ 53%] tests/test_requests.py::test_request_url_outside_starlette_context[trio] PASSED [ 53%] tests/test_requests.py::test_request_url_starlette_context[asyncio] PASSED [ 53%] tests/test_requests.py::test_request_url_starlette_context[trio] PASSED [ 54%] tests/test_responses.py::test_text_response[asyncio] PASSED [ 54%] tests/test_responses.py::test_text_response[trio] PASSED [ 54%] tests/test_responses.py::test_bytes_response[asyncio] PASSED [ 54%] tests/test_responses.py::test_bytes_response[trio] PASSED [ 54%] tests/test_responses.py::test_json_none_response[asyncio] PASSED [ 54%] tests/test_responses.py::test_json_none_response[trio] PASSED [ 54%] tests/test_responses.py::test_redirect_response[asyncio] PASSED [ 54%] tests/test_responses.py::test_redirect_response[trio] PASSED [ 54%] tests/test_responses.py::test_quoting_redirect_response[asyncio] PASSED [ 55%] tests/test_responses.py::test_quoting_redirect_response[trio] PASSED [ 55%] tests/test_responses.py::test_redirect_response_content_length_header[asyncio] PASSED [ 55%] tests/test_responses.py::test_redirect_response_content_length_header[trio] PASSED [ 55%] tests/test_responses.py::test_streaming_response[asyncio] PASSED [ 55%] tests/test_responses.py::test_streaming_response[trio] PASSED [ 55%] tests/test_responses.py::test_streaming_response_custom_iterator[asyncio] PASSED [ 55%] tests/test_responses.py::test_streaming_response_custom_iterator[trio] PASSED [ 55%] tests/test_responses.py::test_streaming_response_custom_iterable[asyncio] PASSED [ 55%] tests/test_responses.py::test_streaming_response_custom_iterable[trio] PASSED [ 56%] tests/test_responses.py::test_sync_streaming_response[asyncio] PASSED [ 56%] tests/test_responses.py::test_sync_streaming_response[trio] PASSED [ 56%] tests/test_responses.py::test_response_headers[asyncio] PASSED [ 56%] tests/test_responses.py::test_response_headers[trio] PASSED [ 56%] tests/test_responses.py::test_response_phrase[asyncio] PASSED [ 56%] tests/test_responses.py::test_response_phrase[trio] PASSED [ 56%] tests/test_responses.py::test_file_response[asyncio] PASSED [ 56%] tests/test_responses.py::test_file_response[trio] PASSED [ 56%] tests/test_responses.py::test_file_response_on_head_method[asyncio] PASSED [ 57%] tests/test_responses.py::test_file_response_on_head_method[trio] PASSED [ 57%] tests/test_responses.py::test_file_response_set_media_type[asyncio] PASSED [ 57%] tests/test_responses.py::test_file_response_set_media_type[trio] PASSED [ 57%] tests/test_responses.py::test_file_response_with_directory_raises_error[asyncio] PASSED [ 57%] tests/test_responses.py::test_file_response_with_directory_raises_error[trio] PASSED [ 57%] tests/test_responses.py::test_file_response_with_missing_file_raises_error[asyncio] PASSED [ 57%] tests/test_responses.py::test_file_response_with_missing_file_raises_error[trio] PASSED [ 57%] tests/test_responses.py::test_file_response_with_chinese_filename[asyncio] PASSED [ 58%] tests/test_responses.py::test_file_response_with_chinese_filename[trio] PASSED [ 58%] tests/test_responses.py::test_file_response_with_inline_disposition[asyncio] PASSED [ 58%] tests/test_responses.py::test_file_response_with_inline_disposition[trio] PASSED [ 58%] tests/test_responses.py::test_file_response_with_method_warns PASSED [ 58%] tests/test_responses.py::test_file_response_with_range_header[asyncio] PASSED [ 58%] tests/test_responses.py::test_file_response_with_range_header[trio] PASSED [ 58%] tests/test_responses.py::test_set_cookie[asyncio] PASSED [ 58%] tests/test_responses.py::test_set_cookie[trio] PASSED [ 58%] tests/test_responses.py::test_set_cookie_path_none[asyncio] PASSED [ 59%] tests/test_responses.py::test_set_cookie_path_none[trio] PASSED [ 59%] tests/test_responses.py::test_set_cookie_samesite_none[asyncio] PASSED [ 59%] tests/test_responses.py::test_set_cookie_samesite_none[trio] PASSED [ 59%] tests/test_responses.py::test_expires_on_set_cookie[asyncio-datetime] PASSED [ 59%] tests/test_responses.py::test_expires_on_set_cookie[asyncio-str] PASSED [ 59%] tests/test_responses.py::test_expires_on_set_cookie[asyncio-int] PASSED [ 59%] tests/test_responses.py::test_expires_on_set_cookie[trio-datetime] PASSED [ 59%] tests/test_responses.py::test_expires_on_set_cookie[trio-str] PASSED [ 59%] tests/test_responses.py::test_expires_on_set_cookie[trio-int] PASSED [ 60%] tests/test_responses.py::test_delete_cookie[asyncio] PASSED [ 60%] tests/test_responses.py::test_delete_cookie[trio] PASSED [ 60%] tests/test_responses.py::test_populate_headers[asyncio] PASSED [ 60%] tests/test_responses.py::test_populate_headers[trio] PASSED [ 60%] tests/test_responses.py::test_head_method[asyncio] PASSED [ 60%] tests/test_responses.py::test_head_method[trio] PASSED [ 60%] tests/test_responses.py::test_empty_response[asyncio] PASSED [ 60%] tests/test_responses.py::test_empty_response[trio] PASSED [ 60%] tests/test_responses.py::test_empty_204_response[asyncio] PASSED [ 61%] tests/test_responses.py::test_empty_204_response[trio] PASSED [ 61%] tests/test_responses.py::test_non_empty_response[asyncio] PASSED [ 61%] tests/test_responses.py::test_non_empty_response[trio] PASSED [ 61%] tests/test_responses.py::test_response_do_not_add_redundant_charset[asyncio] PASSED [ 61%] tests/test_responses.py::test_response_do_not_add_redundant_charset[trio] PASSED [ 61%] tests/test_responses.py::test_file_response_known_size[asyncio] PASSED [ 61%] tests/test_responses.py::test_file_response_known_size[trio] PASSED [ 61%] tests/test_responses.py::test_streaming_response_unknown_size[asyncio] PASSED [ 61%] tests/test_responses.py::test_streaming_response_unknown_size[trio] PASSED [ 62%] tests/test_responses.py::test_streaming_response_known_size[asyncio] PASSED [ 62%] tests/test_responses.py::test_streaming_response_known_size[trio] PASSED [ 62%] tests/test_responses.py::test_response_memoryview[asyncio] PASSED [ 62%] tests/test_responses.py::test_response_memoryview[trio] PASSED [ 62%] tests/test_responses.py::test_streaming_response_memoryview[asyncio] PASSED [ 62%] tests/test_responses.py::test_streaming_response_memoryview[trio] PASSED [ 62%] tests/test_responses.py::test_streaming_response_stops_if_receiving_http_disconnect[asyncio] PASSED [ 62%] tests/test_responses.py::test_streaming_response_stops_if_receiving_http_disconnect[trio] PASSED [ 62%] tests/test_responses.py::test_streaming_response_on_client_disconnects[asyncio] PASSED [ 63%] tests/test_responses.py::test_streaming_response_on_client_disconnects[trio] PASSED [ 63%] tests/test_responses.py::test_file_response_without_range[asyncio] PASSED [ 63%] tests/test_responses.py::test_file_response_without_range[trio] PASSED [ 63%] tests/test_responses.py::test_file_response_head[asyncio] PASSED [ 63%] tests/test_responses.py::test_file_response_head[trio] PASSED [ 63%] tests/test_responses.py::test_file_response_range[asyncio] PASSED [ 63%] tests/test_responses.py::test_file_response_range[trio] PASSED [ 63%] tests/test_responses.py::test_file_response_range_head[asyncio] PASSED [ 63%] tests/test_responses.py::test_file_response_range_head[trio] PASSED [ 64%] tests/test_responses.py::test_file_response_range_multi[asyncio] PASSED [ 64%] tests/test_responses.py::test_file_response_range_multi[trio] PASSED [ 64%] tests/test_responses.py::test_file_response_range_multi_head[asyncio] PASSED [ 64%] tests/test_responses.py::test_file_response_range_multi_head[trio] PASSED [ 64%] tests/test_responses.py::test_file_response_range_invalid[asyncio] PASSED [ 64%] tests/test_responses.py::test_file_response_range_invalid[trio] PASSED [ 64%] tests/test_responses.py::test_file_response_range_head_max[asyncio] PASSED [ 64%] tests/test_responses.py::test_file_response_range_head_max[trio] PASSED [ 65%] tests/test_responses.py::test_file_response_range_416[asyncio] PASSED [ 65%] tests/test_responses.py::test_file_response_range_416[trio] PASSED [ 65%] tests/test_responses.py::test_file_response_only_support_bytes_range[asyncio] PASSED [ 65%] tests/test_responses.py::test_file_response_only_support_bytes_range[trio] PASSED [ 65%] tests/test_responses.py::test_file_response_range_must_be_requested[asyncio] PASSED [ 65%] tests/test_responses.py::test_file_response_range_must_be_requested[trio] PASSED [ 65%] tests/test_responses.py::test_file_response_start_must_be_less_than_end[asyncio] PASSED [ 65%] tests/test_responses.py::test_file_response_start_must_be_less_than_end[trio] PASSED [ 65%] tests/test_responses.py::test_file_response_merge_ranges[asyncio] PASSED [ 66%] tests/test_responses.py::test_file_response_merge_ranges[trio] PASSED [ 66%] tests/test_responses.py::test_file_response_insert_ranges[asyncio] PASSED [ 66%] tests/test_responses.py::test_file_response_insert_ranges[trio] PASSED [ 66%] tests/test_responses.py::test_file_response_multi_small_chunk_size[asyncio] PASSED [ 66%] tests/test_responses.py::test_file_response_multi_small_chunk_size[trio] PASSED [ 66%] tests/test_routing.py::test_router[asyncio] ERROR [ 66%] tests/test_routing.py::test_router[trio] ERROR [ 66%] tests/test_routing.py::test_route_converters[asyncio] ERROR [ 66%] tests/test_routing.py::test_route_converters[trio] ERROR [ 67%] tests/test_routing.py::test_url_path_for PASSED [ 67%] tests/test_routing.py::test_url_for PASSED [ 67%] tests/test_routing.py::test_router_add_route[asyncio] ERROR [ 67%] tests/test_routing.py::test_router_add_route[trio] ERROR [ 67%] tests/test_routing.py::test_router_duplicate_path[asyncio] ERROR [ 67%] tests/test_routing.py::test_router_duplicate_path[trio] ERROR [ 67%] tests/test_routing.py::test_router_add_websocket_route[asyncio] ERROR [ 67%] tests/test_routing.py::test_router_add_websocket_route[trio] ERROR [ 67%] tests/test_routing.py::test_router_middleware[asyncio] PASSED [ 68%] tests/test_routing.py::test_router_middleware[trio] PASSED [ 68%] tests/test_routing.py::test_protocol_switch[asyncio] FAILED [ 68%] tests/test_routing.py::test_protocol_switch[trio] FAILED [ 68%] tests/test_routing.py::test_mount_urls[asyncio] PASSED [ 68%] tests/test_routing.py::test_mount_urls[trio] PASSED [ 68%] tests/test_routing.py::test_reverse_mount_urls PASSED [ 68%] tests/test_routing.py::test_mount_at_root[asyncio] PASSED [ 68%] tests/test_routing.py::test_mount_at_root[trio] PASSED [ 68%] tests/test_routing.py::test_host_routing[asyncio] PASSED [ 69%] tests/test_routing.py::test_host_routing[trio] PASSED [ 69%] tests/test_routing.py::test_host_reverse_urls PASSED [ 69%] tests/test_routing.py::test_subdomain_routing[asyncio] PASSED [ 69%] tests/test_routing.py::test_subdomain_routing[trio] PASSED [ 69%] tests/test_routing.py::test_subdomain_reverse_urls PASSED [ 69%] tests/test_routing.py::test_url_for_with_root_path[asyncio] PASSED [ 69%] tests/test_routing.py::test_url_for_with_root_path[trio] PASSED [ 69%] tests/test_routing.py::test_url_for_with_double_mount PASSED [ 69%] tests/test_routing.py::test_url_for_with_root_path_ending_with_slash[asyncio] PASSED [ 70%] tests/test_routing.py::test_url_for_with_root_path_ending_with_slash[trio] PASSED [ 70%] tests/test_routing.py::test_standalone_route_matches[asyncio] PASSED [ 70%] tests/test_routing.py::test_standalone_route_matches[trio] PASSED [ 70%] tests/test_routing.py::test_standalone_route_does_not_match[asyncio] PASSED [ 70%] tests/test_routing.py::test_standalone_route_does_not_match[trio] PASSED [ 70%] tests/test_routing.py::test_standalone_ws_route_matches[asyncio] FAILED [ 70%] tests/test_routing.py::test_standalone_ws_route_matches[trio] FAILED [ 70%] tests/test_routing.py::test_standalone_ws_route_does_not_match[asyncio] FAILED [ 70%] tests/test_routing.py::test_standalone_ws_route_does_not_match[trio] FAILED [ 71%] tests/test_routing.py::test_lifespan_async[asyncio] FAILED [ 71%] tests/test_routing.py::test_lifespan_async[trio] FAILED [ 71%] tests/test_routing.py::test_lifespan_sync[asyncio] FAILED [ 71%] tests/test_routing.py::test_lifespan_sync[trio] FAILED [ 71%] tests/test_routing.py::test_lifespan_state_unsupported[asyncio] FAILED [ 71%] tests/test_routing.py::test_lifespan_state_unsupported[trio] FAILED [ 71%] tests/test_routing.py::test_lifespan_state_async_cm[asyncio] FAILED [ 71%] tests/test_routing.py::test_lifespan_state_async_cm[trio] FAILED [ 72%] tests/test_routing.py::test_raise_on_startup[asyncio] FAILED [ 72%] tests/test_routing.py::test_raise_on_startup[trio] FAILED [ 72%] tests/test_routing.py::test_raise_on_shutdown[asyncio] FAILED [ 72%] tests/test_routing.py::test_raise_on_shutdown[trio] FAILED [ 72%] tests/test_routing.py::test_partial_async_endpoint[asyncio] PASSED [ 72%] tests/test_routing.py::test_partial_async_endpoint[trio] PASSED [ 72%] tests/test_routing.py::test_partial_async_ws_endpoint[asyncio] FAILED [ 72%] tests/test_routing.py::test_partial_async_ws_endpoint[trio] FAILED [ 72%] tests/test_routing.py::test_duplicated_param_names PASSED [ 73%] tests/test_routing.py::test_route_name[function] PASSED [ 73%] tests/test_routing.py::test_route_name[method] PASSED [ 73%] tests/test_routing.py::test_route_name[classmethod] PASSED [ 73%] tests/test_routing.py::test_route_name[staticmethod] PASSED [ 73%] tests/test_routing.py::test_route_name[object] PASSED [ 73%] tests/test_routing.py::test_route_name[lambda] PASSED [ 73%] tests/test_routing.py::test_base_route_middleware[asyncio-app0] PASSED [ 73%] tests/test_routing.py::test_base_route_middleware[asyncio-app1] PASSED [ 73%] tests/test_routing.py::test_base_route_middleware[asyncio-app2] PASSED [ 74%] tests/test_routing.py::test_base_route_middleware[trio-app0] PASSED [ 74%] tests/test_routing.py::test_base_route_middleware[trio-app1] PASSED [ 74%] tests/test_routing.py::test_base_route_middleware[trio-app2] PASSED [ 74%] tests/test_routing.py::test_mount_routes_with_middleware_url_path_for PASSED [ 74%] tests/test_routing.py::test_mount_asgi_app_with_middleware_url_path_for PASSED [ 74%] tests/test_routing.py::test_add_route_to_app_after_mount[asyncio] PASSED [ 74%] tests/test_routing.py::test_add_route_to_app_after_mount[trio] PASSED [ 74%] tests/test_routing.py::test_exception_on_mounted_apps[asyncio] PASSED [ 74%] tests/test_routing.py::test_exception_on_mounted_apps[trio] PASSED [ 75%] tests/test_routing.py::test_mounted_middleware_does_not_catch_exception[asyncio] PASSED [ 75%] tests/test_routing.py::test_mounted_middleware_does_not_catch_exception[trio] PASSED [ 75%] tests/test_routing.py::test_websocket_route_middleware[asyncio] FAILED [ 75%] tests/test_routing.py::test_websocket_route_middleware[trio] FAILED [ 75%] tests/test_routing.py::test_route_repr PASSED [ 75%] tests/test_routing.py::test_route_repr_without_methods PASSED [ 75%] tests/test_routing.py::test_websocket_route_repr PASSED [ 75%] tests/test_routing.py::test_mount_repr PASSED [ 75%] tests/test_routing.py::test_mount_named_repr PASSED [ 76%] tests/test_routing.py::test_host_repr PASSED [ 76%] tests/test_routing.py::test_host_named_repr PASSED [ 76%] tests/test_routing.py::test_decorator_deprecations PASSED [ 76%] tests/test_routing.py::test_paths_with_root_path[asyncio] PASSED [ 76%] tests/test_routing.py::test_paths_with_root_path[trio] PASSED [ 76%] tests/test_schemas.py::test_schema_generation PASSED [ 76%] tests/test_schemas.py::test_schema_endpoint[asyncio] PASSED [ 76%] tests/test_schemas.py::test_schema_endpoint[trio] PASSED [ 76%] tests/test_staticfiles.py::test_staticfiles[asyncio] PASSED [ 77%] tests/test_staticfiles.py::test_staticfiles[trio] PASSED [ 77%] tests/test_staticfiles.py::test_staticfiles_with_pathlib[asyncio] PASSED [ 77%] tests/test_staticfiles.py::test_staticfiles_with_pathlib[trio] PASSED [ 77%] tests/test_staticfiles.py::test_staticfiles_head_with_middleware[asyncio] FAILED [ 77%] tests/test_staticfiles.py::test_staticfiles_head_with_middleware[trio] FAILED [ 77%] tests/test_staticfiles.py::test_staticfiles_with_package[asyncio] PASSED [ 77%] tests/test_staticfiles.py::test_staticfiles_with_package[trio] PASSED [ 77%] tests/test_staticfiles.py::test_staticfiles_post[asyncio] PASSED [ 77%] tests/test_staticfiles.py::test_staticfiles_post[trio] PASSED [ 78%] tests/test_staticfiles.py::test_staticfiles_with_directory_returns_404[asyncio] PASSED [ 78%] tests/test_staticfiles.py::test_staticfiles_with_directory_returns_404[trio] PASSED [ 78%] tests/test_staticfiles.py::test_staticfiles_with_missing_file_returns_404[asyncio] PASSED [ 78%] tests/test_staticfiles.py::test_staticfiles_with_missing_file_returns_404[trio] PASSED [ 78%] tests/test_staticfiles.py::test_staticfiles_instantiated_with_missing_directory PASSED [ 78%] tests/test_staticfiles.py::test_staticfiles_configured_with_missing_directory[asyncio] PASSED [ 78%] tests/test_staticfiles.py::test_staticfiles_configured_with_missing_directory[trio] PASSED [ 78%] tests/test_staticfiles.py::test_staticfiles_configured_with_file_instead_of_directory[asyncio] PASSED [ 79%] tests/test_staticfiles.py::test_staticfiles_configured_with_file_instead_of_directory[trio] PASSED [ 79%] tests/test_staticfiles.py::test_staticfiles_config_check_occurs_only_once[asyncio] PASSED [ 79%] tests/test_staticfiles.py::test_staticfiles_config_check_occurs_only_once[trio] PASSED [ 79%] tests/test_staticfiles.py::test_staticfiles_prevents_breaking_out_of_directory PASSED [ 79%] tests/test_staticfiles.py::test_staticfiles_never_read_file_for_head_method[asyncio] PASSED [ 79%] tests/test_staticfiles.py::test_staticfiles_never_read_file_for_head_method[trio] PASSED [ 79%] tests/test_staticfiles.py::test_staticfiles_304_with_etag_match[asyncio] PASSED [ 79%] tests/test_staticfiles.py::test_staticfiles_304_with_etag_match[trio] PASSED [ 79%] tests/test_staticfiles.py::test_staticfiles_200_with_etag_mismatch[asyncio] PASSED [ 80%] tests/test_staticfiles.py::test_staticfiles_200_with_etag_mismatch[trio] PASSED [ 80%] tests/test_staticfiles.py::test_staticfiles_304_with_last_modified_compare_last_req[asyncio] PASSED [ 80%] tests/test_staticfiles.py::test_staticfiles_304_with_last_modified_compare_last_req[trio] PASSED [ 80%] tests/test_staticfiles.py::test_staticfiles_html_normal[asyncio] PASSED [ 80%] tests/test_staticfiles.py::test_staticfiles_html_normal[trio] PASSED [ 80%] tests/test_staticfiles.py::test_staticfiles_html_without_index[asyncio] PASSED [ 80%] tests/test_staticfiles.py::test_staticfiles_html_without_index[trio] PASSED [ 80%] tests/test_staticfiles.py::test_staticfiles_html_without_404[asyncio] PASSED [ 80%] tests/test_staticfiles.py::test_staticfiles_html_without_404[trio] PASSED [ 81%] tests/test_staticfiles.py::test_staticfiles_html_only_files[asyncio] PASSED [ 81%] tests/test_staticfiles.py::test_staticfiles_html_only_files[trio] PASSED [ 81%] tests/test_staticfiles.py::test_staticfiles_cache_invalidation_for_deleted_file_html_mode[asyncio] PASSED [ 81%] tests/test_staticfiles.py::test_staticfiles_cache_invalidation_for_deleted_file_html_mode[trio] PASSED [ 81%] tests/test_staticfiles.py::test_staticfiles_with_invalid_dir_permissions_returns_401[asyncio] PASSED [ 81%] tests/test_staticfiles.py::test_staticfiles_with_invalid_dir_permissions_returns_401[trio] PASSED [ 81%] tests/test_staticfiles.py::test_staticfiles_with_missing_dir_returns_404[asyncio] PASSED [ 81%] tests/test_staticfiles.py::test_staticfiles_with_missing_dir_returns_404[trio] PASSED [ 81%] tests/test_staticfiles.py::test_staticfiles_access_file_as_dir_returns_404[asyncio] PASSED [ 82%] tests/test_staticfiles.py::test_staticfiles_access_file_as_dir_returns_404[trio] PASSED [ 82%] tests/test_staticfiles.py::test_staticfiles_filename_too_long[asyncio] PASSED [ 82%] tests/test_staticfiles.py::test_staticfiles_filename_too_long[trio] PASSED [ 82%] tests/test_staticfiles.py::test_staticfiles_unhandled_os_error_returns_500[asyncio] PASSED [ 82%] tests/test_staticfiles.py::test_staticfiles_unhandled_os_error_returns_500[trio] PASSED [ 82%] tests/test_staticfiles.py::test_staticfiles_follows_symlinks[asyncio] PASSED [ 82%] tests/test_staticfiles.py::test_staticfiles_follows_symlinks[trio] PASSED [ 82%] tests/test_staticfiles.py::test_staticfiles_follows_symlink_directories[asyncio] PASSED [ 82%] tests/test_staticfiles.py::test_staticfiles_follows_symlink_directories[trio] PASSED [ 83%] tests/test_staticfiles.py::test_staticfiles_disallows_path_traversal_with_symlinks PASSED [ 83%] tests/test_staticfiles.py::test_staticfiles_avoids_path_traversal PASSED [ 83%] tests/test_staticfiles.py::test_staticfiles_self_symlinks[asyncio] PASSED [ 83%] tests/test_staticfiles.py::test_staticfiles_self_symlinks[trio] PASSED [ 83%] tests/test_templates.py::test_templates[asyncio] PASSED [ 83%] tests/test_templates.py::test_templates[trio] PASSED [ 83%] tests/test_templates.py::test_calls_context_processors[asyncio] PASSED [ 83%] tests/test_templates.py::test_calls_context_processors[trio] PASSED [ 83%] tests/test_templates.py::test_template_with_middleware[asyncio] FAILED [ 84%] tests/test_templates.py::test_template_with_middleware[trio] FAILED [ 84%] tests/test_templates.py::test_templates_with_directories[asyncio] PASSED [ 84%] tests/test_templates.py::test_templates_with_directories[trio] PASSED [ 84%] tests/test_templates.py::test_templates_require_directory_or_environment PASSED [ 84%] tests/test_templates.py::test_templates_require_directory_or_enviroment_not_both PASSED [ 84%] tests/test_templates.py::test_templates_with_directory PASSED [ 84%] tests/test_templates.py::test_templates_with_environment[asyncio] PASSED [ 84%] tests/test_templates.py::test_templates_with_environment[trio] PASSED [ 84%] tests/test_templates.py::test_templates_with_environment_options_emit_warning PASSED [ 85%] tests/test_templates.py::test_templates_with_kwargs_only[asyncio] PASSED [ 85%] tests/test_templates.py::test_templates_with_kwargs_only[trio] PASSED [ 85%] tests/test_templates.py::test_templates_with_kwargs_only_requires_request_in_context PASSED [ 85%] tests/test_templates.py::test_templates_with_kwargs_only_warns_when_no_request_keyword[asyncio] PASSED [ 85%] tests/test_templates.py::test_templates_with_kwargs_only_warns_when_no_request_keyword[trio] PASSED [ 85%] tests/test_templates.py::test_templates_with_requires_request_in_context PASSED [ 85%] tests/test_templates.py::test_templates_warns_when_first_argument_isnot_request[asyncio] PASSED [ 85%] tests/test_templates.py::test_templates_warns_when_first_argument_isnot_request[trio] PASSED [ 86%] tests/test_templates.py::test_templates_when_first_argument_is_request[asyncio] PASSED [ 86%] tests/test_templates.py::test_templates_when_first_argument_is_request[trio] PASSED [ 86%] tests/test_testclient.py::test_use_testclient_in_endpoint[asyncio] PASSED [ 86%] tests/test_testclient.py::test_use_testclient_in_endpoint[trio] PASSED [ 86%] tests/test_testclient.py::test_testclient_headers_behavior PASSED [ 86%] tests/test_testclient.py::test_use_testclient_as_contextmanager[asyncio] FAILED [ 86%] tests/test_testclient.py::test_use_testclient_as_contextmanager[trio] FAILED [ 86%] tests/test_testclient.py::test_error_on_startup[asyncio] FAILED [ 86%] tests/test_testclient.py::test_error_on_startup[trio] FAILED [ 87%] tests/test_testclient.py::test_exception_in_middleware[asyncio] FAILED [ 87%] tests/test_testclient.py::test_exception_in_middleware[trio] FAILED [ 87%] tests/test_testclient.py::test_testclient_asgi2[asyncio] PASSED [ 87%] tests/test_testclient.py::test_testclient_asgi2[trio] PASSED [ 87%] tests/test_testclient.py::test_testclient_asgi3[asyncio] PASSED [ 87%] tests/test_testclient.py::test_testclient_asgi3[trio] PASSED [ 87%] tests/test_testclient.py::test_websocket_blocking_receive[asyncio] FAILED [ 87%] tests/test_testclient.py::test_websocket_blocking_receive[trio] FAILED [ 87%] tests/test_testclient.py::test_websocket_not_block_on_close[asyncio] FAILED [ 88%] tests/test_testclient.py::test_websocket_not_block_on_close[trio] FAILED [ 88%] tests/test_testclient.py::test_client[asyncio] PASSED [ 88%] tests/test_testclient.py::test_client[trio] PASSED [ 88%] tests/test_testclient.py::test_client_custom_client[asyncio] PASSED [ 88%] tests/test_testclient.py::test_client_custom_client[trio] PASSED [ 88%] tests/test_testclient.py::test_query_params[asyncio-2020-07-14T00:00:00+00:00] PASSED [ 88%] tests/test_testclient.py::test_query_params[asyncio-Espa\xf1a] PASSED [ 88%] tests/test_testclient.py::test_query_params[asyncio-voil\xe0] PASSED [ 88%] tests/test_testclient.py::test_query_params[trio-2020-07-14T00:00:00+00:00] PASSED [ 89%] tests/test_testclient.py::test_query_params[trio-Espa\xf1a] PASSED [ 89%] tests/test_testclient.py::test_query_params[trio-voil\xe0] PASSED [ 89%] tests/test_testclient.py::test_domain_restricted_cookies[asyncio-testserver-True] PASSED [ 89%] tests/test_testclient.py::test_domain_restricted_cookies[asyncio-testserver.local-True] PASSED [ 89%] tests/test_testclient.py::test_domain_restricted_cookies[asyncio-localhost-False] PASSED [ 89%] tests/test_testclient.py::test_domain_restricted_cookies[asyncio-example.com-False] PASSED [ 89%] tests/test_testclient.py::test_domain_restricted_cookies[trio-testserver-True] PASSED [ 89%] tests/test_testclient.py::test_domain_restricted_cookies[trio-testserver.local-True] PASSED [ 89%] tests/test_testclient.py::test_domain_restricted_cookies[trio-localhost-False] PASSED [ 90%] tests/test_testclient.py::test_domain_restricted_cookies[trio-example.com-False] PASSED [ 90%] tests/test_testclient.py::test_forward_follow_redirects[asyncio] PASSED [ 90%] tests/test_testclient.py::test_forward_follow_redirects[trio] PASSED [ 90%] tests/test_testclient.py::test_forward_nofollow_redirects[asyncio] PASSED [ 90%] tests/test_testclient.py::test_forward_nofollow_redirects[trio] PASSED [ 90%] tests/test_testclient.py::test_with_duplicate_headers[asyncio] PASSED [ 90%] tests/test_testclient.py::test_with_duplicate_headers[trio] PASSED [ 90%] tests/test_testclient.py::test_merge_url[asyncio] PASSED [ 90%] tests/test_testclient.py::test_merge_url[trio] PASSED [ 91%] tests/test_testclient.py::test_raw_path_with_querystring[asyncio] PASSED [ 91%] tests/test_testclient.py::test_raw_path_with_querystring[trio] PASSED [ 91%] tests/test_testclient.py::test_websocket_raw_path_without_params[asyncio] FAILED [ 91%] tests/test_testclient.py::test_websocket_raw_path_without_params[trio] FAILED [ 91%] tests/test_websockets.py::test_websocket_url[asyncio] FAILED [ 91%] tests/test_websockets.py::test_websocket_url[trio] FAILED [ 91%] tests/test_websockets.py::test_websocket_binary_json[asyncio] FAILED [ 91%] tests/test_websockets.py::test_websocket_binary_json[trio] FAILED [ 91%] tests/test_websockets.py::test_websocket_ensure_unicode_on_send_json[asyncio] FAILED [ 92%] tests/test_websockets.py::test_websocket_ensure_unicode_on_send_json[trio] FAILED [ 92%] tests/test_websockets.py::test_websocket_query_params[asyncio] FAILED [ 92%] tests/test_websockets.py::test_websocket_query_params[trio] FAILED [ 92%] tests/test_websockets.py::test_websocket_headers[asyncio] FAILED [ 92%] tests/test_websockets.py::test_websocket_headers[trio] FAILED [ 92%] tests/test_websockets.py::test_websocket_port[asyncio] FAILED [ 92%] tests/test_websockets.py::test_websocket_port[trio] FAILED [ 92%] tests/test_websockets.py::test_websocket_send_and_receive_text[asyncio] FAILED [ 93%] tests/test_websockets.py::test_websocket_send_and_receive_text[trio] FAILED [ 93%] tests/test_websockets.py::test_websocket_send_and_receive_bytes[asyncio] FAILED [ 93%] tests/test_websockets.py::test_websocket_send_and_receive_bytes[trio] FAILED [ 93%] tests/test_websockets.py::test_websocket_send_and_receive_json[asyncio] FAILED [ 93%] tests/test_websockets.py::test_websocket_send_and_receive_json[trio] FAILED [ 93%] tests/test_websockets.py::test_websocket_iter_text[asyncio] FAILED [ 93%] tests/test_websockets.py::test_websocket_iter_text[trio] FAILED [ 93%] tests/test_websockets.py::test_websocket_iter_bytes[asyncio] FAILED [ 93%] tests/test_websockets.py::test_websocket_iter_bytes[trio] FAILED [ 94%] tests/test_websockets.py::test_websocket_iter_json[asyncio] FAILED [ 94%] tests/test_websockets.py::test_websocket_iter_json[trio] FAILED [ 94%] tests/test_websockets.py::test_websocket_concurrency_pattern[asyncio] FAILED [ 94%] tests/test_websockets.py::test_websocket_concurrency_pattern[trio] FAILED [ 94%] tests/test_websockets.py::test_client_close[asyncio] FAILED [ 94%] tests/test_websockets.py::test_client_close[trio] FAILED [ 94%] tests/test_websockets.py::test_client_disconnect_on_send[asyncio] PASSED [ 94%] tests/test_websockets.py::test_client_disconnect_on_send[trio] PASSED [ 94%] tests/test_websockets.py::test_application_close[asyncio] FAILED [ 95%] tests/test_websockets.py::test_application_close[trio] FAILED [ 95%] tests/test_websockets.py::test_rejected_connection[asyncio] FAILED [ 95%] tests/test_websockets.py::test_rejected_connection[trio] FAILED [ 95%] tests/test_websockets.py::test_send_denial_response[asyncio] FAILED [ 95%] tests/test_websockets.py::test_send_denial_response[trio] FAILED [ 95%] tests/test_websockets.py::test_send_response_multi[asyncio] FAILED [ 95%] tests/test_websockets.py::test_send_response_multi[trio] FAILED [ 95%] tests/test_websockets.py::test_send_response_unsupported[asyncio] FAILED [ 95%] tests/test_websockets.py::test_send_response_unsupported[trio] FAILED [ 96%] tests/test_websockets.py::test_send_response_duplicate_start[asyncio] FAILED [ 96%] tests/test_websockets.py::test_send_response_duplicate_start[trio] FAILED [ 96%] tests/test_websockets.py::test_subprotocol[asyncio] FAILED [ 96%] tests/test_websockets.py::test_subprotocol[trio] FAILED [ 96%] tests/test_websockets.py::test_additional_headers[asyncio] FAILED [ 96%] tests/test_websockets.py::test_additional_headers[trio] FAILED [ 96%] tests/test_websockets.py::test_no_additional_headers[asyncio] FAILED [ 96%] tests/test_websockets.py::test_no_additional_headers[trio] FAILED [ 96%] tests/test_websockets.py::test_websocket_exception[asyncio] FAILED [ 97%] tests/test_websockets.py::test_websocket_exception[trio] FAILED [ 97%] tests/test_websockets.py::test_duplicate_close[asyncio] FAILED [ 97%] tests/test_websockets.py::test_duplicate_close[trio] FAILED [ 97%] tests/test_websockets.py::test_duplicate_disconnect[asyncio] FAILED [ 97%] tests/test_websockets.py::test_duplicate_disconnect[trio] FAILED [ 97%] tests/test_websockets.py::test_websocket_scope_interface PASSED [ 97%] tests/test_websockets.py::test_websocket_close_reason[asyncio] FAILED [ 97%] tests/test_websockets.py::test_websocket_close_reason[trio] FAILED [ 97%] tests/test_websockets.py::test_send_json_invalid_mode[asyncio] FAILED [ 98%] tests/test_websockets.py::test_send_json_invalid_mode[trio] FAILED [ 98%] tests/test_websockets.py::test_receive_json_invalid_mode[asyncio] FAILED [ 98%] tests/test_websockets.py::test_receive_json_invalid_mode[trio] FAILED [ 98%] tests/test_websockets.py::test_receive_text_before_accept[asyncio] FAILED [ 98%] tests/test_websockets.py::test_receive_text_before_accept[trio] FAILED [ 98%] tests/test_websockets.py::test_receive_bytes_before_accept[asyncio] FAILED [ 98%] tests/test_websockets.py::test_receive_bytes_before_accept[trio] FAILED [ 98%] tests/test_websockets.py::test_receive_json_before_accept[asyncio] FAILED [ 98%] tests/test_websockets.py::test_receive_json_before_accept[trio] FAILED [ 99%] tests/test_websockets.py::test_send_before_accept[asyncio] FAILED [ 99%] tests/test_websockets.py::test_send_before_accept[trio] FAILED [ 99%] tests/test_websockets.py::test_send_wrong_message_type[asyncio] FAILED [ 99%] tests/test_websockets.py::test_send_wrong_message_type[trio] FAILED [ 99%] tests/test_websockets.py::test_receive_before_accept[asyncio] FAILED [ 99%] tests/test_websockets.py::test_receive_before_accept[trio] FAILED [ 99%] tests/test_websockets.py::test_receive_wrong_message_type[asyncio] FAILED [ 99%] tests/test_websockets.py::test_receive_wrong_message_type[trio] FAILED [100%] ==================================== ERRORS ==================================== __________________ ERROR at setup of test_func_route[asyncio] __________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) @pytest.fixture def client(test_client_factory: TestClientFactory) -> Generator[TestClient, None, None]: > with test_client_factory(app) as client: tests/test_applications.py:141: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError ___________________ ERROR at setup of test_func_route[trio] ____________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) @pytest.fixture def client(test_client_factory: TestClientFactory) -> Generator[TestClient, None, None]: > with test_client_factory(app) as client: tests/test_applications.py:141: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError _________________ ERROR at setup of test_async_route[asyncio] __________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) @pytest.fixture def client(test_client_factory: TestClientFactory) -> Generator[TestClient, None, None]: > with test_client_factory(app) as client: tests/test_applications.py:141: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError ___________________ ERROR at setup of test_async_route[trio] ___________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) @pytest.fixture def client(test_client_factory: TestClientFactory) -> Generator[TestClient, None, None]: > with test_client_factory(app) as client: tests/test_applications.py:141: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError _________________ ERROR at setup of test_class_route[asyncio] __________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) @pytest.fixture def client(test_client_factory: TestClientFactory) -> Generator[TestClient, None, None]: > with test_client_factory(app) as client: tests/test_applications.py:141: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError ___________________ ERROR at setup of test_class_route[trio] ___________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) @pytest.fixture def client(test_client_factory: TestClientFactory) -> Generator[TestClient, None, None]: > with test_client_factory(app) as client: tests/test_applications.py:141: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError ________________ ERROR at setup of test_mounted_route[asyncio] _________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) @pytest.fixture def client(test_client_factory: TestClientFactory) -> Generator[TestClient, None, None]: > with test_client_factory(app) as client: tests/test_applications.py:141: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError __________________ ERROR at setup of test_mounted_route[trio] __________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) @pytest.fixture def client(test_client_factory: TestClientFactory) -> Generator[TestClient, None, None]: > with test_client_factory(app) as client: tests/test_applications.py:141: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError __________ ERROR at setup of test_mounted_route_path_params[asyncio] ___________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) @pytest.fixture def client(test_client_factory: TestClientFactory) -> Generator[TestClient, None, None]: > with test_client_factory(app) as client: tests/test_applications.py:141: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError ____________ ERROR at setup of test_mounted_route_path_params[trio] ____________ test_client_factory = functools.partial(, backend='trio', backend_options={}) @pytest.fixture def client(test_client_factory: TestClientFactory) -> Generator[TestClient, None, None]: > with test_client_factory(app) as client: tests/test_applications.py:141: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError _______________ ERROR at setup of test_websocket_route[asyncio] ________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) @pytest.fixture def client(test_client_factory: TestClientFactory) -> Generator[TestClient, None, None]: > with test_client_factory(app) as client: tests/test_applications.py:141: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError _________________ ERROR at setup of test_websocket_route[trio] _________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) @pytest.fixture def client(test_client_factory: TestClientFactory) -> Generator[TestClient, None, None]: > with test_client_factory(app) as client: tests/test_applications.py:141: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError _____________________ ERROR at setup of test_400[asyncio] ______________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) @pytest.fixture def client(test_client_factory: TestClientFactory) -> Generator[TestClient, None, None]: > with test_client_factory(app) as client: tests/test_applications.py:141: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError _______________________ ERROR at setup of test_400[trio] _______________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) @pytest.fixture def client(test_client_factory: TestClientFactory) -> Generator[TestClient, None, None]: > with test_client_factory(app) as client: tests/test_applications.py:141: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError _____________________ ERROR at setup of test_405[asyncio] ______________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) @pytest.fixture def client(test_client_factory: TestClientFactory) -> Generator[TestClient, None, None]: > with test_client_factory(app) as client: tests/test_applications.py:141: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError _______________________ ERROR at setup of test_405[trio] _______________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) @pytest.fixture def client(test_client_factory: TestClientFactory) -> Generator[TestClient, None, None]: > with test_client_factory(app) as client: tests/test_applications.py:141: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError _____ ERROR at setup of test_websocket_raise_websocket_exception[asyncio] ______ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) @pytest.fixture def client(test_client_factory: TestClientFactory) -> Generator[TestClient, None, None]: > with test_client_factory(app) as client: tests/test_applications.py:141: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError _______ ERROR at setup of test_websocket_raise_websocket_exception[trio] _______ test_client_factory = functools.partial(, backend='trio', backend_options={}) @pytest.fixture def client(test_client_factory: TestClientFactory) -> Generator[TestClient, None, None]: > with test_client_factory(app) as client: tests/test_applications.py:141: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError ________ ERROR at setup of test_websocket_raise_http_exception[asyncio] ________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) @pytest.fixture def client(test_client_factory: TestClientFactory) -> Generator[TestClient, None, None]: > with test_client_factory(app) as client: tests/test_applications.py:141: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError _________ ERROR at setup of test_websocket_raise_http_exception[trio] __________ test_client_factory = functools.partial(, backend='trio', backend_options={}) @pytest.fixture def client(test_client_factory: TestClientFactory) -> Generator[TestClient, None, None]: > with test_client_factory(app) as client: tests/test_applications.py:141: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError _______ ERROR at setup of test_websocket_raise_custom_exception[asyncio] _______ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) @pytest.fixture def client(test_client_factory: TestClientFactory) -> Generator[TestClient, None, None]: > with test_client_factory(app) as client: tests/test_applications.py:141: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError ________ ERROR at setup of test_websocket_raise_custom_exception[trio] _________ test_client_factory = functools.partial(, backend='trio', backend_options={}) @pytest.fixture def client(test_client_factory: TestClientFactory) -> Generator[TestClient, None, None]: > with test_client_factory(app) as client: tests/test_applications.py:141: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError _____________ ERROR at setup of test_http_endpoint_route[asyncio] ______________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) @pytest.fixture def client(test_client_factory: TestClientFactory) -> Iterator[TestClient]: > with test_client_factory(app) as client: tests/test_endpoints.py:27: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError _______________ ERROR at setup of test_http_endpoint_route[trio] _______________ test_client_factory = functools.partial(, backend='trio', backend_options={}) @pytest.fixture def client(test_client_factory: TestClientFactory) -> Iterator[TestClient]: > with test_client_factory(app) as client: tests/test_endpoints.py:27: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError _______ ERROR at setup of test_http_endpoint_route_path_params[asyncio] ________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) @pytest.fixture def client(test_client_factory: TestClientFactory) -> Iterator[TestClient]: > with test_client_factory(app) as client: tests/test_endpoints.py:27: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError _________ ERROR at setup of test_http_endpoint_route_path_params[trio] _________ test_client_factory = functools.partial(, backend='trio', backend_options={}) @pytest.fixture def client(test_client_factory: TestClientFactory) -> Iterator[TestClient]: > with test_client_factory(app) as client: tests/test_endpoints.py:27: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError __________ ERROR at setup of test_http_endpoint_route_method[asyncio] __________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) @pytest.fixture def client(test_client_factory: TestClientFactory) -> Iterator[TestClient]: > with test_client_factory(app) as client: tests/test_endpoints.py:27: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError ___________ ERROR at setup of test_http_endpoint_route_method[trio] ____________ test_client_factory = functools.partial(, backend='trio', backend_options={}) @pytest.fixture def client(test_client_factory: TestClientFactory) -> Iterator[TestClient]: > with test_client_factory(app) as client: tests/test_endpoints.py:27: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError ________________ ERROR at setup of test_not_acceptable[asyncio] ________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) @pytest.fixture def client(test_client_factory: TestClientFactory) -> Generator[TestClient, None, None]: > with test_client_factory(app) as client: tests/test_exceptions.py:78: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError _________________ ERROR at setup of test_not_acceptable[trio] __________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) @pytest.fixture def client(test_client_factory: TestClientFactory) -> Generator[TestClient, None, None]: > with test_client_factory(app) as client: tests/test_exceptions.py:78: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError __________________ ERROR at setup of test_no_content[asyncio] __________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) @pytest.fixture def client(test_client_factory: TestClientFactory) -> Generator[TestClient, None, None]: > with test_client_factory(app) as client: tests/test_exceptions.py:78: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError ___________________ ERROR at setup of test_no_content[trio] ____________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) @pytest.fixture def client(test_client_factory: TestClientFactory) -> Generator[TestClient, None, None]: > with test_client_factory(app) as client: tests/test_exceptions.py:78: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError _________________ ERROR at setup of test_not_modified[asyncio] _________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) @pytest.fixture def client(test_client_factory: TestClientFactory) -> Generator[TestClient, None, None]: > with test_client_factory(app) as client: tests/test_exceptions.py:78: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError __________________ ERROR at setup of test_not_modified[trio] ___________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) @pytest.fixture def client(test_client_factory: TestClientFactory) -> Generator[TestClient, None, None]: > with test_client_factory(app) as client: tests/test_exceptions.py:78: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError _________________ ERROR at setup of test_with_headers[asyncio] _________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) @pytest.fixture def client(test_client_factory: TestClientFactory) -> Generator[TestClient, None, None]: > with test_client_factory(app) as client: tests/test_exceptions.py:78: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError __________________ ERROR at setup of test_with_headers[trio] ___________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) @pytest.fixture def client(test_client_factory: TestClientFactory) -> Generator[TestClient, None, None]: > with test_client_factory(app) as client: tests/test_exceptions.py:78: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError ___________ ERROR at setup of test_websockets_should_raise[asyncio] ____________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) @pytest.fixture def client(test_client_factory: TestClientFactory) -> Generator[TestClient, None, None]: > with test_client_factory(app) as client: tests/test_exceptions.py:78: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError _____________ ERROR at setup of test_websockets_should_raise[trio] _____________ test_client_factory = functools.partial(, backend='trio', backend_options={}) @pytest.fixture def client(test_client_factory: TestClientFactory) -> Generator[TestClient, None, None]: > with test_client_factory(app) as client: tests/test_exceptions.py:78: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError __________ ERROR at setup of test_handled_exc_after_response[asyncio] __________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) @pytest.fixture def client(test_client_factory: TestClientFactory) -> Generator[TestClient, None, None]: > with test_client_factory(app) as client: tests/test_exceptions.py:78: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError ___________ ERROR at setup of test_handled_exc_after_response[trio] ____________ test_client_factory = functools.partial(, backend='trio', backend_options={}) @pytest.fixture def client(test_client_factory: TestClientFactory) -> Generator[TestClient, None, None]: > with test_client_factory(app) as client: tests/test_exceptions.py:78: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError _ ERROR at setup of test_request_in_app_and_handler_is_the_same_object[asyncio] _ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) @pytest.fixture def client(test_client_factory: TestClientFactory) -> Generator[TestClient, None, None]: > with test_client_factory(app) as client: tests/test_exceptions.py:78: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError __ ERROR at setup of test_request_in_app_and_handler_is_the_same_object[trio] __ test_client_factory = functools.partial(, backend='trio', backend_options={}) @pytest.fixture def client(test_client_factory: TestClientFactory) -> Generator[TestClient, None, None]: > with test_client_factory(app) as client: tests/test_exceptions.py:78: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError ____________________ ERROR at setup of test_router[asyncio] ____________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) @pytest.fixture def client( test_client_factory: TestClientFactory, ) -> typing.Generator[TestClient, None, None]: > with test_client_factory(app) as client: tests/test_routing.py:169: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError _____________________ ERROR at setup of test_router[trio] ______________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) @pytest.fixture def client( test_client_factory: TestClientFactory, ) -> typing.Generator[TestClient, None, None]: > with test_client_factory(app) as client: tests/test_routing.py:169: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError _______________ ERROR at setup of test_route_converters[asyncio] _______________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) @pytest.fixture def client( test_client_factory: TestClientFactory, ) -> typing.Generator[TestClient, None, None]: > with test_client_factory(app) as client: tests/test_routing.py:169: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError ________________ ERROR at setup of test_route_converters[trio] _________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) @pytest.fixture def client( test_client_factory: TestClientFactory, ) -> typing.Generator[TestClient, None, None]: > with test_client_factory(app) as client: tests/test_routing.py:169: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError _______________ ERROR at setup of test_router_add_route[asyncio] _______________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) @pytest.fixture def client( test_client_factory: TestClientFactory, ) -> typing.Generator[TestClient, None, None]: > with test_client_factory(app) as client: tests/test_routing.py:169: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError ________________ ERROR at setup of test_router_add_route[trio] _________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) @pytest.fixture def client( test_client_factory: TestClientFactory, ) -> typing.Generator[TestClient, None, None]: > with test_client_factory(app) as client: tests/test_routing.py:169: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError ____________ ERROR at setup of test_router_duplicate_path[asyncio] _____________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) @pytest.fixture def client( test_client_factory: TestClientFactory, ) -> typing.Generator[TestClient, None, None]: > with test_client_factory(app) as client: tests/test_routing.py:169: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError ______________ ERROR at setup of test_router_duplicate_path[trio] ______________ test_client_factory = functools.partial(, backend='trio', backend_options={}) @pytest.fixture def client( test_client_factory: TestClientFactory, ) -> typing.Generator[TestClient, None, None]: > with test_client_factory(app) as client: tests/test_routing.py:169: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError __________ ERROR at setup of test_router_add_websocket_route[asyncio] __________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) @pytest.fixture def client( test_client_factory: TestClientFactory, ) -> typing.Generator[TestClient, None, None]: > with test_client_factory(app) as client: tests/test_routing.py:169: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError ___________ ERROR at setup of test_router_add_websocket_route[trio] ____________ test_client_factory = functools.partial(, backend='trio', backend_options={}) @pytest.fixture def client( test_client_factory: TestClientFactory, ) -> typing.Generator[TestClient, None, None]: > with test_client_factory(app) as client: tests/test_routing.py:169: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError =================================== FAILURES =================================== _______________________ test_custom_middleware[asyncio] ________________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_custom_middleware(test_client_factory: TestClientFactory) -> None: client = test_client_factory(app) > response = client.get("/") tests/middleware/test_base.py:89: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:456: in get return super().get( /usr/lib/python3.13/site-packages/httpx/_client.py:1066: in get return self.request( starlette/testclient.py:428: in request return super().request( /usr/lib/python3.13/site-packages/httpx/_client.py:837: in request return self.send(request, auth=auth, follow_redirects=follow_redirects) /usr/lib/python3.13/site-packages/httpx/_client.py:926: in send response = self._send_handling_auth( /usr/lib/python3.13/site-packages/httpx/_client.py:954: in _send_handling_auth response = self._send_handling_redirects( /usr/lib/python3.13/site-packages/httpx/_client.py:991: in _send_handling_redirects response = self._send_single_request(request) /usr/lib/python3.13/site-packages/httpx/_client.py:1027: in _send_single_request response = transport.handle_request(request) starlette/testclient.py:337: in handle_request raise exc starlette/testclient.py:334: in handle_request portal.call(self.app, scope, receive, send) /usr/lib/python3.13/site-packages/anyio/from_thread.py:277: in call return cast(T_Retval, self.start_task_soon(func, *args).result()) /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval starlette/applications.py:112: in __call__ await self.middleware_stack(scope, receive, send) starlette/middleware/errors.py:187: in __call__ raise exc starlette/middleware/errors.py:165: in __call__ await self.app(scope, receive, _send) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = scope = {'app': , 'client': ('testclient', 50000), 'extensions': {'... b'*/*'), (b'accept-encoding', b'gzip, deflate'), (b'connection', b'keep-alive'), (b'user-agent', b'testclient')], ...} receive = .receive at 0x7f25d99b5120> send = ._send at 0x7f25d99156c0> async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: if scope["type"] != "http": await self.app(scope, receive, send) return request = _CachedRequest(scope, receive) wrapped_receive = request.wrapped_receive response_sent = anyio.Event() async def call_next(request: Request) -> Response: app_exc: Exception | None = None async def receive_or_disconnect() -> Message: if response_sent.is_set(): return {"type": "http.disconnect"} async with anyio.create_task_group() as task_group: async def wrap(func: typing.Callable[[], typing.Awaitable[T]]) -> T: result = await func() task_group.cancel_scope.cancel() return result task_group.start_soon(wrap, response_sent.wait) message = await wrap(wrapped_receive) if response_sent.is_set(): return {"type": "http.disconnect"} return message async def send_no_error(message: Message) -> None: try: await send_stream.send(message) except anyio.BrokenResourceError: # recv_stream has been closed, i.e. response_sent has been set. return async def coro() -> None: nonlocal app_exc with send_stream: try: await self.app(scope, receive_or_disconnect, send_no_error) except Exception as exc: app_exc = exc task_group.start_soon(coro) try: message = await recv_stream.receive() info = message.get("info", None) if message["type"] == "http.response.debug" and info is not None: message = await recv_stream.receive() except anyio.EndOfStream: if app_exc is not None: raise app_exc raise RuntimeError("No response returned.") assert message["type"] == "http.response.start" async def body_stream() -> typing.AsyncGenerator[bytes, None]: async for message in recv_stream: assert message["type"] == "http.response.body" body = message.get("body", b"") if body: yield body if not message.get("more_body", False): break if app_exc is not None: raise app_exc response = _StreamingResponse(status_code=message["status"], content=body_stream(), info=info) response.raw_headers = message["headers"] return response > send_stream, recv_stream = anyio.create_memory_object_stream[Message]() E TypeError: 'function' object is not subscriptable starlette/middleware/base.py:175: TypeError _________________________ test_custom_middleware[trio] _________________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_custom_middleware(test_client_factory: TestClientFactory) -> None: client = test_client_factory(app) > response = client.get("/") tests/middleware/test_base.py:89: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:456: in get return super().get( /usr/lib/python3.13/site-packages/httpx/_client.py:1066: in get return self.request( starlette/testclient.py:428: in request return super().request( /usr/lib/python3.13/site-packages/httpx/_client.py:837: in request return self.send(request, auth=auth, follow_redirects=follow_redirects) /usr/lib/python3.13/site-packages/httpx/_client.py:926: in send response = self._send_handling_auth( /usr/lib/python3.13/site-packages/httpx/_client.py:954: in _send_handling_auth response = self._send_handling_redirects( /usr/lib/python3.13/site-packages/httpx/_client.py:991: in _send_handling_redirects response = self._send_single_request(request) /usr/lib/python3.13/site-packages/httpx/_client.py:1027: in _send_single_request response = transport.handle_request(request) starlette/testclient.py:337: in handle_request raise exc starlette/testclient.py:334: in handle_request portal.call(self.app, scope, receive, send) /usr/lib/python3.13/site-packages/anyio/from_thread.py:277: in call return cast(T_Retval, self.start_task_soon(func, *args).result()) /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval starlette/applications.py:112: in __call__ await self.middleware_stack(scope, receive, send) starlette/middleware/errors.py:187: in __call__ raise exc starlette/middleware/errors.py:165: in __call__ await self.app(scope, receive, _send) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = scope = {'app': , 'client': ('testclient', 50000), 'extensions': {'... b'*/*'), (b'accept-encoding', b'gzip, deflate'), (b'connection', b'keep-alive'), (b'user-agent', b'testclient')], ...} receive = .receive at 0x7f25d9917b00> send = ._send at 0x7f25d98c96c0> async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: if scope["type"] != "http": await self.app(scope, receive, send) return request = _CachedRequest(scope, receive) wrapped_receive = request.wrapped_receive response_sent = anyio.Event() async def call_next(request: Request) -> Response: app_exc: Exception | None = None async def receive_or_disconnect() -> Message: if response_sent.is_set(): return {"type": "http.disconnect"} async with anyio.create_task_group() as task_group: async def wrap(func: typing.Callable[[], typing.Awaitable[T]]) -> T: result = await func() task_group.cancel_scope.cancel() return result task_group.start_soon(wrap, response_sent.wait) message = await wrap(wrapped_receive) if response_sent.is_set(): return {"type": "http.disconnect"} return message async def send_no_error(message: Message) -> None: try: await send_stream.send(message) except anyio.BrokenResourceError: # recv_stream has been closed, i.e. response_sent has been set. return async def coro() -> None: nonlocal app_exc with send_stream: try: await self.app(scope, receive_or_disconnect, send_no_error) except Exception as exc: app_exc = exc task_group.start_soon(coro) try: message = await recv_stream.receive() info = message.get("info", None) if message["type"] == "http.response.debug" and info is not None: message = await recv_stream.receive() except anyio.EndOfStream: if app_exc is not None: raise app_exc raise RuntimeError("No response returned.") assert message["type"] == "http.response.start" async def body_stream() -> typing.AsyncGenerator[bytes, None]: async for message in recv_stream: assert message["type"] == "http.response.body" body = message.get("body", b"") if body: yield body if not message.get("more_body", False): break if app_exc is not None: raise app_exc response = _StreamingResponse(status_code=message["status"], content=body_stream(), info=info) response.raw_headers = message["headers"] return response > send_stream, recv_stream = anyio.create_memory_object_stream[Message]() E TypeError: 'function' object is not subscriptable starlette/middleware/base.py:175: TypeError _____________ test_state_data_across_multiple_middlewares[asyncio] _____________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_state_data_across_multiple_middlewares( test_client_factory: TestClientFactory, ) -> None: expected_value1 = "foo" expected_value2 = "bar" class aMiddleware(BaseHTTPMiddleware): async def dispatch( self, request: Request, call_next: RequestResponseEndpoint, ) -> Response: request.state.foo = expected_value1 response = await call_next(request) return response class bMiddleware(BaseHTTPMiddleware): async def dispatch( self, request: Request, call_next: RequestResponseEndpoint, ) -> Response: request.state.bar = expected_value2 response = await call_next(request) response.headers["X-State-Foo"] = request.state.foo return response class cMiddleware(BaseHTTPMiddleware): async def dispatch( self, request: Request, call_next: RequestResponseEndpoint, ) -> Response: response = await call_next(request) response.headers["X-State-Bar"] = request.state.bar return response def homepage(request: Request) -> PlainTextResponse: return PlainTextResponse("OK") app = Starlette( routes=[Route("/", homepage)], middleware=[ Middleware(aMiddleware), Middleware(bMiddleware), Middleware(cMiddleware), ], ) client = test_client_factory(app) > response = client.get("/") tests/middleware/test_base.py:158: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:456: in get return super().get( /usr/lib/python3.13/site-packages/httpx/_client.py:1066: in get return self.request( starlette/testclient.py:428: in request return super().request( /usr/lib/python3.13/site-packages/httpx/_client.py:837: in request return self.send(request, auth=auth, follow_redirects=follow_redirects) /usr/lib/python3.13/site-packages/httpx/_client.py:926: in send response = self._send_handling_auth( /usr/lib/python3.13/site-packages/httpx/_client.py:954: in _send_handling_auth response = self._send_handling_redirects( /usr/lib/python3.13/site-packages/httpx/_client.py:991: in _send_handling_redirects response = self._send_single_request(request) /usr/lib/python3.13/site-packages/httpx/_client.py:1027: in _send_single_request response = transport.handle_request(request) starlette/testclient.py:337: in handle_request raise exc starlette/testclient.py:334: in handle_request portal.call(self.app, scope, receive, send) /usr/lib/python3.13/site-packages/anyio/from_thread.py:277: in call return cast(T_Retval, self.start_task_soon(func, *args).result()) /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval starlette/applications.py:112: in __call__ await self.middleware_stack(scope, receive, send) starlette/middleware/errors.py:187: in __call__ raise exc starlette/middleware/errors.py:165: in __call__ await self.app(scope, receive, _send) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = .aMiddleware object at 0x7f25d9854050> scope = {'app': , 'client': ('testclient', 50000), 'extensions': {'... b'*/*'), (b'accept-encoding', b'gzip, deflate'), (b'connection', b'keep-alive'), (b'user-agent', b'testclient')], ...} receive = .receive at 0x7f25d98c94e0> send = ._send at 0x7f25d98ca520> async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: if scope["type"] != "http": await self.app(scope, receive, send) return request = _CachedRequest(scope, receive) wrapped_receive = request.wrapped_receive response_sent = anyio.Event() async def call_next(request: Request) -> Response: app_exc: Exception | None = None async def receive_or_disconnect() -> Message: if response_sent.is_set(): return {"type": "http.disconnect"} async with anyio.create_task_group() as task_group: async def wrap(func: typing.Callable[[], typing.Awaitable[T]]) -> T: result = await func() task_group.cancel_scope.cancel() return result task_group.start_soon(wrap, response_sent.wait) message = await wrap(wrapped_receive) if response_sent.is_set(): return {"type": "http.disconnect"} return message async def send_no_error(message: Message) -> None: try: await send_stream.send(message) except anyio.BrokenResourceError: # recv_stream has been closed, i.e. response_sent has been set. return async def coro() -> None: nonlocal app_exc with send_stream: try: await self.app(scope, receive_or_disconnect, send_no_error) except Exception as exc: app_exc = exc task_group.start_soon(coro) try: message = await recv_stream.receive() info = message.get("info", None) if message["type"] == "http.response.debug" and info is not None: message = await recv_stream.receive() except anyio.EndOfStream: if app_exc is not None: raise app_exc raise RuntimeError("No response returned.") assert message["type"] == "http.response.start" async def body_stream() -> typing.AsyncGenerator[bytes, None]: async for message in recv_stream: assert message["type"] == "http.response.body" body = message.get("body", b"") if body: yield body if not message.get("more_body", False): break if app_exc is not None: raise app_exc response = _StreamingResponse(status_code=message["status"], content=body_stream(), info=info) response.raw_headers = message["headers"] return response > send_stream, recv_stream = anyio.create_memory_object_stream[Message]() E TypeError: 'function' object is not subscriptable starlette/middleware/base.py:175: TypeError ______________ test_state_data_across_multiple_middlewares[trio] _______________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_state_data_across_multiple_middlewares( test_client_factory: TestClientFactory, ) -> None: expected_value1 = "foo" expected_value2 = "bar" class aMiddleware(BaseHTTPMiddleware): async def dispatch( self, request: Request, call_next: RequestResponseEndpoint, ) -> Response: request.state.foo = expected_value1 response = await call_next(request) return response class bMiddleware(BaseHTTPMiddleware): async def dispatch( self, request: Request, call_next: RequestResponseEndpoint, ) -> Response: request.state.bar = expected_value2 response = await call_next(request) response.headers["X-State-Foo"] = request.state.foo return response class cMiddleware(BaseHTTPMiddleware): async def dispatch( self, request: Request, call_next: RequestResponseEndpoint, ) -> Response: response = await call_next(request) response.headers["X-State-Bar"] = request.state.bar return response def homepage(request: Request) -> PlainTextResponse: return PlainTextResponse("OK") app = Starlette( routes=[Route("/", homepage)], middleware=[ Middleware(aMiddleware), Middleware(bMiddleware), Middleware(cMiddleware), ], ) client = test_client_factory(app) > response = client.get("/") tests/middleware/test_base.py:158: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:456: in get return super().get( /usr/lib/python3.13/site-packages/httpx/_client.py:1066: in get return self.request( starlette/testclient.py:428: in request return super().request( /usr/lib/python3.13/site-packages/httpx/_client.py:837: in request return self.send(request, auth=auth, follow_redirects=follow_redirects) /usr/lib/python3.13/site-packages/httpx/_client.py:926: in send response = self._send_handling_auth( /usr/lib/python3.13/site-packages/httpx/_client.py:954: in _send_handling_auth response = self._send_handling_redirects( /usr/lib/python3.13/site-packages/httpx/_client.py:991: in _send_handling_redirects response = self._send_single_request(request) /usr/lib/python3.13/site-packages/httpx/_client.py:1027: in _send_single_request response = transport.handle_request(request) starlette/testclient.py:337: in handle_request raise exc starlette/testclient.py:334: in handle_request portal.call(self.app, scope, receive, send) /usr/lib/python3.13/site-packages/anyio/from_thread.py:277: in call return cast(T_Retval, self.start_task_soon(func, *args).result()) /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval starlette/applications.py:112: in __call__ await self.middleware_stack(scope, receive, send) starlette/middleware/errors.py:187: in __call__ raise exc starlette/middleware/errors.py:165: in __call__ await self.app(scope, receive, _send) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = .aMiddleware object at 0x7f25d9cd3cb0> scope = {'app': , 'client': ('testclient', 50000), 'extensions': {'... b'*/*'), (b'accept-encoding', b'gzip, deflate'), (b'connection', b'keep-alive'), (b'user-agent', b'testclient')], ...} receive = .receive at 0x7f25d98caca0> send = ._send at 0x7f25d98cad40> async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: if scope["type"] != "http": await self.app(scope, receive, send) return request = _CachedRequest(scope, receive) wrapped_receive = request.wrapped_receive response_sent = anyio.Event() async def call_next(request: Request) -> Response: app_exc: Exception | None = None async def receive_or_disconnect() -> Message: if response_sent.is_set(): return {"type": "http.disconnect"} async with anyio.create_task_group() as task_group: async def wrap(func: typing.Callable[[], typing.Awaitable[T]]) -> T: result = await func() task_group.cancel_scope.cancel() return result task_group.start_soon(wrap, response_sent.wait) message = await wrap(wrapped_receive) if response_sent.is_set(): return {"type": "http.disconnect"} return message async def send_no_error(message: Message) -> None: try: await send_stream.send(message) except anyio.BrokenResourceError: # recv_stream has been closed, i.e. response_sent has been set. return async def coro() -> None: nonlocal app_exc with send_stream: try: await self.app(scope, receive_or_disconnect, send_no_error) except Exception as exc: app_exc = exc task_group.start_soon(coro) try: message = await recv_stream.receive() info = message.get("info", None) if message["type"] == "http.response.debug" and info is not None: message = await recv_stream.receive() except anyio.EndOfStream: if app_exc is not None: raise app_exc raise RuntimeError("No response returned.") assert message["type"] == "http.response.start" async def body_stream() -> typing.AsyncGenerator[bytes, None]: async for message in recv_stream: assert message["type"] == "http.response.body" body = message.get("body", b"") if body: yield body if not message.get("more_body", False): break if app_exc is not None: raise app_exc response = _StreamingResponse(status_code=message["status"], content=body_stream(), info=info) response.raw_headers = message["headers"] return response > send_stream, recv_stream = anyio.create_memory_object_stream[Message]() E TypeError: 'function' object is not subscriptable starlette/middleware/base.py:175: TypeError ____________________ test_app_middleware_argument[asyncio] _____________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_app_middleware_argument(test_client_factory: TestClientFactory) -> None: def homepage(request: Request) -> PlainTextResponse: return PlainTextResponse("Homepage") app = Starlette(routes=[Route("/", homepage)], middleware=[Middleware(CustomMiddleware)]) client = test_client_factory(app) > response = client.get("/") tests/middleware/test_base.py:171: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:456: in get return super().get( /usr/lib/python3.13/site-packages/httpx/_client.py:1066: in get return self.request( starlette/testclient.py:428: in request return super().request( /usr/lib/python3.13/site-packages/httpx/_client.py:837: in request return self.send(request, auth=auth, follow_redirects=follow_redirects) /usr/lib/python3.13/site-packages/httpx/_client.py:926: in send response = self._send_handling_auth( /usr/lib/python3.13/site-packages/httpx/_client.py:954: in _send_handling_auth response = self._send_handling_redirects( /usr/lib/python3.13/site-packages/httpx/_client.py:991: in _send_handling_redirects response = self._send_single_request(request) /usr/lib/python3.13/site-packages/httpx/_client.py:1027: in _send_single_request response = transport.handle_request(request) starlette/testclient.py:337: in handle_request raise exc starlette/testclient.py:334: in handle_request portal.call(self.app, scope, receive, send) /usr/lib/python3.13/site-packages/anyio/from_thread.py:277: in call return cast(T_Retval, self.start_task_soon(func, *args).result()) /usr/lib64/python3.13/concurrent/futures/_base.py:456: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval starlette/applications.py:112: in __call__ await self.middleware_stack(scope, receive, send) starlette/middleware/errors.py:187: in __call__ raise exc starlette/middleware/errors.py:165: in __call__ await self.app(scope, receive, _send) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = scope = {'app': , 'client': ('testclient', 50000), 'extensions': {'... b'*/*'), (b'accept-encoding', b'gzip, deflate'), (b'connection', b'keep-alive'), (b'user-agent', b'testclient')], ...} receive = .receive at 0x7f25d98cb2e0> send = ._send at 0x7f25d98cb920> async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: if scope["type"] != "http": await self.app(scope, receive, send) return request = _CachedRequest(scope, receive) wrapped_receive = request.wrapped_receive response_sent = anyio.Event() async def call_next(request: Request) -> Response: app_exc: Exception | None = None async def receive_or_disconnect() -> Message: if response_sent.is_set(): return {"type": "http.disconnect"} async with anyio.create_task_group() as task_group: async def wrap(func: typing.Callable[[], typing.Awaitable[T]]) -> T: result = await func() task_group.cancel_scope.cancel() return result task_group.start_soon(wrap, response_sent.wait) message = await wrap(wrapped_receive) if response_sent.is_set(): return {"type": "http.disconnect"} return message async def send_no_error(message: Message) -> None: try: await send_stream.send(message) except anyio.BrokenResourceError: # recv_stream has been closed, i.e. response_sent has been set. return async def coro() -> None: nonlocal app_exc with send_stream: try: await self.app(scope, receive_or_disconnect, send_no_error) except Exception as exc: app_exc = exc task_group.start_soon(coro) try: message = await recv_stream.receive() info = message.get("info", None) if message["type"] == "http.response.debug" and info is not None: message = await recv_stream.receive() except anyio.EndOfStream: if app_exc is not None: raise app_exc raise RuntimeError("No response returned.") assert message["type"] == "http.response.start" async def body_stream() -> typing.AsyncGenerator[bytes, None]: async for message in recv_stream: assert message["type"] == "http.response.body" body = message.get("body", b"") if body: yield body if not message.get("more_body", False): break if app_exc is not None: raise app_exc response = _StreamingResponse(status_code=message["status"], content=body_stream(), info=info) response.raw_headers = message["headers"] return response > send_stream, recv_stream = anyio.create_memory_object_stream[Message]() E TypeError: 'function' object is not subscriptable starlette/middleware/base.py:175: TypeError ______________________ test_app_middleware_argument[trio] ______________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_app_middleware_argument(test_client_factory: TestClientFactory) -> None: def homepage(request: Request) -> PlainTextResponse: return PlainTextResponse("Homepage") app = Starlette(routes=[Route("/", homepage)], middleware=[Middleware(CustomMiddleware)]) client = test_client_factory(app) > response = client.get("/") tests/middleware/test_base.py:171: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:456: in get return super().get( /usr/lib/python3.13/site-packages/httpx/_client.py:1066: in get return self.request( starlette/testclient.py:428: in request return super().request( /usr/lib/python3.13/site-packages/httpx/_client.py:837: in request return self.send(request, auth=auth, follow_redirects=follow_redirects) /usr/lib/python3.13/site-packages/httpx/_client.py:926: in send response = self._send_handling_auth( /usr/lib/python3.13/site-packages/httpx/_client.py:954: in _send_handling_auth response = self._send_handling_redirects( /usr/lib/python3.13/site-packages/httpx/_client.py:991: in _send_handling_redirects response = self._send_single_request(request) /usr/lib/python3.13/site-packages/httpx/_client.py:1027: in _send_single_request response = transport.handle_request(request) starlette/testclient.py:337: in handle_request raise exc starlette/testclient.py:334: in handle_request portal.call(self.app, scope, receive, send) /usr/lib/python3.13/site-packages/anyio/from_thread.py:277: in call return cast(T_Retval, self.start_task_soon(func, *args).result()) /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval starlette/applications.py:112: in __call__ await self.middleware_stack(scope, receive, send) starlette/middleware/errors.py:187: in __call__ raise exc starlette/middleware/errors.py:165: in __call__ await self.app(scope, receive, _send) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = scope = {'app': , 'client': ('testclient', 50000), 'extensions': {'... b'*/*'), (b'accept-encoding', b'gzip, deflate'), (b'connection', b'keep-alive'), (b'user-agent', b'testclient')], ...} receive = .receive at 0x7f25d98cbba0> send = ._send at 0x7f25d9c6c040> async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: if scope["type"] != "http": await self.app(scope, receive, send) return request = _CachedRequest(scope, receive) wrapped_receive = request.wrapped_receive response_sent = anyio.Event() async def call_next(request: Request) -> Response: app_exc: Exception | None = None async def receive_or_disconnect() -> Message: if response_sent.is_set(): return {"type": "http.disconnect"} async with anyio.create_task_group() as task_group: async def wrap(func: typing.Callable[[], typing.Awaitable[T]]) -> T: result = await func() task_group.cancel_scope.cancel() return result task_group.start_soon(wrap, response_sent.wait) message = await wrap(wrapped_receive) if response_sent.is_set(): return {"type": "http.disconnect"} return message async def send_no_error(message: Message) -> None: try: await send_stream.send(message) except anyio.BrokenResourceError: # recv_stream has been closed, i.e. response_sent has been set. return async def coro() -> None: nonlocal app_exc with send_stream: try: await self.app(scope, receive_or_disconnect, send_no_error) except Exception as exc: app_exc = exc task_group.start_soon(coro) try: message = await recv_stream.receive() info = message.get("info", None) if message["type"] == "http.response.debug" and info is not None: message = await recv_stream.receive() except anyio.EndOfStream: if app_exc is not None: raise app_exc raise RuntimeError("No response returned.") assert message["type"] == "http.response.start" async def body_stream() -> typing.AsyncGenerator[bytes, None]: async for message in recv_stream: assert message["type"] == "http.response.body" body = message.get("body", b"") if body: yield body if not message.get("more_body", False): break if app_exc is not None: raise app_exc response = _StreamingResponse(status_code=message["status"], content=body_stream(), info=info) response.raw_headers = message["headers"] return response > send_stream, recv_stream = anyio.create_memory_object_stream[Message]() E TypeError: 'function' object is not subscriptable starlette/middleware/base.py:175: TypeError ____________________ test_fully_evaluated_response[asyncio] ____________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_fully_evaluated_response(test_client_factory: TestClientFactory) -> None: # Test for https://github.com/encode/starlette/issues/1022 class CustomMiddleware(BaseHTTPMiddleware): async def dispatch( self, request: Request, call_next: RequestResponseEndpoint, ) -> PlainTextResponse: await call_next(request) return PlainTextResponse("Custom") app = Starlette(middleware=[Middleware(CustomMiddleware)]) client = test_client_factory(app) > response = client.get("/does_not_exist") tests/middleware/test_base.py:189: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:456: in get return super().get( /usr/lib/python3.13/site-packages/httpx/_client.py:1066: in get return self.request( starlette/testclient.py:428: in request return super().request( /usr/lib/python3.13/site-packages/httpx/_client.py:837: in request return self.send(request, auth=auth, follow_redirects=follow_redirects) /usr/lib/python3.13/site-packages/httpx/_client.py:926: in send response = self._send_handling_auth( /usr/lib/python3.13/site-packages/httpx/_client.py:954: in _send_handling_auth response = self._send_handling_redirects( /usr/lib/python3.13/site-packages/httpx/_client.py:991: in _send_handling_redirects response = self._send_single_request(request) /usr/lib/python3.13/site-packages/httpx/_client.py:1027: in _send_single_request response = transport.handle_request(request) starlette/testclient.py:337: in handle_request raise exc starlette/testclient.py:334: in handle_request portal.call(self.app, scope, receive, send) /usr/lib/python3.13/site-packages/anyio/from_thread.py:277: in call return cast(T_Retval, self.start_task_soon(func, *args).result()) /usr/lib64/python3.13/concurrent/futures/_base.py:456: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval starlette/applications.py:112: in __call__ await self.middleware_stack(scope, receive, send) starlette/middleware/errors.py:187: in __call__ raise exc starlette/middleware/errors.py:165: in __call__ await self.app(scope, receive, _send) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = .CustomMiddleware object at 0x7f25d9cd2660> scope = {'app': , 'client': ('testclient', 50000), 'extensions': {'... b'*/*'), (b'accept-encoding', b'gzip, deflate'), (b'connection', b'keep-alive'), (b'user-agent', b'testclient')], ...} receive = .receive at 0x7f25d98caf20> send = ._send at 0x7f25d9c6c680> async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: if scope["type"] != "http": await self.app(scope, receive, send) return request = _CachedRequest(scope, receive) wrapped_receive = request.wrapped_receive response_sent = anyio.Event() async def call_next(request: Request) -> Response: app_exc: Exception | None = None async def receive_or_disconnect() -> Message: if response_sent.is_set(): return {"type": "http.disconnect"} async with anyio.create_task_group() as task_group: async def wrap(func: typing.Callable[[], typing.Awaitable[T]]) -> T: result = await func() task_group.cancel_scope.cancel() return result task_group.start_soon(wrap, response_sent.wait) message = await wrap(wrapped_receive) if response_sent.is_set(): return {"type": "http.disconnect"} return message async def send_no_error(message: Message) -> None: try: await send_stream.send(message) except anyio.BrokenResourceError: # recv_stream has been closed, i.e. response_sent has been set. return async def coro() -> None: nonlocal app_exc with send_stream: try: await self.app(scope, receive_or_disconnect, send_no_error) except Exception as exc: app_exc = exc task_group.start_soon(coro) try: message = await recv_stream.receive() info = message.get("info", None) if message["type"] == "http.response.debug" and info is not None: message = await recv_stream.receive() except anyio.EndOfStream: if app_exc is not None: raise app_exc raise RuntimeError("No response returned.") assert message["type"] == "http.response.start" async def body_stream() -> typing.AsyncGenerator[bytes, None]: async for message in recv_stream: assert message["type"] == "http.response.body" body = message.get("body", b"") if body: yield body if not message.get("more_body", False): break if app_exc is not None: raise app_exc response = _StreamingResponse(status_code=message["status"], content=body_stream(), info=info) response.raw_headers = message["headers"] return response > send_stream, recv_stream = anyio.create_memory_object_stream[Message]() E TypeError: 'function' object is not subscriptable starlette/middleware/base.py:175: TypeError _____________________ test_fully_evaluated_response[trio] ______________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_fully_evaluated_response(test_client_factory: TestClientFactory) -> None: # Test for https://github.com/encode/starlette/issues/1022 class CustomMiddleware(BaseHTTPMiddleware): async def dispatch( self, request: Request, call_next: RequestResponseEndpoint, ) -> PlainTextResponse: await call_next(request) return PlainTextResponse("Custom") app = Starlette(middleware=[Middleware(CustomMiddleware)]) client = test_client_factory(app) > response = client.get("/does_not_exist") tests/middleware/test_base.py:189: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:456: in get return super().get( /usr/lib/python3.13/site-packages/httpx/_client.py:1066: in get return self.request( starlette/testclient.py:428: in request return super().request( /usr/lib/python3.13/site-packages/httpx/_client.py:837: in request return self.send(request, auth=auth, follow_redirects=follow_redirects) /usr/lib/python3.13/site-packages/httpx/_client.py:926: in send response = self._send_handling_auth( /usr/lib/python3.13/site-packages/httpx/_client.py:954: in _send_handling_auth response = self._send_handling_redirects( /usr/lib/python3.13/site-packages/httpx/_client.py:991: in _send_handling_redirects response = self._send_single_request(request) /usr/lib/python3.13/site-packages/httpx/_client.py:1027: in _send_single_request response = transport.handle_request(request) starlette/testclient.py:337: in handle_request raise exc starlette/testclient.py:334: in handle_request portal.call(self.app, scope, receive, send) /usr/lib/python3.13/site-packages/anyio/from_thread.py:277: in call return cast(T_Retval, self.start_task_soon(func, *args).result()) /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval starlette/applications.py:112: in __call__ await self.middleware_stack(scope, receive, send) starlette/middleware/errors.py:187: in __call__ raise exc starlette/middleware/errors.py:165: in __call__ await self.app(scope, receive, _send) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = .CustomMiddleware object at 0x7f25d9cd3cb0> scope = {'app': , 'client': ('testclient', 50000), 'extensions': {'... b'*/*'), (b'accept-encoding', b'gzip, deflate'), (b'connection', b'keep-alive'), (b'user-agent', b'testclient')], ...} receive = .receive at 0x7f25d9c6cfe0> send = ._send at 0x7f25d9c6d620> async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: if scope["type"] != "http": await self.app(scope, receive, send) return request = _CachedRequest(scope, receive) wrapped_receive = request.wrapped_receive response_sent = anyio.Event() async def call_next(request: Request) -> Response: app_exc: Exception | None = None async def receive_or_disconnect() -> Message: if response_sent.is_set(): return {"type": "http.disconnect"} async with anyio.create_task_group() as task_group: async def wrap(func: typing.Callable[[], typing.Awaitable[T]]) -> T: result = await func() task_group.cancel_scope.cancel() return result task_group.start_soon(wrap, response_sent.wait) message = await wrap(wrapped_receive) if response_sent.is_set(): return {"type": "http.disconnect"} return message async def send_no_error(message: Message) -> None: try: await send_stream.send(message) except anyio.BrokenResourceError: # recv_stream has been closed, i.e. response_sent has been set. return async def coro() -> None: nonlocal app_exc with send_stream: try: await self.app(scope, receive_or_disconnect, send_no_error) except Exception as exc: app_exc = exc task_group.start_soon(coro) try: message = await recv_stream.receive() info = message.get("info", None) if message["type"] == "http.response.debug" and info is not None: message = await recv_stream.receive() except anyio.EndOfStream: if app_exc is not None: raise app_exc raise RuntimeError("No response returned.") assert message["type"] == "http.response.start" async def body_stream() -> typing.AsyncGenerator[bytes, None]: async for message in recv_stream: assert message["type"] == "http.response.body" body = message.get("body", b"") if body: yield body if not message.get("more_body", False): break if app_exc is not None: raise app_exc response = _StreamingResponse(status_code=message["status"], content=body_stream(), info=info) response.raw_headers = message["headers"] return response > send_stream, recv_stream = anyio.create_memory_object_stream[Message]() E TypeError: 'function' object is not subscriptable starlette/middleware/base.py:175: TypeError ______ test_contextvars[asyncio-CustomMiddlewareUsingBaseHTTPMiddleware] _______ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) middleware_cls = @pytest.mark.parametrize( "middleware_cls", [ CustomMiddlewareWithoutBaseHTTPMiddleware, pytest.param( CustomMiddlewareUsingBaseHTTPMiddleware, marks=pytest.mark.xfail( reason=( "BaseHTTPMiddleware creates a TaskGroup which copies the context" "and erases any changes to it made within the TaskGroup" ), raises=AssertionError, ), ), ], ) def test_contextvars( test_client_factory: TestClientFactory, middleware_cls: _MiddlewareFactory[Any], ) -> None: # this has to be an async endpoint because Starlette calls run_in_threadpool # on sync endpoints which has it's own set of peculiarities w.r.t propagating # contextvars (it propagates them forwards but not backwards) async def homepage(request: Request) -> PlainTextResponse: assert ctxvar.get() == "set by middleware" ctxvar.set("set by endpoint") return PlainTextResponse("Homepage") app = Starlette(middleware=[Middleware(middleware_cls)], routes=[Route("/", homepage)]) client = test_client_factory(app) > response = client.get("/") tests/middleware/test_base.py:249: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:456: in get return super().get( /usr/lib/python3.13/site-packages/httpx/_client.py:1066: in get return self.request( starlette/testclient.py:428: in request return super().request( /usr/lib/python3.13/site-packages/httpx/_client.py:837: in request return self.send(request, auth=auth, follow_redirects=follow_redirects) /usr/lib/python3.13/site-packages/httpx/_client.py:926: in send response = self._send_handling_auth( /usr/lib/python3.13/site-packages/httpx/_client.py:954: in _send_handling_auth response = self._send_handling_redirects( /usr/lib/python3.13/site-packages/httpx/_client.py:991: in _send_handling_redirects response = self._send_single_request(request) /usr/lib/python3.13/site-packages/httpx/_client.py:1027: in _send_single_request response = transport.handle_request(request) starlette/testclient.py:337: in handle_request raise exc starlette/testclient.py:334: in handle_request portal.call(self.app, scope, receive, send) /usr/lib/python3.13/site-packages/anyio/from_thread.py:277: in call return cast(T_Retval, self.start_task_soon(func, *args).result()) /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval starlette/applications.py:112: in __call__ await self.middleware_stack(scope, receive, send) starlette/middleware/errors.py:187: in __call__ raise exc starlette/middleware/errors.py:165: in __call__ await self.app(scope, receive, _send) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = scope = {'app': , 'client': ('testclient', 50000), 'extensions': {'... b'*/*'), (b'accept-encoding', b'gzip, deflate'), (b'connection', b'keep-alive'), (b'user-agent', b'testclient')], ...} receive = .receive at 0x7f25d9c6d940> send = ._send at 0x7f25d9c6da80> async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: if scope["type"] != "http": await self.app(scope, receive, send) return request = _CachedRequest(scope, receive) wrapped_receive = request.wrapped_receive response_sent = anyio.Event() async def call_next(request: Request) -> Response: app_exc: Exception | None = None async def receive_or_disconnect() -> Message: if response_sent.is_set(): return {"type": "http.disconnect"} async with anyio.create_task_group() as task_group: async def wrap(func: typing.Callable[[], typing.Awaitable[T]]) -> T: result = await func() task_group.cancel_scope.cancel() return result task_group.start_soon(wrap, response_sent.wait) message = await wrap(wrapped_receive) if response_sent.is_set(): return {"type": "http.disconnect"} return message async def send_no_error(message: Message) -> None: try: await send_stream.send(message) except anyio.BrokenResourceError: # recv_stream has been closed, i.e. response_sent has been set. return async def coro() -> None: nonlocal app_exc with send_stream: try: await self.app(scope, receive_or_disconnect, send_no_error) except Exception as exc: app_exc = exc task_group.start_soon(coro) try: message = await recv_stream.receive() info = message.get("info", None) if message["type"] == "http.response.debug" and info is not None: message = await recv_stream.receive() except anyio.EndOfStream: if app_exc is not None: raise app_exc raise RuntimeError("No response returned.") assert message["type"] == "http.response.start" async def body_stream() -> typing.AsyncGenerator[bytes, None]: async for message in recv_stream: assert message["type"] == "http.response.body" body = message.get("body", b"") if body: yield body if not message.get("more_body", False): break if app_exc is not None: raise app_exc response = _StreamingResponse(status_code=message["status"], content=body_stream(), info=info) response.raw_headers = message["headers"] return response > send_stream, recv_stream = anyio.create_memory_object_stream[Message]() E TypeError: 'function' object is not subscriptable starlette/middleware/base.py:175: TypeError ________ test_contextvars[trio-CustomMiddlewareUsingBaseHTTPMiddleware] ________ test_client_factory = functools.partial(, backend='trio', backend_options={}) middleware_cls = @pytest.mark.parametrize( "middleware_cls", [ CustomMiddlewareWithoutBaseHTTPMiddleware, pytest.param( CustomMiddlewareUsingBaseHTTPMiddleware, marks=pytest.mark.xfail( reason=( "BaseHTTPMiddleware creates a TaskGroup which copies the context" "and erases any changes to it made within the TaskGroup" ), raises=AssertionError, ), ), ], ) def test_contextvars( test_client_factory: TestClientFactory, middleware_cls: _MiddlewareFactory[Any], ) -> None: # this has to be an async endpoint because Starlette calls run_in_threadpool # on sync endpoints which has it's own set of peculiarities w.r.t propagating # contextvars (it propagates them forwards but not backwards) async def homepage(request: Request) -> PlainTextResponse: assert ctxvar.get() == "set by middleware" ctxvar.set("set by endpoint") return PlainTextResponse("Homepage") app = Starlette(middleware=[Middleware(middleware_cls)], routes=[Route("/", homepage)]) client = test_client_factory(app) > response = client.get("/") tests/middleware/test_base.py:249: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:456: in get return super().get( /usr/lib/python3.13/site-packages/httpx/_client.py:1066: in get return self.request( starlette/testclient.py:428: in request return super().request( /usr/lib/python3.13/site-packages/httpx/_client.py:837: in request return self.send(request, auth=auth, follow_redirects=follow_redirects) /usr/lib/python3.13/site-packages/httpx/_client.py:926: in send response = self._send_handling_auth( /usr/lib/python3.13/site-packages/httpx/_client.py:954: in _send_handling_auth response = self._send_handling_redirects( /usr/lib/python3.13/site-packages/httpx/_client.py:991: in _send_handling_redirects response = self._send_single_request(request) /usr/lib/python3.13/site-packages/httpx/_client.py:1027: in _send_single_request response = transport.handle_request(request) starlette/testclient.py:337: in handle_request raise exc starlette/testclient.py:334: in handle_request portal.call(self.app, scope, receive, send) /usr/lib/python3.13/site-packages/anyio/from_thread.py:277: in call return cast(T_Retval, self.start_task_soon(func, *args).result()) /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval starlette/applications.py:112: in __call__ await self.middleware_stack(scope, receive, send) starlette/middleware/errors.py:187: in __call__ raise exc starlette/middleware/errors.py:165: in __call__ await self.app(scope, receive, _send) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = scope = {'app': , 'client': ('testclient', 50000), 'extensions': {'... b'*/*'), (b'accept-encoding', b'gzip, deflate'), (b'connection', b'keep-alive'), (b'user-agent', b'testclient')], ...} receive = .receive at 0x7f25d9c6dd00> send = ._send at 0x7f25d9c6ee80> async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: if scope["type"] != "http": await self.app(scope, receive, send) return request = _CachedRequest(scope, receive) wrapped_receive = request.wrapped_receive response_sent = anyio.Event() async def call_next(request: Request) -> Response: app_exc: Exception | None = None async def receive_or_disconnect() -> Message: if response_sent.is_set(): return {"type": "http.disconnect"} async with anyio.create_task_group() as task_group: async def wrap(func: typing.Callable[[], typing.Awaitable[T]]) -> T: result = await func() task_group.cancel_scope.cancel() return result task_group.start_soon(wrap, response_sent.wait) message = await wrap(wrapped_receive) if response_sent.is_set(): return {"type": "http.disconnect"} return message async def send_no_error(message: Message) -> None: try: await send_stream.send(message) except anyio.BrokenResourceError: # recv_stream has been closed, i.e. response_sent has been set. return async def coro() -> None: nonlocal app_exc with send_stream: try: await self.app(scope, receive_or_disconnect, send_no_error) except Exception as exc: app_exc = exc task_group.start_soon(coro) try: message = await recv_stream.receive() info = message.get("info", None) if message["type"] == "http.response.debug" and info is not None: message = await recv_stream.receive() except anyio.EndOfStream: if app_exc is not None: raise app_exc raise RuntimeError("No response returned.") assert message["type"] == "http.response.start" async def body_stream() -> typing.AsyncGenerator[bytes, None]: async for message in recv_stream: assert message["type"] == "http.response.body" body = message.get("body", b"") if body: yield body if not message.get("more_body", False): break if app_exc is not None: raise app_exc response = _StreamingResponse(status_code=message["status"], content=body_stream(), info=info) response.raw_headers = message["headers"] return response > send_stream, recv_stream = anyio.create_memory_object_stream[Message]() E TypeError: 'function' object is not subscriptable starlette/middleware/base.py:175: TypeError ________ test_run_background_tasks_even_if_client_disconnects[asyncio] _________ @pytest.mark.anyio async def test_run_background_tasks_even_if_client_disconnects() -> None: # test for https://github.com/encode/starlette/issues/1438 response_complete = anyio.Event() background_task_run = anyio.Event() async def sleep_and_set() -> None: # small delay to give BaseHTTPMiddleware a chance to cancel us # this is required to make the test fail prior to fixing the issue # so do not be surprised if you remove it and the test still passes await anyio.sleep(0.1) background_task_run.set() async def endpoint_with_background_task(_: Request) -> PlainTextResponse: return PlainTextResponse(background=BackgroundTask(sleep_and_set)) async def passthrough( request: Request, call_next: RequestResponseEndpoint, ) -> Response: return await call_next(request) app = Starlette( middleware=[Middleware(BaseHTTPMiddleware, dispatch=passthrough)], routes=[Route("/", endpoint_with_background_task)], ) scope = { "type": "http", "version": "3", "method": "GET", "path": "/", } async def receive() -> Message: raise NotImplementedError("Should not be called!") async def send(message: Message) -> None: if message["type"] == "http.response.body": if not message.get("more_body", False): # pragma: no branch response_complete.set() > await app(scope, receive, send) tests/middleware/test_base.py:295: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/applications.py:112: in __call__ await self.middleware_stack(scope, receive, send) starlette/middleware/errors.py:187: in __call__ raise exc starlette/middleware/errors.py:165: in __call__ await self.app(scope, receive, _send) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = scope = {'app': , 'method': 'GET', 'path': '/', 'type': 'http', ...} receive = .receive at 0x7f25d98cab60> send = ._send at 0x7f25d98cafc0> async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: if scope["type"] != "http": await self.app(scope, receive, send) return request = _CachedRequest(scope, receive) wrapped_receive = request.wrapped_receive response_sent = anyio.Event() async def call_next(request: Request) -> Response: app_exc: Exception | None = None async def receive_or_disconnect() -> Message: if response_sent.is_set(): return {"type": "http.disconnect"} async with anyio.create_task_group() as task_group: async def wrap(func: typing.Callable[[], typing.Awaitable[T]]) -> T: result = await func() task_group.cancel_scope.cancel() return result task_group.start_soon(wrap, response_sent.wait) message = await wrap(wrapped_receive) if response_sent.is_set(): return {"type": "http.disconnect"} return message async def send_no_error(message: Message) -> None: try: await send_stream.send(message) except anyio.BrokenResourceError: # recv_stream has been closed, i.e. response_sent has been set. return async def coro() -> None: nonlocal app_exc with send_stream: try: await self.app(scope, receive_or_disconnect, send_no_error) except Exception as exc: app_exc = exc task_group.start_soon(coro) try: message = await recv_stream.receive() info = message.get("info", None) if message["type"] == "http.response.debug" and info is not None: message = await recv_stream.receive() except anyio.EndOfStream: if app_exc is not None: raise app_exc raise RuntimeError("No response returned.") assert message["type"] == "http.response.start" async def body_stream() -> typing.AsyncGenerator[bytes, None]: async for message in recv_stream: assert message["type"] == "http.response.body" body = message.get("body", b"") if body: yield body if not message.get("more_body", False): break if app_exc is not None: raise app_exc response = _StreamingResponse(status_code=message["status"], content=body_stream(), info=info) response.raw_headers = message["headers"] return response > send_stream, recv_stream = anyio.create_memory_object_stream[Message]() E TypeError: 'function' object is not subscriptable starlette/middleware/base.py:175: TypeError __________ test_run_background_tasks_even_if_client_disconnects[trio] __________ @pytest.mark.anyio async def test_run_background_tasks_even_if_client_disconnects() -> None: # test for https://github.com/encode/starlette/issues/1438 response_complete = anyio.Event() background_task_run = anyio.Event() async def sleep_and_set() -> None: # small delay to give BaseHTTPMiddleware a chance to cancel us # this is required to make the test fail prior to fixing the issue # so do not be surprised if you remove it and the test still passes await anyio.sleep(0.1) background_task_run.set() async def endpoint_with_background_task(_: Request) -> PlainTextResponse: return PlainTextResponse(background=BackgroundTask(sleep_and_set)) async def passthrough( request: Request, call_next: RequestResponseEndpoint, ) -> Response: return await call_next(request) app = Starlette( middleware=[Middleware(BaseHTTPMiddleware, dispatch=passthrough)], routes=[Route("/", endpoint_with_background_task)], ) scope = { "type": "http", "version": "3", "method": "GET", "path": "/", } async def receive() -> Message: raise NotImplementedError("Should not be called!") async def send(message: Message) -> None: if message["type"] == "http.response.body": if not message.get("more_body", False): # pragma: no branch response_complete.set() > await app(scope, receive, send) tests/middleware/test_base.py:295: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/applications.py:112: in __call__ await self.middleware_stack(scope, receive, send) starlette/middleware/errors.py:187: in __call__ raise exc starlette/middleware/errors.py:165: in __call__ await self.app(scope, receive, _send) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = scope = {'app': , 'method': 'GET', 'path': '/', 'type': 'http', ...} receive = .receive at 0x7f25d98c94e0> send = ._send at 0x7f25d98c9ee0> async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: if scope["type"] != "http": await self.app(scope, receive, send) return request = _CachedRequest(scope, receive) wrapped_receive = request.wrapped_receive response_sent = anyio.Event() async def call_next(request: Request) -> Response: app_exc: Exception | None = None async def receive_or_disconnect() -> Message: if response_sent.is_set(): return {"type": "http.disconnect"} async with anyio.create_task_group() as task_group: async def wrap(func: typing.Callable[[], typing.Awaitable[T]]) -> T: result = await func() task_group.cancel_scope.cancel() return result task_group.start_soon(wrap, response_sent.wait) message = await wrap(wrapped_receive) if response_sent.is_set(): return {"type": "http.disconnect"} return message async def send_no_error(message: Message) -> None: try: await send_stream.send(message) except anyio.BrokenResourceError: # recv_stream has been closed, i.e. response_sent has been set. return async def coro() -> None: nonlocal app_exc with send_stream: try: await self.app(scope, receive_or_disconnect, send_no_error) except Exception as exc: app_exc = exc task_group.start_soon(coro) try: message = await recv_stream.receive() info = message.get("info", None) if message["type"] == "http.response.debug" and info is not None: message = await recv_stream.receive() except anyio.EndOfStream: if app_exc is not None: raise app_exc raise RuntimeError("No response returned.") assert message["type"] == "http.response.start" async def body_stream() -> typing.AsyncGenerator[bytes, None]: async for message in recv_stream: assert message["type"] == "http.response.body" body = message.get("body", b"") if body: yield body if not message.get("more_body", False): break if app_exc is not None: raise app_exc response = _StreamingResponse(status_code=message["status"], content=body_stream(), info=info) response.raw_headers = message["headers"] return response > send_stream, recv_stream = anyio.create_memory_object_stream[Message]() E TypeError: 'function' object is not subscriptable starlette/middleware/base.py:175: TypeError ________________ test_do_not_block_on_background_tasks[asyncio] ________________ @pytest.mark.anyio async def test_do_not_block_on_background_tasks() -> None: response_complete = anyio.Event() events: list[str | Message] = [] async def sleep_and_set() -> None: events.append("Background task started") await anyio.sleep(0.1) events.append("Background task finished") async def endpoint_with_background_task(_: Request) -> PlainTextResponse: return PlainTextResponse(content="Hello", background=BackgroundTask(sleep_and_set)) async def passthrough(request: Request, call_next: RequestResponseEndpoint) -> Response: return await call_next(request) app = Starlette( middleware=[Middleware(BaseHTTPMiddleware, dispatch=passthrough)], routes=[Route("/", endpoint_with_background_task)], ) scope = { "type": "http", "version": "3", "method": "GET", "path": "/", } async def receive() -> Message: raise NotImplementedError("Should not be called!") async def send(message: Message) -> None: if message["type"] == "http.response.body": events.append(message) if not message.get("more_body", False): response_complete.set() > async with anyio.create_task_group() as tg: tests/middleware/test_base.py:337: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = exc_type = None, exc_val = None, exc_tb = None async def __aexit__( self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None, ) -> bool | None: ignore_exception = self.cancel_scope.__exit__(exc_type, exc_val, exc_tb) if exc_val is not None: self.cancel_scope.cancel() self._exceptions.append(exc_val) while self.cancel_scope._tasks: try: await asyncio.wait(self.cancel_scope._tasks) except asyncio.CancelledError: self.cancel_scope.cancel() self._active = False if not self.cancel_scope._parent_cancelled(): exceptions = self._filter_cancellation_errors(self._exceptions) else: exceptions = self._exceptions try: if len(exceptions) > 1: if all( isinstance(e, CancelledError) and not e.args for e in exceptions ): # Tasks were cancelled natively, without a cancellation message raise CancelledError else: > raise ExceptionGroup(exceptions) E anyio._backends._asyncio.ExceptionGroup: 2 exceptions were raised in the task group: E ---------------------------- E Traceback (most recent call last): E File "/builddir/build/BUILD/python-starlette-0.45.1-build/python-starlette-0.45.1/starlette/applications.py", line 112, in __call__ E await self.middleware_stack(scope, receive, send) E File "/builddir/build/BUILD/python-starlette-0.45.1-build/python-starlette-0.45.1/starlette/middleware/errors.py", line 187, in __call__ E raise exc E File "/builddir/build/BUILD/python-starlette-0.45.1-build/python-starlette-0.45.1/starlette/middleware/errors.py", line 165, in __call__ E await self.app(scope, receive, _send) E File "/builddir/build/BUILD/python-starlette-0.45.1-build/python-starlette-0.45.1/starlette/middleware/base.py", line 175, in __call__ E send_stream, recv_stream = anyio.create_memory_object_stream[Message]() E ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^ E TypeError: 'function' object is not subscriptable E ---------------------------- E Traceback (most recent call last): E File "/builddir/build/BUILD/python-starlette-0.45.1-build/python-starlette-0.45.1/starlette/applications.py", line 112, in __call__ E await self.middleware_stack(scope, receive, send) E File "/builddir/build/BUILD/python-starlette-0.45.1-build/python-starlette-0.45.1/starlette/middleware/errors.py", line 187, in __call__ E raise exc E File "/builddir/build/BUILD/python-starlette-0.45.1-build/python-starlette-0.45.1/starlette/middleware/errors.py", line 165, in __call__ E await self.app(scope, receive, _send) E File "/builddir/build/BUILD/python-starlette-0.45.1-build/python-starlette-0.45.1/starlette/middleware/base.py", line 175, in __call__ E send_stream, recv_stream = anyio.create_memory_object_stream[Message]() E ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^ E TypeError: 'function' object is not subscriptable /usr/lib/python3.13/site-packages/anyio/_backends/_asyncio.py:595: ExceptionGroup _________________ test_do_not_block_on_background_tasks[trio] __________________ + Exception Group Traceback (most recent call last): | File "/usr/lib/python3.13/site-packages/_pytest/runner.py", line 341, in from_call | result: TResult | None = func() | ~~~~^^ | File "/usr/lib/python3.13/site-packages/_pytest/runner.py", line 242, in | lambda: runtest_hook(item=item, **kwds), when=when, reraise=reraise | ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^ | File "/usr/lib/python3.13/site-packages/pluggy/_hooks.py", line 513, in __call__ | return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult) | ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | File "/usr/lib/python3.13/site-packages/pluggy/_manager.py", line 120, in _hookexec | return self._inner_hookexec(hook_name, methods, kwargs, firstresult) | ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | File "/usr/lib/python3.13/site-packages/pluggy/_callers.py", line 139, in _multicall | raise exception.with_traceback(exception.__traceback__) | File "/usr/lib/python3.13/site-packages/pluggy/_callers.py", line 122, in _multicall | teardown.throw(exception) # type: ignore[union-attr] | ~~~~~~~~~~~~~~^^^^^^^^^^^ | File "/usr/lib/python3.13/site-packages/_pytest/threadexception.py", line 92, in pytest_runtest_call | yield from thread_exception_runtest_hook() | File "/usr/lib/python3.13/site-packages/_pytest/threadexception.py", line 68, in thread_exception_runtest_hook | yield | File "/usr/lib/python3.13/site-packages/pluggy/_callers.py", line 122, in _multicall | teardown.throw(exception) # type: ignore[union-attr] | ~~~~~~~~~~~~~~^^^^^^^^^^^ | File "/usr/lib/python3.13/site-packages/_pytest/unraisableexception.py", line 95, in pytest_runtest_call | yield from unraisable_exception_runtest_hook() | File "/usr/lib/python3.13/site-packages/_pytest/unraisableexception.py", line 70, in unraisable_exception_runtest_hook | yield | File "/usr/lib/python3.13/site-packages/pluggy/_callers.py", line 122, in _multicall | teardown.throw(exception) # type: ignore[union-attr] | ~~~~~~~~~~~~~~^^^^^^^^^^^ | File "/usr/lib/python3.13/site-packages/_pytest/logging.py", line 846, in pytest_runtest_call | yield from self._runtest_for(item, "call") | File "/usr/lib/python3.13/site-packages/_pytest/logging.py", line 829, in _runtest_for | yield | File "/usr/lib/python3.13/site-packages/pluggy/_callers.py", line 122, in _multicall | teardown.throw(exception) # type: ignore[union-attr] | ~~~~~~~~~~~~~~^^^^^^^^^^^ | File "/usr/lib/python3.13/site-packages/_pytest/capture.py", line 880, in pytest_runtest_call | return (yield) | ^^^^^ | File "/usr/lib/python3.13/site-packages/pluggy/_callers.py", line 122, in _multicall | teardown.throw(exception) # type: ignore[union-attr] | ~~~~~~~~~~~~~~^^^^^^^^^^^ | File "/usr/lib/python3.13/site-packages/_pytest/skipping.py", line 257, in pytest_runtest_call | return (yield) | ^^^^^ | File "/usr/lib/python3.13/site-packages/pluggy/_callers.py", line 103, in _multicall | res = hook_impl.function(*args) | File "/usr/lib/python3.13/site-packages/_pytest/runner.py", line 174, in pytest_runtest_call | item.runtest() | ~~~~~~~~~~~~^^ | File "/usr/lib/python3.13/site-packages/_pytest/python.py", line 1627, in runtest | self.ihook.pytest_pyfunc_call(pyfuncitem=self) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^ | File "/usr/lib/python3.13/site-packages/pluggy/_hooks.py", line 513, in __call__ | return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult) | ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | File "/usr/lib/python3.13/site-packages/pluggy/_manager.py", line 120, in _hookexec | return self._inner_hookexec(hook_name, methods, kwargs, firstresult) | ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | File "/usr/lib/python3.13/site-packages/pluggy/_callers.py", line 139, in _multicall | raise exception.with_traceback(exception.__traceback__) | File "/usr/lib/python3.13/site-packages/pluggy/_callers.py", line 103, in _multicall | res = hook_impl.function(*args) | File "/usr/lib/python3.13/site-packages/anyio/pytest_plugin.py", line 117, in pytest_pyfunc_call | runner.run_test(pyfuncitem.obj, testargs) | ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^ | File "/usr/lib/python3.13/site-packages/anyio/_backends/_trio.py", line 996, in run_test | self._call(test_func, **kwargs) | ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^ | File "/usr/lib/python3.13/site-packages/anyio/_backends/_trio.py", line 955, in _call | return outcome.unwrap() | ~~~~~~~~~~~~~~^^ | File "/usr/lib/python3.13/site-packages/outcome/_impl.py", line 138, in unwrap | raise captured_error | File "/usr/lib/python3.13/site-packages/anyio/_backends/_trio.py", line 925, in _call_func | retval = await func(*args, **kwargs) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | File "/builddir/build/BUILD/python-starlette-0.45.1-build/python-starlette-0.45.1/tests/middleware/test_base.py", line 337, in test_do_not_block_on_background_tasks | async with anyio.create_task_group() as tg: | ~~~~~~~~~~~~~~~~~~~~~~~^^ | File "/usr/lib/python3.13/site-packages/anyio/_backends/_trio.py", line 187, in __aexit__ | raise ExceptionGroup(exc.exceptions) from None | trio.NonBaseMultiError: TypeError("'function' object is not subscriptable"), TypeError("'function' object is not subscriptable") +-+---------------- 1 ---------------- | Traceback (most recent call last): | File "/builddir/build/BUILD/python-starlette-0.45.1-build/python-starlette-0.45.1/starlette/applications.py", line 112, in __call__ | await self.middleware_stack(scope, receive, send) | File "/builddir/build/BUILD/python-starlette-0.45.1-build/python-starlette-0.45.1/starlette/middleware/errors.py", line 187, in __call__ | raise exc | File "/builddir/build/BUILD/python-starlette-0.45.1-build/python-starlette-0.45.1/starlette/middleware/errors.py", line 165, in __call__ | await self.app(scope, receive, _send) | File "/builddir/build/BUILD/python-starlette-0.45.1-build/python-starlette-0.45.1/starlette/middleware/base.py", line 175, in __call__ | send_stream, recv_stream = anyio.create_memory_object_stream[Message]() | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^ | TypeError: 'function' object is not subscriptable +---------------- 2 ---------------- | Traceback (most recent call last): | File "/builddir/build/BUILD/python-starlette-0.45.1-build/python-starlette-0.45.1/starlette/applications.py", line 112, in __call__ | await self.middleware_stack(scope, receive, send) | File "/builddir/build/BUILD/python-starlette-0.45.1-build/python-starlette-0.45.1/starlette/middleware/errors.py", line 187, in __call__ | raise exc | File "/builddir/build/BUILD/python-starlette-0.45.1-build/python-starlette-0.45.1/starlette/middleware/errors.py", line 165, in __call__ | await self.app(scope, receive, _send) | File "/builddir/build/BUILD/python-starlette-0.45.1-build/python-starlette-0.45.1/starlette/middleware/base.py", line 175, in __call__ | send_stream, recv_stream = anyio.create_memory_object_stream[Message]() | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^ | TypeError: 'function' object is not subscriptable +------------------------------------ ______ test_run_context_manager_exit_even_if_client_disconnects[asyncio] _______ @pytest.mark.anyio async def test_run_context_manager_exit_even_if_client_disconnects() -> None: # test for https://github.com/encode/starlette/issues/1678#issuecomment-1172916042 response_complete = anyio.Event() context_manager_exited = anyio.Event() async def sleep_and_set() -> None: # small delay to give BaseHTTPMiddleware a chance to cancel us # this is required to make the test fail prior to fixing the issue # so do not be surprised if you remove it and the test still passes await anyio.sleep(0.1) context_manager_exited.set() class ContextManagerMiddleware: def __init__(self, app: ASGIApp): self.app = app async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: async with AsyncExitStack() as stack: stack.push_async_callback(sleep_and_set) await self.app(scope, receive, send) async def simple_endpoint(_: Request) -> PlainTextResponse: return PlainTextResponse(background=BackgroundTask(sleep_and_set)) async def passthrough( request: Request, call_next: RequestResponseEndpoint, ) -> Response: return await call_next(request) app = Starlette( middleware=[ Middleware(BaseHTTPMiddleware, dispatch=passthrough), Middleware(ContextManagerMiddleware), ], routes=[Route("/", simple_endpoint)], ) scope = { "type": "http", "version": "3", "method": "GET", "path": "/", } async def receive() -> Message: raise NotImplementedError("Should not be called!") async def send(message: Message) -> None: if message["type"] == "http.response.body": if not message.get("more_body", False): # pragma: no branch response_complete.set() > await app(scope, receive, send) tests/middleware/test_base.py:409: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/applications.py:112: in __call__ await self.middleware_stack(scope, receive, send) starlette/middleware/errors.py:187: in __call__ raise exc starlette/middleware/errors.py:165: in __call__ await self.app(scope, receive, _send) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = scope = {'app': , 'method': 'GET', 'path': '/', 'type': 'http', ...} receive = .receive at 0x7f25d9c6dbc0> send = ._send at 0x7f25d9c6e5c0> async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: if scope["type"] != "http": await self.app(scope, receive, send) return request = _CachedRequest(scope, receive) wrapped_receive = request.wrapped_receive response_sent = anyio.Event() async def call_next(request: Request) -> Response: app_exc: Exception | None = None async def receive_or_disconnect() -> Message: if response_sent.is_set(): return {"type": "http.disconnect"} async with anyio.create_task_group() as task_group: async def wrap(func: typing.Callable[[], typing.Awaitable[T]]) -> T: result = await func() task_group.cancel_scope.cancel() return result task_group.start_soon(wrap, response_sent.wait) message = await wrap(wrapped_receive) if response_sent.is_set(): return {"type": "http.disconnect"} return message async def send_no_error(message: Message) -> None: try: await send_stream.send(message) except anyio.BrokenResourceError: # recv_stream has been closed, i.e. response_sent has been set. return async def coro() -> None: nonlocal app_exc with send_stream: try: await self.app(scope, receive_or_disconnect, send_no_error) except Exception as exc: app_exc = exc task_group.start_soon(coro) try: message = await recv_stream.receive() info = message.get("info", None) if message["type"] == "http.response.debug" and info is not None: message = await recv_stream.receive() except anyio.EndOfStream: if app_exc is not None: raise app_exc raise RuntimeError("No response returned.") assert message["type"] == "http.response.start" async def body_stream() -> typing.AsyncGenerator[bytes, None]: async for message in recv_stream: assert message["type"] == "http.response.body" body = message.get("body", b"") if body: yield body if not message.get("more_body", False): break if app_exc is not None: raise app_exc response = _StreamingResponse(status_code=message["status"], content=body_stream(), info=info) response.raw_headers = message["headers"] return response > send_stream, recv_stream = anyio.create_memory_object_stream[Message]() E TypeError: 'function' object is not subscriptable starlette/middleware/base.py:175: TypeError ________ test_run_context_manager_exit_even_if_client_disconnects[trio] ________ @pytest.mark.anyio async def test_run_context_manager_exit_even_if_client_disconnects() -> None: # test for https://github.com/encode/starlette/issues/1678#issuecomment-1172916042 response_complete = anyio.Event() context_manager_exited = anyio.Event() async def sleep_and_set() -> None: # small delay to give BaseHTTPMiddleware a chance to cancel us # this is required to make the test fail prior to fixing the issue # so do not be surprised if you remove it and the test still passes await anyio.sleep(0.1) context_manager_exited.set() class ContextManagerMiddleware: def __init__(self, app: ASGIApp): self.app = app async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: async with AsyncExitStack() as stack: stack.push_async_callback(sleep_and_set) await self.app(scope, receive, send) async def simple_endpoint(_: Request) -> PlainTextResponse: return PlainTextResponse(background=BackgroundTask(sleep_and_set)) async def passthrough( request: Request, call_next: RequestResponseEndpoint, ) -> Response: return await call_next(request) app = Starlette( middleware=[ Middleware(BaseHTTPMiddleware, dispatch=passthrough), Middleware(ContextManagerMiddleware), ], routes=[Route("/", simple_endpoint)], ) scope = { "type": "http", "version": "3", "method": "GET", "path": "/", } async def receive() -> Message: raise NotImplementedError("Should not be called!") async def send(message: Message) -> None: if message["type"] == "http.response.body": if not message.get("more_body", False): # pragma: no branch response_complete.set() > await app(scope, receive, send) tests/middleware/test_base.py:409: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/applications.py:112: in __call__ await self.middleware_stack(scope, receive, send) starlette/middleware/errors.py:187: in __call__ raise exc starlette/middleware/errors.py:165: in __call__ await self.app(scope, receive, _send) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = scope = {'app': , 'method': 'GET', 'path': '/', 'type': 'http', ...} receive = .receive at 0x7f25d98cb9c0> send = ._send at 0x7f25d98cb4c0> async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: if scope["type"] != "http": await self.app(scope, receive, send) return request = _CachedRequest(scope, receive) wrapped_receive = request.wrapped_receive response_sent = anyio.Event() async def call_next(request: Request) -> Response: app_exc: Exception | None = None async def receive_or_disconnect() -> Message: if response_sent.is_set(): return {"type": "http.disconnect"} async with anyio.create_task_group() as task_group: async def wrap(func: typing.Callable[[], typing.Awaitable[T]]) -> T: result = await func() task_group.cancel_scope.cancel() return result task_group.start_soon(wrap, response_sent.wait) message = await wrap(wrapped_receive) if response_sent.is_set(): return {"type": "http.disconnect"} return message async def send_no_error(message: Message) -> None: try: await send_stream.send(message) except anyio.BrokenResourceError: # recv_stream has been closed, i.e. response_sent has been set. return async def coro() -> None: nonlocal app_exc with send_stream: try: await self.app(scope, receive_or_disconnect, send_no_error) except Exception as exc: app_exc = exc task_group.start_soon(coro) try: message = await recv_stream.receive() info = message.get("info", None) if message["type"] == "http.response.debug" and info is not None: message = await recv_stream.receive() except anyio.EndOfStream: if app_exc is not None: raise app_exc raise RuntimeError("No response returned.") assert message["type"] == "http.response.start" async def body_stream() -> typing.AsyncGenerator[bytes, None]: async for message in recv_stream: assert message["type"] == "http.response.body" body = message.get("body", b"") if body: yield body if not message.get("more_body", False): break if app_exc is not None: raise app_exc response = _StreamingResponse(status_code=message["status"], content=body_stream(), info=info) response.raw_headers = message["headers"] return response > send_stream, recv_stream = anyio.create_memory_object_stream[Message]() E TypeError: 'function' object is not subscriptable starlette/middleware/base.py:175: TypeError ____ test_app_receives_http_disconnect_while_sending_if_discarded[asyncio] _____ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_app_receives_http_disconnect_while_sending_if_discarded( test_client_factory: TestClientFactory, ) -> None: class DiscardingMiddleware(BaseHTTPMiddleware): async def dispatch( self, request: Request, call_next: Any, ) -> PlainTextResponse: # As a matter of ordering, this test targets the case where the downstream # app response is discarded while it is sending a response body. # We need to wait for the downstream app to begin sending a response body # before sending the middleware response that will overwrite the downstream # response. downstream_app_response = await call_next(request) body_generator = downstream_app_response.body_iterator try: await body_generator.__anext__() finally: await body_generator.aclose() return PlainTextResponse("Custom") async def downstream_app( scope: Scope, receive: Receive, send: Send, ) -> None: await send( { "type": "http.response.start", "status": 200, "headers": [ (b"content-type", b"text/plain"), ], } ) async with anyio.create_task_group() as task_group: async def cancel_on_disconnect( *, task_status: TaskStatus[None] = anyio.TASK_STATUS_IGNORED, ) -> None: task_status.started() while True: message = await receive() if message["type"] == "http.disconnect": # pragma: no branch task_group.cancel_scope.cancel() break # Using start instead of start_soon to ensure that # cancel_on_disconnect is scheduled by the event loop # before we start returning the body await task_group.start(cancel_on_disconnect) # A timeout is set for 0.1 second in order to ensure that # we never deadlock the test run in an infinite loop with anyio.move_on_after(0.1): while True: await send( { "type": "http.response.body", "body": b"chunk ", "more_body": True, } ) pytest.fail("http.disconnect should have been received and canceled the scope") # pragma: no cover app = DiscardingMiddleware(downstream_app) client = test_client_factory(app) > response = client.get("/does_not_exist") tests/middleware/test_base.py:486: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:456: in get return super().get( /usr/lib/python3.13/site-packages/httpx/_client.py:1066: in get return self.request( starlette/testclient.py:428: in request return super().request( /usr/lib/python3.13/site-packages/httpx/_client.py:837: in request return self.send(request, auth=auth, follow_redirects=follow_redirects) /usr/lib/python3.13/site-packages/httpx/_client.py:926: in send response = self._send_handling_auth( /usr/lib/python3.13/site-packages/httpx/_client.py:954: in _send_handling_auth response = self._send_handling_redirects( /usr/lib/python3.13/site-packages/httpx/_client.py:991: in _send_handling_redirects response = self._send_single_request(request) /usr/lib/python3.13/site-packages/httpx/_client.py:1027: in _send_single_request response = transport.handle_request(request) starlette/testclient.py:337: in handle_request raise exc starlette/testclient.py:334: in handle_request portal.call(self.app, scope, receive, send) /usr/lib/python3.13/site-packages/anyio/from_thread.py:277: in call return cast(T_Retval, self.start_task_soon(func, *args).result()) /usr/lib64/python3.13/concurrent/futures/_base.py:456: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = .DiscardingMiddleware object at 0x7f25d9cd1be0> scope = {'client': ('testclient', 50000), 'extensions': {'http.response.debug': {}}, 'headers': [(b'host', b'testserver'), (b'...oding', b'gzip, deflate'), (b'connection', b'keep-alive'), (b'user-agent', b'testclient')], 'http_version': '1.1', ...} receive = .receive at 0x7f25d98cb240> send = .send at 0x7f25d98ca700> async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: if scope["type"] != "http": await self.app(scope, receive, send) return request = _CachedRequest(scope, receive) wrapped_receive = request.wrapped_receive response_sent = anyio.Event() async def call_next(request: Request) -> Response: app_exc: Exception | None = None async def receive_or_disconnect() -> Message: if response_sent.is_set(): return {"type": "http.disconnect"} async with anyio.create_task_group() as task_group: async def wrap(func: typing.Callable[[], typing.Awaitable[T]]) -> T: result = await func() task_group.cancel_scope.cancel() return result task_group.start_soon(wrap, response_sent.wait) message = await wrap(wrapped_receive) if response_sent.is_set(): return {"type": "http.disconnect"} return message async def send_no_error(message: Message) -> None: try: await send_stream.send(message) except anyio.BrokenResourceError: # recv_stream has been closed, i.e. response_sent has been set. return async def coro() -> None: nonlocal app_exc with send_stream: try: await self.app(scope, receive_or_disconnect, send_no_error) except Exception as exc: app_exc = exc task_group.start_soon(coro) try: message = await recv_stream.receive() info = message.get("info", None) if message["type"] == "http.response.debug" and info is not None: message = await recv_stream.receive() except anyio.EndOfStream: if app_exc is not None: raise app_exc raise RuntimeError("No response returned.") assert message["type"] == "http.response.start" async def body_stream() -> typing.AsyncGenerator[bytes, None]: async for message in recv_stream: assert message["type"] == "http.response.body" body = message.get("body", b"") if body: yield body if not message.get("more_body", False): break if app_exc is not None: raise app_exc response = _StreamingResponse(status_code=message["status"], content=body_stream(), info=info) response.raw_headers = message["headers"] return response > send_stream, recv_stream = anyio.create_memory_object_stream[Message]() E TypeError: 'function' object is not subscriptable starlette/middleware/base.py:175: TypeError ______ test_app_receives_http_disconnect_while_sending_if_discarded[trio] ______ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_app_receives_http_disconnect_while_sending_if_discarded( test_client_factory: TestClientFactory, ) -> None: class DiscardingMiddleware(BaseHTTPMiddleware): async def dispatch( self, request: Request, call_next: Any, ) -> PlainTextResponse: # As a matter of ordering, this test targets the case where the downstream # app response is discarded while it is sending a response body. # We need to wait for the downstream app to begin sending a response body # before sending the middleware response that will overwrite the downstream # response. downstream_app_response = await call_next(request) body_generator = downstream_app_response.body_iterator try: await body_generator.__anext__() finally: await body_generator.aclose() return PlainTextResponse("Custom") async def downstream_app( scope: Scope, receive: Receive, send: Send, ) -> None: await send( { "type": "http.response.start", "status": 200, "headers": [ (b"content-type", b"text/plain"), ], } ) async with anyio.create_task_group() as task_group: async def cancel_on_disconnect( *, task_status: TaskStatus[None] = anyio.TASK_STATUS_IGNORED, ) -> None: task_status.started() while True: message = await receive() if message["type"] == "http.disconnect": # pragma: no branch task_group.cancel_scope.cancel() break # Using start instead of start_soon to ensure that # cancel_on_disconnect is scheduled by the event loop # before we start returning the body await task_group.start(cancel_on_disconnect) # A timeout is set for 0.1 second in order to ensure that # we never deadlock the test run in an infinite loop with anyio.move_on_after(0.1): while True: await send( { "type": "http.response.body", "body": b"chunk ", "more_body": True, } ) pytest.fail("http.disconnect should have been received and canceled the scope") # pragma: no cover app = DiscardingMiddleware(downstream_app) client = test_client_factory(app) > response = client.get("/does_not_exist") tests/middleware/test_base.py:486: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:456: in get return super().get( /usr/lib/python3.13/site-packages/httpx/_client.py:1066: in get return self.request( starlette/testclient.py:428: in request return super().request( /usr/lib/python3.13/site-packages/httpx/_client.py:837: in request return self.send(request, auth=auth, follow_redirects=follow_redirects) /usr/lib/python3.13/site-packages/httpx/_client.py:926: in send response = self._send_handling_auth( /usr/lib/python3.13/site-packages/httpx/_client.py:954: in _send_handling_auth response = self._send_handling_redirects( /usr/lib/python3.13/site-packages/httpx/_client.py:991: in _send_handling_redirects response = self._send_single_request(request) /usr/lib/python3.13/site-packages/httpx/_client.py:1027: in _send_single_request response = transport.handle_request(request) starlette/testclient.py:337: in handle_request raise exc starlette/testclient.py:334: in handle_request portal.call(self.app, scope, receive, send) /usr/lib/python3.13/site-packages/anyio/from_thread.py:277: in call return cast(T_Retval, self.start_task_soon(func, *args).result()) /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = .DiscardingMiddleware object at 0x7f25d9cd1550> scope = {'client': ('testclient', 50000), 'extensions': {'http.response.debug': {}}, 'headers': [(b'host', b'testserver'), (b'...oding', b'gzip, deflate'), (b'connection', b'keep-alive'), (b'user-agent', b'testclient')], 'http_version': '1.1', ...} receive = .receive at 0x7f25d9c6c900> send = .send at 0x7f25d9c6cc20> async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: if scope["type"] != "http": await self.app(scope, receive, send) return request = _CachedRequest(scope, receive) wrapped_receive = request.wrapped_receive response_sent = anyio.Event() async def call_next(request: Request) -> Response: app_exc: Exception | None = None async def receive_or_disconnect() -> Message: if response_sent.is_set(): return {"type": "http.disconnect"} async with anyio.create_task_group() as task_group: async def wrap(func: typing.Callable[[], typing.Awaitable[T]]) -> T: result = await func() task_group.cancel_scope.cancel() return result task_group.start_soon(wrap, response_sent.wait) message = await wrap(wrapped_receive) if response_sent.is_set(): return {"type": "http.disconnect"} return message async def send_no_error(message: Message) -> None: try: await send_stream.send(message) except anyio.BrokenResourceError: # recv_stream has been closed, i.e. response_sent has been set. return async def coro() -> None: nonlocal app_exc with send_stream: try: await self.app(scope, receive_or_disconnect, send_no_error) except Exception as exc: app_exc = exc task_group.start_soon(coro) try: message = await recv_stream.receive() info = message.get("info", None) if message["type"] == "http.response.debug" and info is not None: message = await recv_stream.receive() except anyio.EndOfStream: if app_exc is not None: raise app_exc raise RuntimeError("No response returned.") assert message["type"] == "http.response.start" async def body_stream() -> typing.AsyncGenerator[bytes, None]: async for message in recv_stream: assert message["type"] == "http.response.body" body = message.get("body", b"") if body: yield body if not message.get("more_body", False): break if app_exc is not None: raise app_exc response = _StreamingResponse(status_code=message["status"], content=body_stream(), info=info) response.raw_headers = message["headers"] return response > send_stream, recv_stream = anyio.create_memory_object_stream[Message]() E TypeError: 'function' object is not subscriptable starlette/middleware/base.py:175: TypeError ____ test_app_receives_http_disconnect_after_sending_if_discarded[asyncio] _____ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_app_receives_http_disconnect_after_sending_if_discarded( test_client_factory: TestClientFactory, ) -> None: class DiscardingMiddleware(BaseHTTPMiddleware): async def dispatch( self, request: Request, call_next: RequestResponseEndpoint, ) -> PlainTextResponse: await call_next(request) return PlainTextResponse("Custom") async def downstream_app( scope: Scope, receive: Receive, send: Send, ) -> None: await send( { "type": "http.response.start", "status": 200, "headers": [ (b"content-type", b"text/plain"), ], } ) await send( { "type": "http.response.body", "body": b"first chunk, ", "more_body": True, } ) await send( { "type": "http.response.body", "body": b"second chunk", "more_body": True, } ) message = await receive() assert message["type"] == "http.disconnect" app = DiscardingMiddleware(downstream_app) client = test_client_factory(app) > response = client.get("/does_not_exist") tests/middleware/test_base.py:536: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:456: in get return super().get( /usr/lib/python3.13/site-packages/httpx/_client.py:1066: in get return self.request( starlette/testclient.py:428: in request return super().request( /usr/lib/python3.13/site-packages/httpx/_client.py:837: in request return self.send(request, auth=auth, follow_redirects=follow_redirects) /usr/lib/python3.13/site-packages/httpx/_client.py:926: in send response = self._send_handling_auth( /usr/lib/python3.13/site-packages/httpx/_client.py:954: in _send_handling_auth response = self._send_handling_redirects( /usr/lib/python3.13/site-packages/httpx/_client.py:991: in _send_handling_redirects response = self._send_single_request(request) /usr/lib/python3.13/site-packages/httpx/_client.py:1027: in _send_single_request response = transport.handle_request(request) starlette/testclient.py:337: in handle_request raise exc starlette/testclient.py:334: in handle_request portal.call(self.app, scope, receive, send) /usr/lib/python3.13/site-packages/anyio/from_thread.py:277: in call return cast(T_Retval, self.start_task_soon(func, *args).result()) /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = .DiscardingMiddleware object at 0x7f25da262510> scope = {'client': ('testclient', 50000), 'extensions': {'http.response.debug': {}}, 'headers': [(b'host', b'testserver'), (b'...oding', b'gzip, deflate'), (b'connection', b'keep-alive'), (b'user-agent', b'testclient')], 'http_version': '1.1', ...} receive = .receive at 0x7f25d98c9ee0> send = .send at 0x7f25d98c9440> async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: if scope["type"] != "http": await self.app(scope, receive, send) return request = _CachedRequest(scope, receive) wrapped_receive = request.wrapped_receive response_sent = anyio.Event() async def call_next(request: Request) -> Response: app_exc: Exception | None = None async def receive_or_disconnect() -> Message: if response_sent.is_set(): return {"type": "http.disconnect"} async with anyio.create_task_group() as task_group: async def wrap(func: typing.Callable[[], typing.Awaitable[T]]) -> T: result = await func() task_group.cancel_scope.cancel() return result task_group.start_soon(wrap, response_sent.wait) message = await wrap(wrapped_receive) if response_sent.is_set(): return {"type": "http.disconnect"} return message async def send_no_error(message: Message) -> None: try: await send_stream.send(message) except anyio.BrokenResourceError: # recv_stream has been closed, i.e. response_sent has been set. return async def coro() -> None: nonlocal app_exc with send_stream: try: await self.app(scope, receive_or_disconnect, send_no_error) except Exception as exc: app_exc = exc task_group.start_soon(coro) try: message = await recv_stream.receive() info = message.get("info", None) if message["type"] == "http.response.debug" and info is not None: message = await recv_stream.receive() except anyio.EndOfStream: if app_exc is not None: raise app_exc raise RuntimeError("No response returned.") assert message["type"] == "http.response.start" async def body_stream() -> typing.AsyncGenerator[bytes, None]: async for message in recv_stream: assert message["type"] == "http.response.body" body = message.get("body", b"") if body: yield body if not message.get("more_body", False): break if app_exc is not None: raise app_exc response = _StreamingResponse(status_code=message["status"], content=body_stream(), info=info) response.raw_headers = message["headers"] return response > send_stream, recv_stream = anyio.create_memory_object_stream[Message]() E TypeError: 'function' object is not subscriptable starlette/middleware/base.py:175: TypeError ______ test_app_receives_http_disconnect_after_sending_if_discarded[trio] ______ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_app_receives_http_disconnect_after_sending_if_discarded( test_client_factory: TestClientFactory, ) -> None: class DiscardingMiddleware(BaseHTTPMiddleware): async def dispatch( self, request: Request, call_next: RequestResponseEndpoint, ) -> PlainTextResponse: await call_next(request) return PlainTextResponse("Custom") async def downstream_app( scope: Scope, receive: Receive, send: Send, ) -> None: await send( { "type": "http.response.start", "status": 200, "headers": [ (b"content-type", b"text/plain"), ], } ) await send( { "type": "http.response.body", "body": b"first chunk, ", "more_body": True, } ) await send( { "type": "http.response.body", "body": b"second chunk", "more_body": True, } ) message = await receive() assert message["type"] == "http.disconnect" app = DiscardingMiddleware(downstream_app) client = test_client_factory(app) > response = client.get("/does_not_exist") tests/middleware/test_base.py:536: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:456: in get return super().get( /usr/lib/python3.13/site-packages/httpx/_client.py:1066: in get return self.request( starlette/testclient.py:428: in request return super().request( /usr/lib/python3.13/site-packages/httpx/_client.py:837: in request return self.send(request, auth=auth, follow_redirects=follow_redirects) /usr/lib/python3.13/site-packages/httpx/_client.py:926: in send response = self._send_handling_auth( /usr/lib/python3.13/site-packages/httpx/_client.py:954: in _send_handling_auth response = self._send_handling_redirects( /usr/lib/python3.13/site-packages/httpx/_client.py:991: in _send_handling_redirects response = self._send_single_request(request) /usr/lib/python3.13/site-packages/httpx/_client.py:1027: in _send_single_request response = transport.handle_request(request) starlette/testclient.py:337: in handle_request raise exc starlette/testclient.py:334: in handle_request portal.call(self.app, scope, receive, send) /usr/lib/python3.13/site-packages/anyio/from_thread.py:277: in call return cast(T_Retval, self.start_task_soon(func, *args).result()) /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = .DiscardingMiddleware object at 0x7f25d9cd2900> scope = {'client': ('testclient', 50000), 'extensions': {'http.response.debug': {}}, 'headers': [(b'host', b'testserver'), (b'...oding', b'gzip, deflate'), (b'connection', b'keep-alive'), (b'user-agent', b'testclient')], 'http_version': '1.1', ...} receive = .receive at 0x7f25d98c94e0> send = .send at 0x7f25d98cad40> async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: if scope["type"] != "http": await self.app(scope, receive, send) return request = _CachedRequest(scope, receive) wrapped_receive = request.wrapped_receive response_sent = anyio.Event() async def call_next(request: Request) -> Response: app_exc: Exception | None = None async def receive_or_disconnect() -> Message: if response_sent.is_set(): return {"type": "http.disconnect"} async with anyio.create_task_group() as task_group: async def wrap(func: typing.Callable[[], typing.Awaitable[T]]) -> T: result = await func() task_group.cancel_scope.cancel() return result task_group.start_soon(wrap, response_sent.wait) message = await wrap(wrapped_receive) if response_sent.is_set(): return {"type": "http.disconnect"} return message async def send_no_error(message: Message) -> None: try: await send_stream.send(message) except anyio.BrokenResourceError: # recv_stream has been closed, i.e. response_sent has been set. return async def coro() -> None: nonlocal app_exc with send_stream: try: await self.app(scope, receive_or_disconnect, send_no_error) except Exception as exc: app_exc = exc task_group.start_soon(coro) try: message = await recv_stream.receive() info = message.get("info", None) if message["type"] == "http.response.debug" and info is not None: message = await recv_stream.receive() except anyio.EndOfStream: if app_exc is not None: raise app_exc raise RuntimeError("No response returned.") assert message["type"] == "http.response.start" async def body_stream() -> typing.AsyncGenerator[bytes, None]: async for message in recv_stream: assert message["type"] == "http.response.body" body = message.get("body", b"") if body: yield body if not message.get("more_body", False): break if app_exc is not None: raise app_exc response = _StreamingResponse(status_code=message["status"], content=body_stream(), info=info) response.raw_headers = message["headers"] return response > send_stream, recv_stream = anyio.create_memory_object_stream[Message]() E TypeError: 'function' object is not subscriptable starlette/middleware/base.py:175: TypeError ____ test_read_request_stream_in_app_after_middleware_calls_stream[asyncio] ____ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_read_request_stream_in_app_after_middleware_calls_stream( test_client_factory: TestClientFactory, ) -> None: async def homepage(request: Request) -> PlainTextResponse: expected = [b""] async for chunk in request.stream(): assert chunk == expected.pop(0) assert expected == [] return PlainTextResponse("Homepage") class ConsumingMiddleware(BaseHTTPMiddleware): async def dispatch( self, request: Request, call_next: RequestResponseEndpoint, ) -> Response: expected = [b"a", b""] async for chunk in request.stream(): assert chunk == expected.pop(0) assert expected == [] return await call_next(request) app = Starlette( routes=[Route("/", homepage, methods=["POST"])], middleware=[Middleware(ConsumingMiddleware)], ) client: TestClient = test_client_factory(app) > response = client.post("/", content=b"a") tests/middleware/test_base.py:568: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:529: in post return super().post( /usr/lib/python3.13/site-packages/httpx/_client.py:1157: in post return self.request( starlette/testclient.py:428: in request return super().request( /usr/lib/python3.13/site-packages/httpx/_client.py:837: in request return self.send(request, auth=auth, follow_redirects=follow_redirects) /usr/lib/python3.13/site-packages/httpx/_client.py:926: in send response = self._send_handling_auth( /usr/lib/python3.13/site-packages/httpx/_client.py:954: in _send_handling_auth response = self._send_handling_redirects( /usr/lib/python3.13/site-packages/httpx/_client.py:991: in _send_handling_redirects response = self._send_single_request(request) /usr/lib/python3.13/site-packages/httpx/_client.py:1027: in _send_single_request response = transport.handle_request(request) starlette/testclient.py:337: in handle_request raise exc starlette/testclient.py:334: in handle_request portal.call(self.app, scope, receive, send) /usr/lib/python3.13/site-packages/anyio/from_thread.py:277: in call return cast(T_Retval, self.start_task_soon(func, *args).result()) /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval starlette/applications.py:112: in __call__ await self.middleware_stack(scope, receive, send) starlette/middleware/errors.py:187: in __call__ raise exc starlette/middleware/errors.py:165: in __call__ await self.app(scope, receive, _send) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = .ConsumingMiddleware object at 0x7f25da262510> scope = {'app': , 'client': ('testclient', 50000), 'extensions': {'...g', b'gzip, deflate'), (b'connection', b'keep-alive'), (b'user-agent', b'testclient'), (b'content-length', b'1')], ...} receive = .receive at 0x7f25d98cb7e0> send = ._send at 0x7f25d9c6e340> async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: if scope["type"] != "http": await self.app(scope, receive, send) return request = _CachedRequest(scope, receive) wrapped_receive = request.wrapped_receive response_sent = anyio.Event() async def call_next(request: Request) -> Response: app_exc: Exception | None = None async def receive_or_disconnect() -> Message: if response_sent.is_set(): return {"type": "http.disconnect"} async with anyio.create_task_group() as task_group: async def wrap(func: typing.Callable[[], typing.Awaitable[T]]) -> T: result = await func() task_group.cancel_scope.cancel() return result task_group.start_soon(wrap, response_sent.wait) message = await wrap(wrapped_receive) if response_sent.is_set(): return {"type": "http.disconnect"} return message async def send_no_error(message: Message) -> None: try: await send_stream.send(message) except anyio.BrokenResourceError: # recv_stream has been closed, i.e. response_sent has been set. return async def coro() -> None: nonlocal app_exc with send_stream: try: await self.app(scope, receive_or_disconnect, send_no_error) except Exception as exc: app_exc = exc task_group.start_soon(coro) try: message = await recv_stream.receive() info = message.get("info", None) if message["type"] == "http.response.debug" and info is not None: message = await recv_stream.receive() except anyio.EndOfStream: if app_exc is not None: raise app_exc raise RuntimeError("No response returned.") assert message["type"] == "http.response.start" async def body_stream() -> typing.AsyncGenerator[bytes, None]: async for message in recv_stream: assert message["type"] == "http.response.body" body = message.get("body", b"") if body: yield body if not message.get("more_body", False): break if app_exc is not None: raise app_exc response = _StreamingResponse(status_code=message["status"], content=body_stream(), info=info) response.raw_headers = message["headers"] return response > send_stream, recv_stream = anyio.create_memory_object_stream[Message]() E TypeError: 'function' object is not subscriptable starlette/middleware/base.py:175: TypeError _____ test_read_request_stream_in_app_after_middleware_calls_stream[trio] ______ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_read_request_stream_in_app_after_middleware_calls_stream( test_client_factory: TestClientFactory, ) -> None: async def homepage(request: Request) -> PlainTextResponse: expected = [b""] async for chunk in request.stream(): assert chunk == expected.pop(0) assert expected == [] return PlainTextResponse("Homepage") class ConsumingMiddleware(BaseHTTPMiddleware): async def dispatch( self, request: Request, call_next: RequestResponseEndpoint, ) -> Response: expected = [b"a", b""] async for chunk in request.stream(): assert chunk == expected.pop(0) assert expected == [] return await call_next(request) app = Starlette( routes=[Route("/", homepage, methods=["POST"])], middleware=[Middleware(ConsumingMiddleware)], ) client: TestClient = test_client_factory(app) > response = client.post("/", content=b"a") tests/middleware/test_base.py:568: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:529: in post return super().post( /usr/lib/python3.13/site-packages/httpx/_client.py:1157: in post return self.request( starlette/testclient.py:428: in request return super().request( /usr/lib/python3.13/site-packages/httpx/_client.py:837: in request return self.send(request, auth=auth, follow_redirects=follow_redirects) /usr/lib/python3.13/site-packages/httpx/_client.py:926: in send response = self._send_handling_auth( /usr/lib/python3.13/site-packages/httpx/_client.py:954: in _send_handling_auth response = self._send_handling_redirects( /usr/lib/python3.13/site-packages/httpx/_client.py:991: in _send_handling_redirects response = self._send_single_request(request) /usr/lib/python3.13/site-packages/httpx/_client.py:1027: in _send_single_request response = transport.handle_request(request) starlette/testclient.py:337: in handle_request raise exc starlette/testclient.py:334: in handle_request portal.call(self.app, scope, receive, send) /usr/lib/python3.13/site-packages/anyio/from_thread.py:277: in call return cast(T_Retval, self.start_task_soon(func, *args).result()) /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval starlette/applications.py:112: in __call__ await self.middleware_stack(scope, receive, send) starlette/middleware/errors.py:187: in __call__ raise exc starlette/middleware/errors.py:165: in __call__ await self.app(scope, receive, _send) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = .ConsumingMiddleware object at 0x7f25d9cd16a0> scope = {'app': , 'client': ('testclient', 50000), 'extensions': {'...g', b'gzip, deflate'), (b'connection', b'keep-alive'), (b'user-agent', b'testclient'), (b'content-length', b'1')], ...} receive = .receive at 0x7f25d9c6fb00> send = ._send at 0x7f25d9724860> async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: if scope["type"] != "http": await self.app(scope, receive, send) return request = _CachedRequest(scope, receive) wrapped_receive = request.wrapped_receive response_sent = anyio.Event() async def call_next(request: Request) -> Response: app_exc: Exception | None = None async def receive_or_disconnect() -> Message: if response_sent.is_set(): return {"type": "http.disconnect"} async with anyio.create_task_group() as task_group: async def wrap(func: typing.Callable[[], typing.Awaitable[T]]) -> T: result = await func() task_group.cancel_scope.cancel() return result task_group.start_soon(wrap, response_sent.wait) message = await wrap(wrapped_receive) if response_sent.is_set(): return {"type": "http.disconnect"} return message async def send_no_error(message: Message) -> None: try: await send_stream.send(message) except anyio.BrokenResourceError: # recv_stream has been closed, i.e. response_sent has been set. return async def coro() -> None: nonlocal app_exc with send_stream: try: await self.app(scope, receive_or_disconnect, send_no_error) except Exception as exc: app_exc = exc task_group.start_soon(coro) try: message = await recv_stream.receive() info = message.get("info", None) if message["type"] == "http.response.debug" and info is not None: message = await recv_stream.receive() except anyio.EndOfStream: if app_exc is not None: raise app_exc raise RuntimeError("No response returned.") assert message["type"] == "http.response.start" async def body_stream() -> typing.AsyncGenerator[bytes, None]: async for message in recv_stream: assert message["type"] == "http.response.body" body = message.get("body", b"") if body: yield body if not message.get("more_body", False): break if app_exc is not None: raise app_exc response = _StreamingResponse(status_code=message["status"], content=body_stream(), info=info) response.raw_headers = message["headers"] return response > send_stream, recv_stream = anyio.create_memory_object_stream[Message]() E TypeError: 'function' object is not subscriptable starlette/middleware/base.py:175: TypeError _____ test_read_request_stream_in_app_after_middleware_calls_body[asyncio] _____ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_read_request_stream_in_app_after_middleware_calls_body( test_client_factory: TestClientFactory, ) -> None: async def homepage(request: Request) -> PlainTextResponse: expected = [b"a", b""] async for chunk in request.stream(): assert chunk == expected.pop(0) assert expected == [] return PlainTextResponse("Homepage") class ConsumingMiddleware(BaseHTTPMiddleware): async def dispatch( self, request: Request, call_next: RequestResponseEndpoint, ) -> Response: assert await request.body() == b"a" return await call_next(request) app = Starlette( routes=[Route("/", homepage, methods=["POST"])], middleware=[Middleware(ConsumingMiddleware)], ) client: TestClient = test_client_factory(app) > response = client.post("/", content=b"a") tests/middleware/test_base.py:597: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:529: in post return super().post( /usr/lib/python3.13/site-packages/httpx/_client.py:1157: in post return self.request( starlette/testclient.py:428: in request return super().request( /usr/lib/python3.13/site-packages/httpx/_client.py:837: in request return self.send(request, auth=auth, follow_redirects=follow_redirects) /usr/lib/python3.13/site-packages/httpx/_client.py:926: in send response = self._send_handling_auth( /usr/lib/python3.13/site-packages/httpx/_client.py:954: in _send_handling_auth response = self._send_handling_redirects( /usr/lib/python3.13/site-packages/httpx/_client.py:991: in _send_handling_redirects response = self._send_single_request(request) /usr/lib/python3.13/site-packages/httpx/_client.py:1027: in _send_single_request response = transport.handle_request(request) starlette/testclient.py:337: in handle_request raise exc starlette/testclient.py:334: in handle_request portal.call(self.app, scope, receive, send) /usr/lib/python3.13/site-packages/anyio/from_thread.py:277: in call return cast(T_Retval, self.start_task_soon(func, *args).result()) /usr/lib64/python3.13/concurrent/futures/_base.py:456: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval starlette/applications.py:112: in __call__ await self.middleware_stack(scope, receive, send) starlette/middleware/errors.py:187: in __call__ raise exc starlette/middleware/errors.py:165: in __call__ await self.app(scope, receive, _send) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = .ConsumingMiddleware object at 0x7f25d9cd3e00> scope = {'app': , 'client': ('testclient', 50000), 'extensions': {'...g', b'gzip, deflate'), (b'connection', b'keep-alive'), (b'user-agent', b'testclient'), (b'content-length', b'1')], ...} receive = .receive at 0x7f25d9724040> send = ._send at 0x7f25d97253a0> async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: if scope["type"] != "http": await self.app(scope, receive, send) return request = _CachedRequest(scope, receive) wrapped_receive = request.wrapped_receive response_sent = anyio.Event() async def call_next(request: Request) -> Response: app_exc: Exception | None = None async def receive_or_disconnect() -> Message: if response_sent.is_set(): return {"type": "http.disconnect"} async with anyio.create_task_group() as task_group: async def wrap(func: typing.Callable[[], typing.Awaitable[T]]) -> T: result = await func() task_group.cancel_scope.cancel() return result task_group.start_soon(wrap, response_sent.wait) message = await wrap(wrapped_receive) if response_sent.is_set(): return {"type": "http.disconnect"} return message async def send_no_error(message: Message) -> None: try: await send_stream.send(message) except anyio.BrokenResourceError: # recv_stream has been closed, i.e. response_sent has been set. return async def coro() -> None: nonlocal app_exc with send_stream: try: await self.app(scope, receive_or_disconnect, send_no_error) except Exception as exc: app_exc = exc task_group.start_soon(coro) try: message = await recv_stream.receive() info = message.get("info", None) if message["type"] == "http.response.debug" and info is not None: message = await recv_stream.receive() except anyio.EndOfStream: if app_exc is not None: raise app_exc raise RuntimeError("No response returned.") assert message["type"] == "http.response.start" async def body_stream() -> typing.AsyncGenerator[bytes, None]: async for message in recv_stream: assert message["type"] == "http.response.body" body = message.get("body", b"") if body: yield body if not message.get("more_body", False): break if app_exc is not None: raise app_exc response = _StreamingResponse(status_code=message["status"], content=body_stream(), info=info) response.raw_headers = message["headers"] return response > send_stream, recv_stream = anyio.create_memory_object_stream[Message]() E TypeError: 'function' object is not subscriptable starlette/middleware/base.py:175: TypeError ______ test_read_request_stream_in_app_after_middleware_calls_body[trio] _______ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_read_request_stream_in_app_after_middleware_calls_body( test_client_factory: TestClientFactory, ) -> None: async def homepage(request: Request) -> PlainTextResponse: expected = [b"a", b""] async for chunk in request.stream(): assert chunk == expected.pop(0) assert expected == [] return PlainTextResponse("Homepage") class ConsumingMiddleware(BaseHTTPMiddleware): async def dispatch( self, request: Request, call_next: RequestResponseEndpoint, ) -> Response: assert await request.body() == b"a" return await call_next(request) app = Starlette( routes=[Route("/", homepage, methods=["POST"])], middleware=[Middleware(ConsumingMiddleware)], ) client: TestClient = test_client_factory(app) > response = client.post("/", content=b"a") tests/middleware/test_base.py:597: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:529: in post return super().post( /usr/lib/python3.13/site-packages/httpx/_client.py:1157: in post return self.request( starlette/testclient.py:428: in request return super().request( /usr/lib/python3.13/site-packages/httpx/_client.py:837: in request return self.send(request, auth=auth, follow_redirects=follow_redirects) /usr/lib/python3.13/site-packages/httpx/_client.py:926: in send response = self._send_handling_auth( /usr/lib/python3.13/site-packages/httpx/_client.py:954: in _send_handling_auth response = self._send_handling_redirects( /usr/lib/python3.13/site-packages/httpx/_client.py:991: in _send_handling_redirects response = self._send_single_request(request) /usr/lib/python3.13/site-packages/httpx/_client.py:1027: in _send_single_request response = transport.handle_request(request) starlette/testclient.py:337: in handle_request raise exc starlette/testclient.py:334: in handle_request portal.call(self.app, scope, receive, send) /usr/lib/python3.13/site-packages/anyio/from_thread.py:277: in call return cast(T_Retval, self.start_task_soon(func, *args).result()) /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval starlette/applications.py:112: in __call__ await self.middleware_stack(scope, receive, send) starlette/middleware/errors.py:187: in __call__ raise exc starlette/middleware/errors.py:165: in __call__ await self.app(scope, receive, _send) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = .ConsumingMiddleware object at 0x7f25d9cd1be0> scope = {'app': , 'client': ('testclient', 50000), 'extensions': {'...g', b'gzip, deflate'), (b'connection', b'keep-alive'), (b'user-agent', b'testclient'), (b'content-length', b'1')], ...} receive = .receive at 0x7f25d97268e0> send = ._send at 0x7f25d97260c0> async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: if scope["type"] != "http": await self.app(scope, receive, send) return request = _CachedRequest(scope, receive) wrapped_receive = request.wrapped_receive response_sent = anyio.Event() async def call_next(request: Request) -> Response: app_exc: Exception | None = None async def receive_or_disconnect() -> Message: if response_sent.is_set(): return {"type": "http.disconnect"} async with anyio.create_task_group() as task_group: async def wrap(func: typing.Callable[[], typing.Awaitable[T]]) -> T: result = await func() task_group.cancel_scope.cancel() return result task_group.start_soon(wrap, response_sent.wait) message = await wrap(wrapped_receive) if response_sent.is_set(): return {"type": "http.disconnect"} return message async def send_no_error(message: Message) -> None: try: await send_stream.send(message) except anyio.BrokenResourceError: # recv_stream has been closed, i.e. response_sent has been set. return async def coro() -> None: nonlocal app_exc with send_stream: try: await self.app(scope, receive_or_disconnect, send_no_error) except Exception as exc: app_exc = exc task_group.start_soon(coro) try: message = await recv_stream.receive() info = message.get("info", None) if message["type"] == "http.response.debug" and info is not None: message = await recv_stream.receive() except anyio.EndOfStream: if app_exc is not None: raise app_exc raise RuntimeError("No response returned.") assert message["type"] == "http.response.start" async def body_stream() -> typing.AsyncGenerator[bytes, None]: async for message in recv_stream: assert message["type"] == "http.response.body" body = message.get("body", b"") if body: yield body if not message.get("more_body", False): break if app_exc is not None: raise app_exc response = _StreamingResponse(status_code=message["status"], content=body_stream(), info=info) response.raw_headers = message["headers"] return response > send_stream, recv_stream = anyio.create_memory_object_stream[Message]() E TypeError: 'function' object is not subscriptable starlette/middleware/base.py:175: TypeError _____ test_read_request_body_in_app_after_middleware_calls_stream[asyncio] _____ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_read_request_body_in_app_after_middleware_calls_stream( test_client_factory: TestClientFactory, ) -> None: async def homepage(request: Request) -> PlainTextResponse: assert await request.body() == b"" return PlainTextResponse("Homepage") class ConsumingMiddleware(BaseHTTPMiddleware): async def dispatch( self, request: Request, call_next: RequestResponseEndpoint, ) -> Response: expected = [b"a", b""] async for chunk in request.stream(): assert chunk == expected.pop(0) assert expected == [] return await call_next(request) app = Starlette( routes=[Route("/", homepage, methods=["POST"])], middleware=[Middleware(ConsumingMiddleware)], ) client: TestClient = test_client_factory(app) > response = client.post("/", content=b"a") tests/middleware/test_base.py:626: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:529: in post return super().post( /usr/lib/python3.13/site-packages/httpx/_client.py:1157: in post return self.request( starlette/testclient.py:428: in request return super().request( /usr/lib/python3.13/site-packages/httpx/_client.py:837: in request return self.send(request, auth=auth, follow_redirects=follow_redirects) /usr/lib/python3.13/site-packages/httpx/_client.py:926: in send response = self._send_handling_auth( /usr/lib/python3.13/site-packages/httpx/_client.py:954: in _send_handling_auth response = self._send_handling_redirects( /usr/lib/python3.13/site-packages/httpx/_client.py:991: in _send_handling_redirects response = self._send_single_request(request) /usr/lib/python3.13/site-packages/httpx/_client.py:1027: in _send_single_request response = transport.handle_request(request) starlette/testclient.py:337: in handle_request raise exc starlette/testclient.py:334: in handle_request portal.call(self.app, scope, receive, send) /usr/lib/python3.13/site-packages/anyio/from_thread.py:277: in call return cast(T_Retval, self.start_task_soon(func, *args).result()) /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval starlette/applications.py:112: in __call__ await self.middleware_stack(scope, receive, send) starlette/middleware/errors.py:187: in __call__ raise exc starlette/middleware/errors.py:165: in __call__ await self.app(scope, receive, _send) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = .ConsumingMiddleware object at 0x7f25d9cd0590> scope = {'app': , 'client': ('testclient', 50000), 'extensions': {'...g', b'gzip, deflate'), (b'connection', b'keep-alive'), (b'user-agent', b'testclient'), (b'content-length', b'1')], ...} receive = .receive at 0x7f25d97263e0> send = ._send at 0x7f25d97272e0> async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: if scope["type"] != "http": await self.app(scope, receive, send) return request = _CachedRequest(scope, receive) wrapped_receive = request.wrapped_receive response_sent = anyio.Event() async def call_next(request: Request) -> Response: app_exc: Exception | None = None async def receive_or_disconnect() -> Message: if response_sent.is_set(): return {"type": "http.disconnect"} async with anyio.create_task_group() as task_group: async def wrap(func: typing.Callable[[], typing.Awaitable[T]]) -> T: result = await func() task_group.cancel_scope.cancel() return result task_group.start_soon(wrap, response_sent.wait) message = await wrap(wrapped_receive) if response_sent.is_set(): return {"type": "http.disconnect"} return message async def send_no_error(message: Message) -> None: try: await send_stream.send(message) except anyio.BrokenResourceError: # recv_stream has been closed, i.e. response_sent has been set. return async def coro() -> None: nonlocal app_exc with send_stream: try: await self.app(scope, receive_or_disconnect, send_no_error) except Exception as exc: app_exc = exc task_group.start_soon(coro) try: message = await recv_stream.receive() info = message.get("info", None) if message["type"] == "http.response.debug" and info is not None: message = await recv_stream.receive() except anyio.EndOfStream: if app_exc is not None: raise app_exc raise RuntimeError("No response returned.") assert message["type"] == "http.response.start" async def body_stream() -> typing.AsyncGenerator[bytes, None]: async for message in recv_stream: assert message["type"] == "http.response.body" body = message.get("body", b"") if body: yield body if not message.get("more_body", False): break if app_exc is not None: raise app_exc response = _StreamingResponse(status_code=message["status"], content=body_stream(), info=info) response.raw_headers = message["headers"] return response > send_stream, recv_stream = anyio.create_memory_object_stream[Message]() E TypeError: 'function' object is not subscriptable starlette/middleware/base.py:175: TypeError ______ test_read_request_body_in_app_after_middleware_calls_stream[trio] _______ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_read_request_body_in_app_after_middleware_calls_stream( test_client_factory: TestClientFactory, ) -> None: async def homepage(request: Request) -> PlainTextResponse: assert await request.body() == b"" return PlainTextResponse("Homepage") class ConsumingMiddleware(BaseHTTPMiddleware): async def dispatch( self, request: Request, call_next: RequestResponseEndpoint, ) -> Response: expected = [b"a", b""] async for chunk in request.stream(): assert chunk == expected.pop(0) assert expected == [] return await call_next(request) app = Starlette( routes=[Route("/", homepage, methods=["POST"])], middleware=[Middleware(ConsumingMiddleware)], ) client: TestClient = test_client_factory(app) > response = client.post("/", content=b"a") tests/middleware/test_base.py:626: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:529: in post return super().post( /usr/lib/python3.13/site-packages/httpx/_client.py:1157: in post return self.request( starlette/testclient.py:428: in request return super().request( /usr/lib/python3.13/site-packages/httpx/_client.py:837: in request return self.send(request, auth=auth, follow_redirects=follow_redirects) /usr/lib/python3.13/site-packages/httpx/_client.py:926: in send response = self._send_handling_auth( /usr/lib/python3.13/site-packages/httpx/_client.py:954: in _send_handling_auth response = self._send_handling_redirects( /usr/lib/python3.13/site-packages/httpx/_client.py:991: in _send_handling_redirects response = self._send_single_request(request) /usr/lib/python3.13/site-packages/httpx/_client.py:1027: in _send_single_request response = transport.handle_request(request) starlette/testclient.py:337: in handle_request raise exc starlette/testclient.py:334: in handle_request portal.call(self.app, scope, receive, send) /usr/lib/python3.13/site-packages/anyio/from_thread.py:277: in call return cast(T_Retval, self.start_task_soon(func, *args).result()) /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval starlette/applications.py:112: in __call__ await self.middleware_stack(scope, receive, send) starlette/middleware/errors.py:187: in __call__ raise exc starlette/middleware/errors.py:165: in __call__ await self.app(scope, receive, _send) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = .ConsumingMiddleware object at 0x7f25d9cd3b60> scope = {'app': , 'client': ('testclient', 50000), 'extensions': {'...g', b'gzip, deflate'), (b'connection', b'keep-alive'), (b'user-agent', b'testclient'), (b'content-length', b'1')], ...} receive = .receive at 0x7f25d97262a0> send = ._send at 0x7f25d9726020> async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: if scope["type"] != "http": await self.app(scope, receive, send) return request = _CachedRequest(scope, receive) wrapped_receive = request.wrapped_receive response_sent = anyio.Event() async def call_next(request: Request) -> Response: app_exc: Exception | None = None async def receive_or_disconnect() -> Message: if response_sent.is_set(): return {"type": "http.disconnect"} async with anyio.create_task_group() as task_group: async def wrap(func: typing.Callable[[], typing.Awaitable[T]]) -> T: result = await func() task_group.cancel_scope.cancel() return result task_group.start_soon(wrap, response_sent.wait) message = await wrap(wrapped_receive) if response_sent.is_set(): return {"type": "http.disconnect"} return message async def send_no_error(message: Message) -> None: try: await send_stream.send(message) except anyio.BrokenResourceError: # recv_stream has been closed, i.e. response_sent has been set. return async def coro() -> None: nonlocal app_exc with send_stream: try: await self.app(scope, receive_or_disconnect, send_no_error) except Exception as exc: app_exc = exc task_group.start_soon(coro) try: message = await recv_stream.receive() info = message.get("info", None) if message["type"] == "http.response.debug" and info is not None: message = await recv_stream.receive() except anyio.EndOfStream: if app_exc is not None: raise app_exc raise RuntimeError("No response returned.") assert message["type"] == "http.response.start" async def body_stream() -> typing.AsyncGenerator[bytes, None]: async for message in recv_stream: assert message["type"] == "http.response.body" body = message.get("body", b"") if body: yield body if not message.get("more_body", False): break if app_exc is not None: raise app_exc response = _StreamingResponse(status_code=message["status"], content=body_stream(), info=info) response.raw_headers = message["headers"] return response > send_stream, recv_stream = anyio.create_memory_object_stream[Message]() E TypeError: 'function' object is not subscriptable starlette/middleware/base.py:175: TypeError ______ test_read_request_body_in_app_after_middleware_calls_body[asyncio] ______ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_read_request_body_in_app_after_middleware_calls_body( test_client_factory: TestClientFactory, ) -> None: async def homepage(request: Request) -> PlainTextResponse: assert await request.body() == b"a" return PlainTextResponse("Homepage") class ConsumingMiddleware(BaseHTTPMiddleware): async def dispatch( self, request: Request, call_next: RequestResponseEndpoint, ) -> Response: assert await request.body() == b"a" return await call_next(request) app = Starlette( routes=[Route("/", homepage, methods=["POST"])], middleware=[Middleware(ConsumingMiddleware)], ) client: TestClient = test_client_factory(app) > response = client.post("/", content=b"a") tests/middleware/test_base.py:652: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:529: in post return super().post( /usr/lib/python3.13/site-packages/httpx/_client.py:1157: in post return self.request( starlette/testclient.py:428: in request return super().request( /usr/lib/python3.13/site-packages/httpx/_client.py:837: in request return self.send(request, auth=auth, follow_redirects=follow_redirects) /usr/lib/python3.13/site-packages/httpx/_client.py:926: in send response = self._send_handling_auth( /usr/lib/python3.13/site-packages/httpx/_client.py:954: in _send_handling_auth response = self._send_handling_redirects( /usr/lib/python3.13/site-packages/httpx/_client.py:991: in _send_handling_redirects response = self._send_single_request(request) /usr/lib/python3.13/site-packages/httpx/_client.py:1027: in _send_single_request response = transport.handle_request(request) starlette/testclient.py:337: in handle_request raise exc starlette/testclient.py:334: in handle_request portal.call(self.app, scope, receive, send) /usr/lib/python3.13/site-packages/anyio/from_thread.py:277: in call return cast(T_Retval, self.start_task_soon(func, *args).result()) /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval starlette/applications.py:112: in __call__ await self.middleware_stack(scope, receive, send) starlette/middleware/errors.py:187: in __call__ raise exc starlette/middleware/errors.py:165: in __call__ await self.app(scope, receive, _send) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = .ConsumingMiddleware object at 0x7f25d9cd0ec0> scope = {'app': , 'client': ('testclient', 50000), 'extensions': {'...g', b'gzip, deflate'), (b'connection', b'keep-alive'), (b'user-agent', b'testclient'), (b'content-length', b'1')], ...} receive = .receive at 0x7f25d97276a0> send = ._send at 0x7f25d9727420> async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: if scope["type"] != "http": await self.app(scope, receive, send) return request = _CachedRequest(scope, receive) wrapped_receive = request.wrapped_receive response_sent = anyio.Event() async def call_next(request: Request) -> Response: app_exc: Exception | None = None async def receive_or_disconnect() -> Message: if response_sent.is_set(): return {"type": "http.disconnect"} async with anyio.create_task_group() as task_group: async def wrap(func: typing.Callable[[], typing.Awaitable[T]]) -> T: result = await func() task_group.cancel_scope.cancel() return result task_group.start_soon(wrap, response_sent.wait) message = await wrap(wrapped_receive) if response_sent.is_set(): return {"type": "http.disconnect"} return message async def send_no_error(message: Message) -> None: try: await send_stream.send(message) except anyio.BrokenResourceError: # recv_stream has been closed, i.e. response_sent has been set. return async def coro() -> None: nonlocal app_exc with send_stream: try: await self.app(scope, receive_or_disconnect, send_no_error) except Exception as exc: app_exc = exc task_group.start_soon(coro) try: message = await recv_stream.receive() info = message.get("info", None) if message["type"] == "http.response.debug" and info is not None: message = await recv_stream.receive() except anyio.EndOfStream: if app_exc is not None: raise app_exc raise RuntimeError("No response returned.") assert message["type"] == "http.response.start" async def body_stream() -> typing.AsyncGenerator[bytes, None]: async for message in recv_stream: assert message["type"] == "http.response.body" body = message.get("body", b"") if body: yield body if not message.get("more_body", False): break if app_exc is not None: raise app_exc response = _StreamingResponse(status_code=message["status"], content=body_stream(), info=info) response.raw_headers = message["headers"] return response > send_stream, recv_stream = anyio.create_memory_object_stream[Message]() E TypeError: 'function' object is not subscriptable starlette/middleware/base.py:175: TypeError _______ test_read_request_body_in_app_after_middleware_calls_body[trio] ________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_read_request_body_in_app_after_middleware_calls_body( test_client_factory: TestClientFactory, ) -> None: async def homepage(request: Request) -> PlainTextResponse: assert await request.body() == b"a" return PlainTextResponse("Homepage") class ConsumingMiddleware(BaseHTTPMiddleware): async def dispatch( self, request: Request, call_next: RequestResponseEndpoint, ) -> Response: assert await request.body() == b"a" return await call_next(request) app = Starlette( routes=[Route("/", homepage, methods=["POST"])], middleware=[Middleware(ConsumingMiddleware)], ) client: TestClient = test_client_factory(app) > response = client.post("/", content=b"a") tests/middleware/test_base.py:652: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:529: in post return super().post( /usr/lib/python3.13/site-packages/httpx/_client.py:1157: in post return self.request( starlette/testclient.py:428: in request return super().request( /usr/lib/python3.13/site-packages/httpx/_client.py:837: in request return self.send(request, auth=auth, follow_redirects=follow_redirects) /usr/lib/python3.13/site-packages/httpx/_client.py:926: in send response = self._send_handling_auth( /usr/lib/python3.13/site-packages/httpx/_client.py:954: in _send_handling_auth response = self._send_handling_redirects( /usr/lib/python3.13/site-packages/httpx/_client.py:991: in _send_handling_redirects response = self._send_single_request(request) /usr/lib/python3.13/site-packages/httpx/_client.py:1027: in _send_single_request response = transport.handle_request(request) starlette/testclient.py:337: in handle_request raise exc starlette/testclient.py:334: in handle_request portal.call(self.app, scope, receive, send) /usr/lib/python3.13/site-packages/anyio/from_thread.py:277: in call return cast(T_Retval, self.start_task_soon(func, *args).result()) /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval starlette/applications.py:112: in __call__ await self.middleware_stack(scope, receive, send) starlette/middleware/errors.py:187: in __call__ raise exc starlette/middleware/errors.py:165: in __call__ await self.app(scope, receive, _send) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = .ConsumingMiddleware object at 0x7f25d9cd2510> scope = {'app': , 'client': ('testclient', 50000), 'extensions': {'...g', b'gzip, deflate'), (b'connection', b'keep-alive'), (b'user-agent', b'testclient'), (b'content-length', b'1')], ...} receive = .receive at 0x7f25d97262a0> send = ._send at 0x7f25d96e02c0> async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: if scope["type"] != "http": await self.app(scope, receive, send) return request = _CachedRequest(scope, receive) wrapped_receive = request.wrapped_receive response_sent = anyio.Event() async def call_next(request: Request) -> Response: app_exc: Exception | None = None async def receive_or_disconnect() -> Message: if response_sent.is_set(): return {"type": "http.disconnect"} async with anyio.create_task_group() as task_group: async def wrap(func: typing.Callable[[], typing.Awaitable[T]]) -> T: result = await func() task_group.cancel_scope.cancel() return result task_group.start_soon(wrap, response_sent.wait) message = await wrap(wrapped_receive) if response_sent.is_set(): return {"type": "http.disconnect"} return message async def send_no_error(message: Message) -> None: try: await send_stream.send(message) except anyio.BrokenResourceError: # recv_stream has been closed, i.e. response_sent has been set. return async def coro() -> None: nonlocal app_exc with send_stream: try: await self.app(scope, receive_or_disconnect, send_no_error) except Exception as exc: app_exc = exc task_group.start_soon(coro) try: message = await recv_stream.receive() info = message.get("info", None) if message["type"] == "http.response.debug" and info is not None: message = await recv_stream.receive() except anyio.EndOfStream: if app_exc is not None: raise app_exc raise RuntimeError("No response returned.") assert message["type"] == "http.response.start" async def body_stream() -> typing.AsyncGenerator[bytes, None]: async for message in recv_stream: assert message["type"] == "http.response.body" body = message.get("body", b"") if body: yield body if not message.get("more_body", False): break if app_exc is not None: raise app_exc response = _StreamingResponse(status_code=message["status"], content=body_stream(), info=info) response.raw_headers = message["headers"] return response > send_stream, recv_stream = anyio.create_memory_object_stream[Message]() E TypeError: 'function' object is not subscriptable starlette/middleware/base.py:175: TypeError _____ test_read_request_stream_in_dispatch_after_app_calls_stream[asyncio] _____ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_read_request_stream_in_dispatch_after_app_calls_stream( test_client_factory: TestClientFactory, ) -> None: async def homepage(request: Request) -> PlainTextResponse: expected = [b"a", b""] async for chunk in request.stream(): assert chunk == expected.pop(0) assert expected == [] return PlainTextResponse("Homepage") class ConsumingMiddleware(BaseHTTPMiddleware): async def dispatch( self, request: Request, call_next: RequestResponseEndpoint, ) -> Response: resp = await call_next(request) with pytest.raises(RuntimeError, match="Stream consumed"): async for _ in request.stream(): raise AssertionError("should not be called") # pragma: no cover return resp app = Starlette( routes=[Route("/", homepage, methods=["POST"])], middleware=[Middleware(ConsumingMiddleware)], ) client: TestClient = test_client_factory(app) > response = client.post("/", content=b"a") tests/middleware/test_base.py:684: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:529: in post return super().post( /usr/lib/python3.13/site-packages/httpx/_client.py:1157: in post return self.request( starlette/testclient.py:428: in request return super().request( /usr/lib/python3.13/site-packages/httpx/_client.py:837: in request return self.send(request, auth=auth, follow_redirects=follow_redirects) /usr/lib/python3.13/site-packages/httpx/_client.py:926: in send response = self._send_handling_auth( /usr/lib/python3.13/site-packages/httpx/_client.py:954: in _send_handling_auth response = self._send_handling_redirects( /usr/lib/python3.13/site-packages/httpx/_client.py:991: in _send_handling_redirects response = self._send_single_request(request) /usr/lib/python3.13/site-packages/httpx/_client.py:1027: in _send_single_request response = transport.handle_request(request) starlette/testclient.py:337: in handle_request raise exc starlette/testclient.py:334: in handle_request portal.call(self.app, scope, receive, send) /usr/lib/python3.13/site-packages/anyio/from_thread.py:277: in call return cast(T_Retval, self.start_task_soon(func, *args).result()) /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval starlette/applications.py:112: in __call__ await self.middleware_stack(scope, receive, send) starlette/middleware/errors.py:187: in __call__ raise exc starlette/middleware/errors.py:165: in __call__ await self.app(scope, receive, _send) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = .ConsumingMiddleware object at 0x7f25d9cd2ba0> scope = {'app': , 'client': ('testclient', 50000), 'extensions': {'...g', b'gzip, deflate'), (b'connection', b'keep-alive'), (b'user-agent', b'testclient'), (b'content-length', b'1')], ...} receive = .receive at 0x7f25d9724540> send = ._send at 0x7f25d96e0ae0> async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: if scope["type"] != "http": await self.app(scope, receive, send) return request = _CachedRequest(scope, receive) wrapped_receive = request.wrapped_receive response_sent = anyio.Event() async def call_next(request: Request) -> Response: app_exc: Exception | None = None async def receive_or_disconnect() -> Message: if response_sent.is_set(): return {"type": "http.disconnect"} async with anyio.create_task_group() as task_group: async def wrap(func: typing.Callable[[], typing.Awaitable[T]]) -> T: result = await func() task_group.cancel_scope.cancel() return result task_group.start_soon(wrap, response_sent.wait) message = await wrap(wrapped_receive) if response_sent.is_set(): return {"type": "http.disconnect"} return message async def send_no_error(message: Message) -> None: try: await send_stream.send(message) except anyio.BrokenResourceError: # recv_stream has been closed, i.e. response_sent has been set. return async def coro() -> None: nonlocal app_exc with send_stream: try: await self.app(scope, receive_or_disconnect, send_no_error) except Exception as exc: app_exc = exc task_group.start_soon(coro) try: message = await recv_stream.receive() info = message.get("info", None) if message["type"] == "http.response.debug" and info is not None: message = await recv_stream.receive() except anyio.EndOfStream: if app_exc is not None: raise app_exc raise RuntimeError("No response returned.") assert message["type"] == "http.response.start" async def body_stream() -> typing.AsyncGenerator[bytes, None]: async for message in recv_stream: assert message["type"] == "http.response.body" body = message.get("body", b"") if body: yield body if not message.get("more_body", False): break if app_exc is not None: raise app_exc response = _StreamingResponse(status_code=message["status"], content=body_stream(), info=info) response.raw_headers = message["headers"] return response > send_stream, recv_stream = anyio.create_memory_object_stream[Message]() E TypeError: 'function' object is not subscriptable starlette/middleware/base.py:175: TypeError ______ test_read_request_stream_in_dispatch_after_app_calls_stream[trio] _______ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_read_request_stream_in_dispatch_after_app_calls_stream( test_client_factory: TestClientFactory, ) -> None: async def homepage(request: Request) -> PlainTextResponse: expected = [b"a", b""] async for chunk in request.stream(): assert chunk == expected.pop(0) assert expected == [] return PlainTextResponse("Homepage") class ConsumingMiddleware(BaseHTTPMiddleware): async def dispatch( self, request: Request, call_next: RequestResponseEndpoint, ) -> Response: resp = await call_next(request) with pytest.raises(RuntimeError, match="Stream consumed"): async for _ in request.stream(): raise AssertionError("should not be called") # pragma: no cover return resp app = Starlette( routes=[Route("/", homepage, methods=["POST"])], middleware=[Middleware(ConsumingMiddleware)], ) client: TestClient = test_client_factory(app) > response = client.post("/", content=b"a") tests/middleware/test_base.py:684: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:529: in post return super().post( /usr/lib/python3.13/site-packages/httpx/_client.py:1157: in post return self.request( starlette/testclient.py:428: in request return super().request( /usr/lib/python3.13/site-packages/httpx/_client.py:837: in request return self.send(request, auth=auth, follow_redirects=follow_redirects) /usr/lib/python3.13/site-packages/httpx/_client.py:926: in send response = self._send_handling_auth( /usr/lib/python3.13/site-packages/httpx/_client.py:954: in _send_handling_auth response = self._send_handling_redirects( /usr/lib/python3.13/site-packages/httpx/_client.py:991: in _send_handling_redirects response = self._send_single_request(request) /usr/lib/python3.13/site-packages/httpx/_client.py:1027: in _send_single_request response = transport.handle_request(request) starlette/testclient.py:337: in handle_request raise exc starlette/testclient.py:334: in handle_request portal.call(self.app, scope, receive, send) /usr/lib/python3.13/site-packages/anyio/from_thread.py:277: in call return cast(T_Retval, self.start_task_soon(func, *args).result()) /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval starlette/applications.py:112: in __call__ await self.middleware_stack(scope, receive, send) starlette/middleware/errors.py:187: in __call__ raise exc starlette/middleware/errors.py:165: in __call__ await self.app(scope, receive, _send) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = .ConsumingMiddleware object at 0x7f25d9cd2660> scope = {'app': , 'client': ('testclient', 50000), 'extensions': {'...g', b'gzip, deflate'), (b'connection', b'keep-alive'), (b'user-agent', b'testclient'), (b'content-length', b'1')], ...} receive = .receive at 0x7f25d96e1260> send = ._send at 0x7f25d96e1f80> async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: if scope["type"] != "http": await self.app(scope, receive, send) return request = _CachedRequest(scope, receive) wrapped_receive = request.wrapped_receive response_sent = anyio.Event() async def call_next(request: Request) -> Response: app_exc: Exception | None = None async def receive_or_disconnect() -> Message: if response_sent.is_set(): return {"type": "http.disconnect"} async with anyio.create_task_group() as task_group: async def wrap(func: typing.Callable[[], typing.Awaitable[T]]) -> T: result = await func() task_group.cancel_scope.cancel() return result task_group.start_soon(wrap, response_sent.wait) message = await wrap(wrapped_receive) if response_sent.is_set(): return {"type": "http.disconnect"} return message async def send_no_error(message: Message) -> None: try: await send_stream.send(message) except anyio.BrokenResourceError: # recv_stream has been closed, i.e. response_sent has been set. return async def coro() -> None: nonlocal app_exc with send_stream: try: await self.app(scope, receive_or_disconnect, send_no_error) except Exception as exc: app_exc = exc task_group.start_soon(coro) try: message = await recv_stream.receive() info = message.get("info", None) if message["type"] == "http.response.debug" and info is not None: message = await recv_stream.receive() except anyio.EndOfStream: if app_exc is not None: raise app_exc raise RuntimeError("No response returned.") assert message["type"] == "http.response.start" async def body_stream() -> typing.AsyncGenerator[bytes, None]: async for message in recv_stream: assert message["type"] == "http.response.body" body = message.get("body", b"") if body: yield body if not message.get("more_body", False): break if app_exc is not None: raise app_exc response = _StreamingResponse(status_code=message["status"], content=body_stream(), info=info) response.raw_headers = message["headers"] return response > send_stream, recv_stream = anyio.create_memory_object_stream[Message]() E TypeError: 'function' object is not subscriptable starlette/middleware/base.py:175: TypeError ______ test_read_request_stream_in_dispatch_after_app_calls_body[asyncio] ______ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_read_request_stream_in_dispatch_after_app_calls_body( test_client_factory: TestClientFactory, ) -> None: async def homepage(request: Request) -> PlainTextResponse: assert await request.body() == b"a" return PlainTextResponse("Homepage") class ConsumingMiddleware(BaseHTTPMiddleware): async def dispatch( self, request: Request, call_next: RequestResponseEndpoint, ) -> Response: resp = await call_next(request) with pytest.raises(RuntimeError, match="Stream consumed"): async for _ in request.stream(): raise AssertionError("should not be called") # pragma: no cover return resp app = Starlette( routes=[Route("/", homepage, methods=["POST"])], middleware=[Middleware(ConsumingMiddleware)], ) client: TestClient = test_client_factory(app) > response = client.post("/", content=b"a") tests/middleware/test_base.py:713: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:529: in post return super().post( /usr/lib/python3.13/site-packages/httpx/_client.py:1157: in post return self.request( starlette/testclient.py:428: in request return super().request( /usr/lib/python3.13/site-packages/httpx/_client.py:837: in request return self.send(request, auth=auth, follow_redirects=follow_redirects) /usr/lib/python3.13/site-packages/httpx/_client.py:926: in send response = self._send_handling_auth( /usr/lib/python3.13/site-packages/httpx/_client.py:954: in _send_handling_auth response = self._send_handling_redirects( /usr/lib/python3.13/site-packages/httpx/_client.py:991: in _send_handling_redirects response = self._send_single_request(request) /usr/lib/python3.13/site-packages/httpx/_client.py:1027: in _send_single_request response = transport.handle_request(request) starlette/testclient.py:337: in handle_request raise exc starlette/testclient.py:334: in handle_request portal.call(self.app, scope, receive, send) /usr/lib/python3.13/site-packages/anyio/from_thread.py:277: in call return cast(T_Retval, self.start_task_soon(func, *args).result()) /usr/lib64/python3.13/concurrent/futures/_base.py:456: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval starlette/applications.py:112: in __call__ await self.middleware_stack(scope, receive, send) starlette/middleware/errors.py:187: in __call__ raise exc starlette/middleware/errors.py:165: in __call__ await self.app(scope, receive, _send) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = .ConsumingMiddleware object at 0x7f25d9cd2cf0> scope = {'app': , 'client': ('testclient', 50000), 'extensions': {'...g', b'gzip, deflate'), (b'connection', b'keep-alive'), (b'user-agent', b'testclient'), (b'content-length', b'1')], ...} receive = .receive at 0x7f25d96e05e0> send = ._send at 0x7f25d96e0a40> async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: if scope["type"] != "http": await self.app(scope, receive, send) return request = _CachedRequest(scope, receive) wrapped_receive = request.wrapped_receive response_sent = anyio.Event() async def call_next(request: Request) -> Response: app_exc: Exception | None = None async def receive_or_disconnect() -> Message: if response_sent.is_set(): return {"type": "http.disconnect"} async with anyio.create_task_group() as task_group: async def wrap(func: typing.Callable[[], typing.Awaitable[T]]) -> T: result = await func() task_group.cancel_scope.cancel() return result task_group.start_soon(wrap, response_sent.wait) message = await wrap(wrapped_receive) if response_sent.is_set(): return {"type": "http.disconnect"} return message async def send_no_error(message: Message) -> None: try: await send_stream.send(message) except anyio.BrokenResourceError: # recv_stream has been closed, i.e. response_sent has been set. return async def coro() -> None: nonlocal app_exc with send_stream: try: await self.app(scope, receive_or_disconnect, send_no_error) except Exception as exc: app_exc = exc task_group.start_soon(coro) try: message = await recv_stream.receive() info = message.get("info", None) if message["type"] == "http.response.debug" and info is not None: message = await recv_stream.receive() except anyio.EndOfStream: if app_exc is not None: raise app_exc raise RuntimeError("No response returned.") assert message["type"] == "http.response.start" async def body_stream() -> typing.AsyncGenerator[bytes, None]: async for message in recv_stream: assert message["type"] == "http.response.body" body = message.get("body", b"") if body: yield body if not message.get("more_body", False): break if app_exc is not None: raise app_exc response = _StreamingResponse(status_code=message["status"], content=body_stream(), info=info) response.raw_headers = message["headers"] return response > send_stream, recv_stream = anyio.create_memory_object_stream[Message]() E TypeError: 'function' object is not subscriptable starlette/middleware/base.py:175: TypeError _______ test_read_request_stream_in_dispatch_after_app_calls_body[trio] ________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_read_request_stream_in_dispatch_after_app_calls_body( test_client_factory: TestClientFactory, ) -> None: async def homepage(request: Request) -> PlainTextResponse: assert await request.body() == b"a" return PlainTextResponse("Homepage") class ConsumingMiddleware(BaseHTTPMiddleware): async def dispatch( self, request: Request, call_next: RequestResponseEndpoint, ) -> Response: resp = await call_next(request) with pytest.raises(RuntimeError, match="Stream consumed"): async for _ in request.stream(): raise AssertionError("should not be called") # pragma: no cover return resp app = Starlette( routes=[Route("/", homepage, methods=["POST"])], middleware=[Middleware(ConsumingMiddleware)], ) client: TestClient = test_client_factory(app) > response = client.post("/", content=b"a") tests/middleware/test_base.py:713: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:529: in post return super().post( /usr/lib/python3.13/site-packages/httpx/_client.py:1157: in post return self.request( starlette/testclient.py:428: in request return super().request( /usr/lib/python3.13/site-packages/httpx/_client.py:837: in request return self.send(request, auth=auth, follow_redirects=follow_redirects) /usr/lib/python3.13/site-packages/httpx/_client.py:926: in send response = self._send_handling_auth( /usr/lib/python3.13/site-packages/httpx/_client.py:954: in _send_handling_auth response = self._send_handling_redirects( /usr/lib/python3.13/site-packages/httpx/_client.py:991: in _send_handling_redirects response = self._send_single_request(request) /usr/lib/python3.13/site-packages/httpx/_client.py:1027: in _send_single_request response = transport.handle_request(request) starlette/testclient.py:337: in handle_request raise exc starlette/testclient.py:334: in handle_request portal.call(self.app, scope, receive, send) /usr/lib/python3.13/site-packages/anyio/from_thread.py:277: in call return cast(T_Retval, self.start_task_soon(func, *args).result()) /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval starlette/applications.py:112: in __call__ await self.middleware_stack(scope, receive, send) starlette/middleware/errors.py:187: in __call__ raise exc starlette/middleware/errors.py:165: in __call__ await self.app(scope, receive, _send) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = .ConsumingMiddleware object at 0x7f25d9cd1be0> scope = {'app': , 'client': ('testclient', 50000), 'extensions': {'...g', b'gzip, deflate'), (b'connection', b'keep-alive'), (b'user-agent', b'testclient'), (b'content-length', b'1')], ...} receive = .receive at 0x7f25d96e0540> send = ._send at 0x7f25d96e3100> async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: if scope["type"] != "http": await self.app(scope, receive, send) return request = _CachedRequest(scope, receive) wrapped_receive = request.wrapped_receive response_sent = anyio.Event() async def call_next(request: Request) -> Response: app_exc: Exception | None = None async def receive_or_disconnect() -> Message: if response_sent.is_set(): return {"type": "http.disconnect"} async with anyio.create_task_group() as task_group: async def wrap(func: typing.Callable[[], typing.Awaitable[T]]) -> T: result = await func() task_group.cancel_scope.cancel() return result task_group.start_soon(wrap, response_sent.wait) message = await wrap(wrapped_receive) if response_sent.is_set(): return {"type": "http.disconnect"} return message async def send_no_error(message: Message) -> None: try: await send_stream.send(message) except anyio.BrokenResourceError: # recv_stream has been closed, i.e. response_sent has been set. return async def coro() -> None: nonlocal app_exc with send_stream: try: await self.app(scope, receive_or_disconnect, send_no_error) except Exception as exc: app_exc = exc task_group.start_soon(coro) try: message = await recv_stream.receive() info = message.get("info", None) if message["type"] == "http.response.debug" and info is not None: message = await recv_stream.receive() except anyio.EndOfStream: if app_exc is not None: raise app_exc raise RuntimeError("No response returned.") assert message["type"] == "http.response.start" async def body_stream() -> typing.AsyncGenerator[bytes, None]: async for message in recv_stream: assert message["type"] == "http.response.body" body = message.get("body", b"") if body: yield body if not message.get("more_body", False): break if app_exc is not None: raise app_exc response = _StreamingResponse(status_code=message["status"], content=body_stream(), info=info) response.raw_headers = message["headers"] return response > send_stream, recv_stream = anyio.create_memory_object_stream[Message]() E TypeError: 'function' object is not subscriptable starlette/middleware/base.py:175: TypeError ____ test_read_request_stream_in_dispatch_wrapping_app_calls_body[asyncio] _____ @pytest.mark.anyio async def test_read_request_stream_in_dispatch_wrapping_app_calls_body() -> None: async def endpoint(scope: Scope, receive: Receive, send: Send) -> None: request = Request(scope, receive) async for chunk in request.stream(): # pragma: no branch assert chunk == b"2" break await Response()(scope, receive, send) class ConsumingMiddleware(BaseHTTPMiddleware): async def dispatch( self, request: Request, call_next: RequestResponseEndpoint, ) -> Response: expected = b"1" response: Response | None = None async for chunk in request.stream(): # pragma: no branch assert chunk == expected if expected == b"1": response = await call_next(request) expected = b"3" else: break assert response is not None return response async def rcv() -> AsyncGenerator[Message, None]: yield {"type": "http.request", "body": b"1", "more_body": True} yield {"type": "http.request", "body": b"2", "more_body": True} yield {"type": "http.request", "body": b"3"} raise AssertionError( # pragma: no cover "Should not be called, no need to poll for disconnect" ) sent: list[Message] = [] async def send(msg: Message) -> None: sent.append(msg) app: ASGIApp = endpoint app = ConsumingMiddleware(app) rcv_stream = rcv() > await app({"type": "http"}, rcv_stream.__anext__, send) tests/middleware/test_base.py:762: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = .ConsumingMiddleware object at 0x7f25d9cd2ba0> scope = {'type': 'http'} receive = send = .send at 0x7f25d96e3a60> async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: if scope["type"] != "http": await self.app(scope, receive, send) return request = _CachedRequest(scope, receive) wrapped_receive = request.wrapped_receive response_sent = anyio.Event() async def call_next(request: Request) -> Response: app_exc: Exception | None = None async def receive_or_disconnect() -> Message: if response_sent.is_set(): return {"type": "http.disconnect"} async with anyio.create_task_group() as task_group: async def wrap(func: typing.Callable[[], typing.Awaitable[T]]) -> T: result = await func() task_group.cancel_scope.cancel() return result task_group.start_soon(wrap, response_sent.wait) message = await wrap(wrapped_receive) if response_sent.is_set(): return {"type": "http.disconnect"} return message async def send_no_error(message: Message) -> None: try: await send_stream.send(message) except anyio.BrokenResourceError: # recv_stream has been closed, i.e. response_sent has been set. return async def coro() -> None: nonlocal app_exc with send_stream: try: await self.app(scope, receive_or_disconnect, send_no_error) except Exception as exc: app_exc = exc task_group.start_soon(coro) try: message = await recv_stream.receive() info = message.get("info", None) if message["type"] == "http.response.debug" and info is not None: message = await recv_stream.receive() except anyio.EndOfStream: if app_exc is not None: raise app_exc raise RuntimeError("No response returned.") assert message["type"] == "http.response.start" async def body_stream() -> typing.AsyncGenerator[bytes, None]: async for message in recv_stream: assert message["type"] == "http.response.body" body = message.get("body", b"") if body: yield body if not message.get("more_body", False): break if app_exc is not None: raise app_exc response = _StreamingResponse(status_code=message["status"], content=body_stream(), info=info) response.raw_headers = message["headers"] return response > send_stream, recv_stream = anyio.create_memory_object_stream[Message]() E TypeError: 'function' object is not subscriptable starlette/middleware/base.py:175: TypeError ______ test_read_request_stream_in_dispatch_wrapping_app_calls_body[trio] ______ @pytest.mark.anyio async def test_read_request_stream_in_dispatch_wrapping_app_calls_body() -> None: async def endpoint(scope: Scope, receive: Receive, send: Send) -> None: request = Request(scope, receive) async for chunk in request.stream(): # pragma: no branch assert chunk == b"2" break await Response()(scope, receive, send) class ConsumingMiddleware(BaseHTTPMiddleware): async def dispatch( self, request: Request, call_next: RequestResponseEndpoint, ) -> Response: expected = b"1" response: Response | None = None async for chunk in request.stream(): # pragma: no branch assert chunk == expected if expected == b"1": response = await call_next(request) expected = b"3" else: break assert response is not None return response async def rcv() -> AsyncGenerator[Message, None]: yield {"type": "http.request", "body": b"1", "more_body": True} yield {"type": "http.request", "body": b"2", "more_body": True} yield {"type": "http.request", "body": b"3"} raise AssertionError( # pragma: no cover "Should not be called, no need to poll for disconnect" ) sent: list[Message] = [] async def send(msg: Message) -> None: sent.append(msg) app: ASGIApp = endpoint app = ConsumingMiddleware(app) rcv_stream = rcv() > await app({"type": "http"}, rcv_stream.__anext__, send) tests/middleware/test_base.py:762: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = .ConsumingMiddleware object at 0x7f25d9cd2cf0> scope = {'type': 'http'} receive = send = .send at 0x7f25d96e1120> async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: if scope["type"] != "http": await self.app(scope, receive, send) return request = _CachedRequest(scope, receive) wrapped_receive = request.wrapped_receive response_sent = anyio.Event() async def call_next(request: Request) -> Response: app_exc: Exception | None = None async def receive_or_disconnect() -> Message: if response_sent.is_set(): return {"type": "http.disconnect"} async with anyio.create_task_group() as task_group: async def wrap(func: typing.Callable[[], typing.Awaitable[T]]) -> T: result = await func() task_group.cancel_scope.cancel() return result task_group.start_soon(wrap, response_sent.wait) message = await wrap(wrapped_receive) if response_sent.is_set(): return {"type": "http.disconnect"} return message async def send_no_error(message: Message) -> None: try: await send_stream.send(message) except anyio.BrokenResourceError: # recv_stream has been closed, i.e. response_sent has been set. return async def coro() -> None: nonlocal app_exc with send_stream: try: await self.app(scope, receive_or_disconnect, send_no_error) except Exception as exc: app_exc = exc task_group.start_soon(coro) try: message = await recv_stream.receive() info = message.get("info", None) if message["type"] == "http.response.debug" and info is not None: message = await recv_stream.receive() except anyio.EndOfStream: if app_exc is not None: raise app_exc raise RuntimeError("No response returned.") assert message["type"] == "http.response.start" async def body_stream() -> typing.AsyncGenerator[bytes, None]: async for message in recv_stream: assert message["type"] == "http.response.body" body = message.get("body", b"") if body: yield body if not message.get("more_body", False): break if app_exc is not None: raise app_exc response = _StreamingResponse(status_code=message["status"], content=body_stream(), info=info) response.raw_headers = message["headers"] return response > send_stream, recv_stream = anyio.create_memory_object_stream[Message]() E TypeError: 'function' object is not subscriptable starlette/middleware/base.py:175: TypeError _ test_read_request_stream_in_dispatch_after_app_calls_body_with_middleware_calling_body_before_call_next[asyncio] _ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_read_request_stream_in_dispatch_after_app_calls_body_with_middleware_calling_body_before_call_next( test_client_factory: TestClientFactory, ) -> None: async def homepage(request: Request) -> PlainTextResponse: assert await request.body() == b"a" return PlainTextResponse("Homepage") class ConsumingMiddleware(BaseHTTPMiddleware): async def dispatch( self, request: Request, call_next: RequestResponseEndpoint, ) -> Response: assert await request.body() == b"a" # this buffers the request body in memory resp = await call_next(request) async for chunk in request.stream(): if chunk: assert chunk == b"a" return resp app = Starlette( routes=[Route("/", homepage, methods=["POST"])], middleware=[Middleware(ConsumingMiddleware)], ) client: TestClient = test_client_factory(app) > response = client.post("/", content=b"a") tests/middleware/test_base.py:802: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:529: in post return super().post( /usr/lib/python3.13/site-packages/httpx/_client.py:1157: in post return self.request( starlette/testclient.py:428: in request return super().request( /usr/lib/python3.13/site-packages/httpx/_client.py:837: in request return self.send(request, auth=auth, follow_redirects=follow_redirects) /usr/lib/python3.13/site-packages/httpx/_client.py:926: in send response = self._send_handling_auth( /usr/lib/python3.13/site-packages/httpx/_client.py:954: in _send_handling_auth response = self._send_handling_redirects( /usr/lib/python3.13/site-packages/httpx/_client.py:991: in _send_handling_redirects response = self._send_single_request(request) /usr/lib/python3.13/site-packages/httpx/_client.py:1027: in _send_single_request response = transport.handle_request(request) starlette/testclient.py:337: in handle_request raise exc starlette/testclient.py:334: in handle_request portal.call(self.app, scope, receive, send) /usr/lib/python3.13/site-packages/anyio/from_thread.py:277: in call return cast(T_Retval, self.start_task_soon(func, *args).result()) /usr/lib64/python3.13/concurrent/futures/_base.py:456: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval starlette/applications.py:112: in __call__ await self.middleware_stack(scope, receive, send) starlette/middleware/errors.py:187: in __call__ raise exc starlette/middleware/errors.py:165: in __call__ await self.app(scope, receive, _send) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = .ConsumingMiddleware object at 0x7f25d9854830> scope = {'app': , 'client': ('testclient', 50000), 'extensions': {'...g', b'gzip, deflate'), (b'connection', b'keep-alive'), (b'user-agent', b'testclient'), (b'content-length', b'1')], ...} receive = .receive at 0x7f25d96e3ba0> send = ._send at 0x7f25d8a10180> async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: if scope["type"] != "http": await self.app(scope, receive, send) return request = _CachedRequest(scope, receive) wrapped_receive = request.wrapped_receive response_sent = anyio.Event() async def call_next(request: Request) -> Response: app_exc: Exception | None = None async def receive_or_disconnect() -> Message: if response_sent.is_set(): return {"type": "http.disconnect"} async with anyio.create_task_group() as task_group: async def wrap(func: typing.Callable[[], typing.Awaitable[T]]) -> T: result = await func() task_group.cancel_scope.cancel() return result task_group.start_soon(wrap, response_sent.wait) message = await wrap(wrapped_receive) if response_sent.is_set(): return {"type": "http.disconnect"} return message async def send_no_error(message: Message) -> None: try: await send_stream.send(message) except anyio.BrokenResourceError: # recv_stream has been closed, i.e. response_sent has been set. return async def coro() -> None: nonlocal app_exc with send_stream: try: await self.app(scope, receive_or_disconnect, send_no_error) except Exception as exc: app_exc = exc task_group.start_soon(coro) try: message = await recv_stream.receive() info = message.get("info", None) if message["type"] == "http.response.debug" and info is not None: message = await recv_stream.receive() except anyio.EndOfStream: if app_exc is not None: raise app_exc raise RuntimeError("No response returned.") assert message["type"] == "http.response.start" async def body_stream() -> typing.AsyncGenerator[bytes, None]: async for message in recv_stream: assert message["type"] == "http.response.body" body = message.get("body", b"") if body: yield body if not message.get("more_body", False): break if app_exc is not None: raise app_exc response = _StreamingResponse(status_code=message["status"], content=body_stream(), info=info) response.raw_headers = message["headers"] return response > send_stream, recv_stream = anyio.create_memory_object_stream[Message]() E TypeError: 'function' object is not subscriptable starlette/middleware/base.py:175: TypeError _ test_read_request_stream_in_dispatch_after_app_calls_body_with_middleware_calling_body_before_call_next[trio] _ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_read_request_stream_in_dispatch_after_app_calls_body_with_middleware_calling_body_before_call_next( test_client_factory: TestClientFactory, ) -> None: async def homepage(request: Request) -> PlainTextResponse: assert await request.body() == b"a" return PlainTextResponse("Homepage") class ConsumingMiddleware(BaseHTTPMiddleware): async def dispatch( self, request: Request, call_next: RequestResponseEndpoint, ) -> Response: assert await request.body() == b"a" # this buffers the request body in memory resp = await call_next(request) async for chunk in request.stream(): if chunk: assert chunk == b"a" return resp app = Starlette( routes=[Route("/", homepage, methods=["POST"])], middleware=[Middleware(ConsumingMiddleware)], ) client: TestClient = test_client_factory(app) > response = client.post("/", content=b"a") tests/middleware/test_base.py:802: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:529: in post return super().post( /usr/lib/python3.13/site-packages/httpx/_client.py:1157: in post return self.request( starlette/testclient.py:428: in request return super().request( /usr/lib/python3.13/site-packages/httpx/_client.py:837: in request return self.send(request, auth=auth, follow_redirects=follow_redirects) /usr/lib/python3.13/site-packages/httpx/_client.py:926: in send response = self._send_handling_auth( /usr/lib/python3.13/site-packages/httpx/_client.py:954: in _send_handling_auth response = self._send_handling_redirects( /usr/lib/python3.13/site-packages/httpx/_client.py:991: in _send_handling_redirects response = self._send_single_request(request) /usr/lib/python3.13/site-packages/httpx/_client.py:1027: in _send_single_request response = transport.handle_request(request) starlette/testclient.py:337: in handle_request raise exc starlette/testclient.py:334: in handle_request portal.call(self.app, scope, receive, send) /usr/lib/python3.13/site-packages/anyio/from_thread.py:277: in call return cast(T_Retval, self.start_task_soon(func, *args).result()) /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval starlette/applications.py:112: in __call__ await self.middleware_stack(scope, receive, send) starlette/middleware/errors.py:187: in __call__ raise exc starlette/middleware/errors.py:165: in __call__ await self.app(scope, receive, _send) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = .ConsumingMiddleware object at 0x7f25da262510> scope = {'app': , 'client': ('testclient', 50000), 'extensions': {'...g', b'gzip, deflate'), (b'connection', b'keep-alive'), (b'user-agent', b'testclient'), (b'content-length', b'1')], ...} receive = .receive at 0x7f25d98cb380> send = ._send at 0x7f25d9727560> async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: if scope["type"] != "http": await self.app(scope, receive, send) return request = _CachedRequest(scope, receive) wrapped_receive = request.wrapped_receive response_sent = anyio.Event() async def call_next(request: Request) -> Response: app_exc: Exception | None = None async def receive_or_disconnect() -> Message: if response_sent.is_set(): return {"type": "http.disconnect"} async with anyio.create_task_group() as task_group: async def wrap(func: typing.Callable[[], typing.Awaitable[T]]) -> T: result = await func() task_group.cancel_scope.cancel() return result task_group.start_soon(wrap, response_sent.wait) message = await wrap(wrapped_receive) if response_sent.is_set(): return {"type": "http.disconnect"} return message async def send_no_error(message: Message) -> None: try: await send_stream.send(message) except anyio.BrokenResourceError: # recv_stream has been closed, i.e. response_sent has been set. return async def coro() -> None: nonlocal app_exc with send_stream: try: await self.app(scope, receive_or_disconnect, send_no_error) except Exception as exc: app_exc = exc task_group.start_soon(coro) try: message = await recv_stream.receive() info = message.get("info", None) if message["type"] == "http.response.debug" and info is not None: message = await recv_stream.receive() except anyio.EndOfStream: if app_exc is not None: raise app_exc raise RuntimeError("No response returned.") assert message["type"] == "http.response.start" async def body_stream() -> typing.AsyncGenerator[bytes, None]: async for message in recv_stream: assert message["type"] == "http.response.body" body = message.get("body", b"") if body: yield body if not message.get("more_body", False): break if app_exc is not None: raise app_exc response = _StreamingResponse(status_code=message["status"], content=body_stream(), info=info) response.raw_headers = message["headers"] return response > send_stream, recv_stream = anyio.create_memory_object_stream[Message]() E TypeError: 'function' object is not subscriptable starlette/middleware/base.py:175: TypeError _ test_read_request_body_in_dispatch_after_app_calls_body_with_middleware_calling_body_before_call_next[asyncio] _ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_read_request_body_in_dispatch_after_app_calls_body_with_middleware_calling_body_before_call_next( test_client_factory: TestClientFactory, ) -> None: async def homepage(request: Request) -> PlainTextResponse: assert await request.body() == b"a" return PlainTextResponse("Homepage") class ConsumingMiddleware(BaseHTTPMiddleware): async def dispatch( self, request: Request, call_next: RequestResponseEndpoint, ) -> Response: assert await request.body() == b"a" # this buffers the request body in memory resp = await call_next(request) assert await request.body() == b"a" # no problem here return resp app = Starlette( routes=[Route("/", homepage, methods=["POST"])], middleware=[Middleware(ConsumingMiddleware)], ) client: TestClient = test_client_factory(app) > response = client.post("/", content=b"a") tests/middleware/test_base.py:830: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:529: in post return super().post( /usr/lib/python3.13/site-packages/httpx/_client.py:1157: in post return self.request( starlette/testclient.py:428: in request return super().request( /usr/lib/python3.13/site-packages/httpx/_client.py:837: in request return self.send(request, auth=auth, follow_redirects=follow_redirects) /usr/lib/python3.13/site-packages/httpx/_client.py:926: in send response = self._send_handling_auth( /usr/lib/python3.13/site-packages/httpx/_client.py:954: in _send_handling_auth response = self._send_handling_redirects( /usr/lib/python3.13/site-packages/httpx/_client.py:991: in _send_handling_redirects response = self._send_single_request(request) /usr/lib/python3.13/site-packages/httpx/_client.py:1027: in _send_single_request response = transport.handle_request(request) starlette/testclient.py:337: in handle_request raise exc starlette/testclient.py:334: in handle_request portal.call(self.app, scope, receive, send) /usr/lib/python3.13/site-packages/anyio/from_thread.py:277: in call return cast(T_Retval, self.start_task_soon(func, *args).result()) /usr/lib64/python3.13/concurrent/futures/_base.py:456: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval starlette/applications.py:112: in __call__ await self.middleware_stack(scope, receive, send) starlette/middleware/errors.py:187: in __call__ raise exc starlette/middleware/errors.py:165: in __call__ await self.app(scope, receive, _send) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = .ConsumingMiddleware object at 0x7f25d9cd2510> scope = {'app': , 'client': ('testclient', 50000), 'extensions': {'...g', b'gzip, deflate'), (b'connection', b'keep-alive'), (b'user-agent', b'testclient'), (b'content-length', b'1')], ...} receive = .receive at 0x7f25d9725b20> send = ._send at 0x7f25d9727880> async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: if scope["type"] != "http": await self.app(scope, receive, send) return request = _CachedRequest(scope, receive) wrapped_receive = request.wrapped_receive response_sent = anyio.Event() async def call_next(request: Request) -> Response: app_exc: Exception | None = None async def receive_or_disconnect() -> Message: if response_sent.is_set(): return {"type": "http.disconnect"} async with anyio.create_task_group() as task_group: async def wrap(func: typing.Callable[[], typing.Awaitable[T]]) -> T: result = await func() task_group.cancel_scope.cancel() return result task_group.start_soon(wrap, response_sent.wait) message = await wrap(wrapped_receive) if response_sent.is_set(): return {"type": "http.disconnect"} return message async def send_no_error(message: Message) -> None: try: await send_stream.send(message) except anyio.BrokenResourceError: # recv_stream has been closed, i.e. response_sent has been set. return async def coro() -> None: nonlocal app_exc with send_stream: try: await self.app(scope, receive_or_disconnect, send_no_error) except Exception as exc: app_exc = exc task_group.start_soon(coro) try: message = await recv_stream.receive() info = message.get("info", None) if message["type"] == "http.response.debug" and info is not None: message = await recv_stream.receive() except anyio.EndOfStream: if app_exc is not None: raise app_exc raise RuntimeError("No response returned.") assert message["type"] == "http.response.start" async def body_stream() -> typing.AsyncGenerator[bytes, None]: async for message in recv_stream: assert message["type"] == "http.response.body" body = message.get("body", b"") if body: yield body if not message.get("more_body", False): break if app_exc is not None: raise app_exc response = _StreamingResponse(status_code=message["status"], content=body_stream(), info=info) response.raw_headers = message["headers"] return response > send_stream, recv_stream = anyio.create_memory_object_stream[Message]() E TypeError: 'function' object is not subscriptable starlette/middleware/base.py:175: TypeError _ test_read_request_body_in_dispatch_after_app_calls_body_with_middleware_calling_body_before_call_next[trio] _ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_read_request_body_in_dispatch_after_app_calls_body_with_middleware_calling_body_before_call_next( test_client_factory: TestClientFactory, ) -> None: async def homepage(request: Request) -> PlainTextResponse: assert await request.body() == b"a" return PlainTextResponse("Homepage") class ConsumingMiddleware(BaseHTTPMiddleware): async def dispatch( self, request: Request, call_next: RequestResponseEndpoint, ) -> Response: assert await request.body() == b"a" # this buffers the request body in memory resp = await call_next(request) assert await request.body() == b"a" # no problem here return resp app = Starlette( routes=[Route("/", homepage, methods=["POST"])], middleware=[Middleware(ConsumingMiddleware)], ) client: TestClient = test_client_factory(app) > response = client.post("/", content=b"a") tests/middleware/test_base.py:830: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:529: in post return super().post( /usr/lib/python3.13/site-packages/httpx/_client.py:1157: in post return self.request( starlette/testclient.py:428: in request return super().request( /usr/lib/python3.13/site-packages/httpx/_client.py:837: in request return self.send(request, auth=auth, follow_redirects=follow_redirects) /usr/lib/python3.13/site-packages/httpx/_client.py:926: in send response = self._send_handling_auth( /usr/lib/python3.13/site-packages/httpx/_client.py:954: in _send_handling_auth response = self._send_handling_redirects( /usr/lib/python3.13/site-packages/httpx/_client.py:991: in _send_handling_redirects response = self._send_single_request(request) /usr/lib/python3.13/site-packages/httpx/_client.py:1027: in _send_single_request response = transport.handle_request(request) starlette/testclient.py:337: in handle_request raise exc starlette/testclient.py:334: in handle_request portal.call(self.app, scope, receive, send) /usr/lib/python3.13/site-packages/anyio/from_thread.py:277: in call return cast(T_Retval, self.start_task_soon(func, *args).result()) /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval starlette/applications.py:112: in __call__ await self.middleware_stack(scope, receive, send) starlette/middleware/errors.py:187: in __call__ raise exc starlette/middleware/errors.py:165: in __call__ await self.app(scope, receive, _send) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = .ConsumingMiddleware object at 0x7f25da262510> scope = {'app': , 'client': ('testclient', 50000), 'extensions': {'...g', b'gzip, deflate'), (b'connection', b'keep-alive'), (b'user-agent', b'testclient'), (b'content-length', b'1')], ...} receive = .receive at 0x7f25d98cbce0> send = ._send at 0x7f25d9726980> async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: if scope["type"] != "http": await self.app(scope, receive, send) return request = _CachedRequest(scope, receive) wrapped_receive = request.wrapped_receive response_sent = anyio.Event() async def call_next(request: Request) -> Response: app_exc: Exception | None = None async def receive_or_disconnect() -> Message: if response_sent.is_set(): return {"type": "http.disconnect"} async with anyio.create_task_group() as task_group: async def wrap(func: typing.Callable[[], typing.Awaitable[T]]) -> T: result = await func() task_group.cancel_scope.cancel() return result task_group.start_soon(wrap, response_sent.wait) message = await wrap(wrapped_receive) if response_sent.is_set(): return {"type": "http.disconnect"} return message async def send_no_error(message: Message) -> None: try: await send_stream.send(message) except anyio.BrokenResourceError: # recv_stream has been closed, i.e. response_sent has been set. return async def coro() -> None: nonlocal app_exc with send_stream: try: await self.app(scope, receive_or_disconnect, send_no_error) except Exception as exc: app_exc = exc task_group.start_soon(coro) try: message = await recv_stream.receive() info = message.get("info", None) if message["type"] == "http.response.debug" and info is not None: message = await recv_stream.receive() except anyio.EndOfStream: if app_exc is not None: raise app_exc raise RuntimeError("No response returned.") assert message["type"] == "http.response.start" async def body_stream() -> typing.AsyncGenerator[bytes, None]: async for message in recv_stream: assert message["type"] == "http.response.body" body = message.get("body", b"") if body: yield body if not message.get("more_body", False): break if app_exc is not None: raise app_exc response = _StreamingResponse(status_code=message["status"], content=body_stream(), info=info) response.raw_headers = message["headers"] return response > send_stream, recv_stream = anyio.create_memory_object_stream[Message]() E TypeError: 'function' object is not subscriptable starlette/middleware/base.py:175: TypeError ________________ test_read_request_disconnected_client[asyncio] ________________ @pytest.mark.anyio async def test_read_request_disconnected_client() -> None: """If we receive a disconnect message when the downstream ASGI app calls receive() the Request instance passed into the dispatch function should get marked as disconnected. The downstream ASGI app should not get a ClientDisconnect raised, instead if should just receive the disconnect message. """ async def endpoint(scope: Scope, receive: Receive, send: Send) -> None: msg = await receive() assert msg["type"] == "http.disconnect" await Response()(scope, receive, send) class ConsumingMiddleware(BaseHTTPMiddleware): async def dispatch( self, request: Request, call_next: RequestResponseEndpoint, ) -> Response: response = await call_next(request) disconnected = await request.is_disconnected() assert disconnected is True return response scope = {"type": "http", "method": "POST", "path": "/"} async def receive() -> AsyncGenerator[Message, None]: yield {"type": "http.disconnect"} raise AssertionError("Should not be called, would hang") # pragma: no cover async def send(msg: Message) -> None: if msg["type"] == "http.response.start": assert msg["status"] == 200 app: ASGIApp = ConsumingMiddleware(endpoint) rcv = receive() > await app(scope, rcv.__anext__, send) tests/middleware/test_base.py:873: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = .ConsumingMiddleware object at 0x7f25d9cd0ec0> scope = {'method': 'POST', 'path': '/', 'type': 'http'} receive = send = .send at 0x7f25d97271a0> async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: if scope["type"] != "http": await self.app(scope, receive, send) return request = _CachedRequest(scope, receive) wrapped_receive = request.wrapped_receive response_sent = anyio.Event() async def call_next(request: Request) -> Response: app_exc: Exception | None = None async def receive_or_disconnect() -> Message: if response_sent.is_set(): return {"type": "http.disconnect"} async with anyio.create_task_group() as task_group: async def wrap(func: typing.Callable[[], typing.Awaitable[T]]) -> T: result = await func() task_group.cancel_scope.cancel() return result task_group.start_soon(wrap, response_sent.wait) message = await wrap(wrapped_receive) if response_sent.is_set(): return {"type": "http.disconnect"} return message async def send_no_error(message: Message) -> None: try: await send_stream.send(message) except anyio.BrokenResourceError: # recv_stream has been closed, i.e. response_sent has been set. return async def coro() -> None: nonlocal app_exc with send_stream: try: await self.app(scope, receive_or_disconnect, send_no_error) except Exception as exc: app_exc = exc task_group.start_soon(coro) try: message = await recv_stream.receive() info = message.get("info", None) if message["type"] == "http.response.debug" and info is not None: message = await recv_stream.receive() except anyio.EndOfStream: if app_exc is not None: raise app_exc raise RuntimeError("No response returned.") assert message["type"] == "http.response.start" async def body_stream() -> typing.AsyncGenerator[bytes, None]: async for message in recv_stream: assert message["type"] == "http.response.body" body = message.get("body", b"") if body: yield body if not message.get("more_body", False): break if app_exc is not None: raise app_exc response = _StreamingResponse(status_code=message["status"], content=body_stream(), info=info) response.raw_headers = message["headers"] return response > send_stream, recv_stream = anyio.create_memory_object_stream[Message]() E TypeError: 'function' object is not subscriptable starlette/middleware/base.py:175: TypeError _________________ test_read_request_disconnected_client[trio] __________________ @pytest.mark.anyio async def test_read_request_disconnected_client() -> None: """If we receive a disconnect message when the downstream ASGI app calls receive() the Request instance passed into the dispatch function should get marked as disconnected. The downstream ASGI app should not get a ClientDisconnect raised, instead if should just receive the disconnect message. """ async def endpoint(scope: Scope, receive: Receive, send: Send) -> None: msg = await receive() assert msg["type"] == "http.disconnect" await Response()(scope, receive, send) class ConsumingMiddleware(BaseHTTPMiddleware): async def dispatch( self, request: Request, call_next: RequestResponseEndpoint, ) -> Response: response = await call_next(request) disconnected = await request.is_disconnected() assert disconnected is True return response scope = {"type": "http", "method": "POST", "path": "/"} async def receive() -> AsyncGenerator[Message, None]: yield {"type": "http.disconnect"} raise AssertionError("Should not be called, would hang") # pragma: no cover async def send(msg: Message) -> None: if msg["type"] == "http.response.start": assert msg["status"] == 200 app: ASGIApp = ConsumingMiddleware(endpoint) rcv = receive() > await app(scope, rcv.__anext__, send) tests/middleware/test_base.py:873: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = .ConsumingMiddleware object at 0x7f25d9cd16a0> scope = {'method': 'POST', 'path': '/', 'type': 'http'} receive = send = .send at 0x7f25d9724b80> async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: if scope["type"] != "http": await self.app(scope, receive, send) return request = _CachedRequest(scope, receive) wrapped_receive = request.wrapped_receive response_sent = anyio.Event() async def call_next(request: Request) -> Response: app_exc: Exception | None = None async def receive_or_disconnect() -> Message: if response_sent.is_set(): return {"type": "http.disconnect"} async with anyio.create_task_group() as task_group: async def wrap(func: typing.Callable[[], typing.Awaitable[T]]) -> T: result = await func() task_group.cancel_scope.cancel() return result task_group.start_soon(wrap, response_sent.wait) message = await wrap(wrapped_receive) if response_sent.is_set(): return {"type": "http.disconnect"} return message async def send_no_error(message: Message) -> None: try: await send_stream.send(message) except anyio.BrokenResourceError: # recv_stream has been closed, i.e. response_sent has been set. return async def coro() -> None: nonlocal app_exc with send_stream: try: await self.app(scope, receive_or_disconnect, send_no_error) except Exception as exc: app_exc = exc task_group.start_soon(coro) try: message = await recv_stream.receive() info = message.get("info", None) if message["type"] == "http.response.debug" and info is not None: message = await recv_stream.receive() except anyio.EndOfStream: if app_exc is not None: raise app_exc raise RuntimeError("No response returned.") assert message["type"] == "http.response.start" async def body_stream() -> typing.AsyncGenerator[bytes, None]: async for message in recv_stream: assert message["type"] == "http.response.body" body = message.get("body", b"") if body: yield body if not message.get("more_body", False): break if app_exc is not None: raise app_exc response = _StreamingResponse(status_code=message["status"], content=body_stream(), info=info) response.raw_headers = message["headers"] return response > send_stream, recv_stream = anyio.create_memory_object_stream[Message]() E TypeError: 'function' object is not subscriptable starlette/middleware/base.py:175: TypeError ________ test_read_request_disconnected_after_consuming_steam[asyncio] _________ @pytest.mark.anyio async def test_read_request_disconnected_after_consuming_steam() -> None: async def endpoint(scope: Scope, receive: Receive, send: Send) -> None: msg = await receive() assert msg.pop("more_body", False) is False assert msg == {"type": "http.request", "body": b"hi"} msg = await receive() assert msg == {"type": "http.disconnect"} await Response()(scope, receive, send) class ConsumingMiddleware(BaseHTTPMiddleware): async def dispatch( self, request: Request, call_next: RequestResponseEndpoint, ) -> Response: await request.body() disconnected = await request.is_disconnected() assert disconnected is True response = await call_next(request) return response scope = {"type": "http", "method": "POST", "path": "/"} async def receive() -> AsyncGenerator[Message, None]: yield {"type": "http.request", "body": b"hi"} yield {"type": "http.disconnect"} raise AssertionError("Should not be called, would hang") # pragma: no cover async def send(msg: Message) -> None: if msg["type"] == "http.response.start": assert msg["status"] == 200 app: ASGIApp = ConsumingMiddleware(endpoint) rcv = receive() > await app(scope, rcv.__anext__, send) tests/middleware/test_base.py:915: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = .ConsumingMiddleware object at 0x7f25d9cd0ad0> scope = {'method': 'POST', 'path': '/', 'type': 'http'} receive = send = .send at 0x7f25d9724220> async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: if scope["type"] != "http": await self.app(scope, receive, send) return request = _CachedRequest(scope, receive) wrapped_receive = request.wrapped_receive response_sent = anyio.Event() async def call_next(request: Request) -> Response: app_exc: Exception | None = None async def receive_or_disconnect() -> Message: if response_sent.is_set(): return {"type": "http.disconnect"} async with anyio.create_task_group() as task_group: async def wrap(func: typing.Callable[[], typing.Awaitable[T]]) -> T: result = await func() task_group.cancel_scope.cancel() return result task_group.start_soon(wrap, response_sent.wait) message = await wrap(wrapped_receive) if response_sent.is_set(): return {"type": "http.disconnect"} return message async def send_no_error(message: Message) -> None: try: await send_stream.send(message) except anyio.BrokenResourceError: # recv_stream has been closed, i.e. response_sent has been set. return async def coro() -> None: nonlocal app_exc with send_stream: try: await self.app(scope, receive_or_disconnect, send_no_error) except Exception as exc: app_exc = exc task_group.start_soon(coro) try: message = await recv_stream.receive() info = message.get("info", None) if message["type"] == "http.response.debug" and info is not None: message = await recv_stream.receive() except anyio.EndOfStream: if app_exc is not None: raise app_exc raise RuntimeError("No response returned.") assert message["type"] == "http.response.start" async def body_stream() -> typing.AsyncGenerator[bytes, None]: async for message in recv_stream: assert message["type"] == "http.response.body" body = message.get("body", b"") if body: yield body if not message.get("more_body", False): break if app_exc is not None: raise app_exc response = _StreamingResponse(status_code=message["status"], content=body_stream(), info=info) response.raw_headers = message["headers"] return response > send_stream, recv_stream = anyio.create_memory_object_stream[Message]() E TypeError: 'function' object is not subscriptable starlette/middleware/base.py:175: TypeError __________ test_read_request_disconnected_after_consuming_steam[trio] __________ @pytest.mark.anyio async def test_read_request_disconnected_after_consuming_steam() -> None: async def endpoint(scope: Scope, receive: Receive, send: Send) -> None: msg = await receive() assert msg.pop("more_body", False) is False assert msg == {"type": "http.request", "body": b"hi"} msg = await receive() assert msg == {"type": "http.disconnect"} await Response()(scope, receive, send) class ConsumingMiddleware(BaseHTTPMiddleware): async def dispatch( self, request: Request, call_next: RequestResponseEndpoint, ) -> Response: await request.body() disconnected = await request.is_disconnected() assert disconnected is True response = await call_next(request) return response scope = {"type": "http", "method": "POST", "path": "/"} async def receive() -> AsyncGenerator[Message, None]: yield {"type": "http.request", "body": b"hi"} yield {"type": "http.disconnect"} raise AssertionError("Should not be called, would hang") # pragma: no cover async def send(msg: Message) -> None: if msg["type"] == "http.response.start": assert msg["status"] == 200 app: ASGIApp = ConsumingMiddleware(endpoint) rcv = receive() > await app(scope, rcv.__anext__, send) tests/middleware/test_base.py:915: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = .ConsumingMiddleware object at 0x7f25d9cd3cb0> scope = {'method': 'POST', 'path': '/', 'type': 'http'} receive = send = .send at 0x7f25d9c6c4a0> async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: if scope["type"] != "http": await self.app(scope, receive, send) return request = _CachedRequest(scope, receive) wrapped_receive = request.wrapped_receive response_sent = anyio.Event() async def call_next(request: Request) -> Response: app_exc: Exception | None = None async def receive_or_disconnect() -> Message: if response_sent.is_set(): return {"type": "http.disconnect"} async with anyio.create_task_group() as task_group: async def wrap(func: typing.Callable[[], typing.Awaitable[T]]) -> T: result = await func() task_group.cancel_scope.cancel() return result task_group.start_soon(wrap, response_sent.wait) message = await wrap(wrapped_receive) if response_sent.is_set(): return {"type": "http.disconnect"} return message async def send_no_error(message: Message) -> None: try: await send_stream.send(message) except anyio.BrokenResourceError: # recv_stream has been closed, i.e. response_sent has been set. return async def coro() -> None: nonlocal app_exc with send_stream: try: await self.app(scope, receive_or_disconnect, send_no_error) except Exception as exc: app_exc = exc task_group.start_soon(coro) try: message = await recv_stream.receive() info = message.get("info", None) if message["type"] == "http.response.debug" and info is not None: message = await recv_stream.receive() except anyio.EndOfStream: if app_exc is not None: raise app_exc raise RuntimeError("No response returned.") assert message["type"] == "http.response.start" async def body_stream() -> typing.AsyncGenerator[bytes, None]: async for message in recv_stream: assert message["type"] == "http.response.body" body = message.get("body", b"") if body: yield body if not message.get("more_body", False): break if app_exc is not None: raise app_exc response = _StreamingResponse(status_code=message["status"], content=body_stream(), info=info) response.raw_headers = message["headers"] return response > send_stream, recv_stream = anyio.create_memory_object_stream[Message]() E TypeError: 'function' object is not subscriptable starlette/middleware/base.py:175: TypeError _____________ test_downstream_middleware_modifies_receive[asyncio] _____________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_downstream_middleware_modifies_receive( test_client_factory: TestClientFactory, ) -> None: """If a downstream middleware modifies receive() the final ASGI app should see the modified version. """ async def endpoint(scope: Scope, receive: Receive, send: Send) -> None: request = Request(scope, receive) body = await request.body() assert body == b"foo foo " await Response()(scope, receive, send) class ConsumingMiddleware(BaseHTTPMiddleware): async def dispatch( self, request: Request, call_next: RequestResponseEndpoint, ) -> Response: body = await request.body() assert body == b"foo " return await call_next(request) def modifying_middleware(app: ASGIApp) -> ASGIApp: async def wrapped_app(scope: Scope, receive: Receive, send: Send) -> None: async def wrapped_receive() -> Message: msg = await receive() if msg["type"] == "http.request": # pragma: no branch msg["body"] = msg["body"] * 2 return msg await app(scope, wrapped_receive, send) return wrapped_app client = test_client_factory(ConsumingMiddleware(modifying_middleware(endpoint))) > resp = client.post("/", content=b"foo ") tests/middleware/test_base.py:957: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:529: in post return super().post( /usr/lib/python3.13/site-packages/httpx/_client.py:1157: in post return self.request( starlette/testclient.py:428: in request return super().request( /usr/lib/python3.13/site-packages/httpx/_client.py:837: in request return self.send(request, auth=auth, follow_redirects=follow_redirects) /usr/lib/python3.13/site-packages/httpx/_client.py:926: in send response = self._send_handling_auth( /usr/lib/python3.13/site-packages/httpx/_client.py:954: in _send_handling_auth response = self._send_handling_redirects( /usr/lib/python3.13/site-packages/httpx/_client.py:991: in _send_handling_redirects response = self._send_single_request(request) /usr/lib/python3.13/site-packages/httpx/_client.py:1027: in _send_single_request response = transport.handle_request(request) starlette/testclient.py:337: in handle_request raise exc starlette/testclient.py:334: in handle_request portal.call(self.app, scope, receive, send) /usr/lib/python3.13/site-packages/anyio/from_thread.py:277: in call return cast(T_Retval, self.start_task_soon(func, *args).result()) /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = .ConsumingMiddleware object at 0x7f25d9cd2900> scope = {'client': ('testclient', 50000), 'extensions': {'http.response.debug': {}}, 'headers': [(b'host', b'testserver'), (b'...(b'connection', b'keep-alive'), (b'user-agent', b'testclient'), (b'content-length', b'4')], 'http_version': '1.1', ...} receive = .receive at 0x7f25d9c6f2e0> send = .send at 0x7f25d9c6dc60> async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: if scope["type"] != "http": await self.app(scope, receive, send) return request = _CachedRequest(scope, receive) wrapped_receive = request.wrapped_receive response_sent = anyio.Event() async def call_next(request: Request) -> Response: app_exc: Exception | None = None async def receive_or_disconnect() -> Message: if response_sent.is_set(): return {"type": "http.disconnect"} async with anyio.create_task_group() as task_group: async def wrap(func: typing.Callable[[], typing.Awaitable[T]]) -> T: result = await func() task_group.cancel_scope.cancel() return result task_group.start_soon(wrap, response_sent.wait) message = await wrap(wrapped_receive) if response_sent.is_set(): return {"type": "http.disconnect"} return message async def send_no_error(message: Message) -> None: try: await send_stream.send(message) except anyio.BrokenResourceError: # recv_stream has been closed, i.e. response_sent has been set. return async def coro() -> None: nonlocal app_exc with send_stream: try: await self.app(scope, receive_or_disconnect, send_no_error) except Exception as exc: app_exc = exc task_group.start_soon(coro) try: message = await recv_stream.receive() info = message.get("info", None) if message["type"] == "http.response.debug" and info is not None: message = await recv_stream.receive() except anyio.EndOfStream: if app_exc is not None: raise app_exc raise RuntimeError("No response returned.") assert message["type"] == "http.response.start" async def body_stream() -> typing.AsyncGenerator[bytes, None]: async for message in recv_stream: assert message["type"] == "http.response.body" body = message.get("body", b"") if body: yield body if not message.get("more_body", False): break if app_exc is not None: raise app_exc response = _StreamingResponse(status_code=message["status"], content=body_stream(), info=info) response.raw_headers = message["headers"] return response > send_stream, recv_stream = anyio.create_memory_object_stream[Message]() E TypeError: 'function' object is not subscriptable starlette/middleware/base.py:175: TypeError ______________ test_downstream_middleware_modifies_receive[trio] _______________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_downstream_middleware_modifies_receive( test_client_factory: TestClientFactory, ) -> None: """If a downstream middleware modifies receive() the final ASGI app should see the modified version. """ async def endpoint(scope: Scope, receive: Receive, send: Send) -> None: request = Request(scope, receive) body = await request.body() assert body == b"foo foo " await Response()(scope, receive, send) class ConsumingMiddleware(BaseHTTPMiddleware): async def dispatch( self, request: Request, call_next: RequestResponseEndpoint, ) -> Response: body = await request.body() assert body == b"foo " return await call_next(request) def modifying_middleware(app: ASGIApp) -> ASGIApp: async def wrapped_app(scope: Scope, receive: Receive, send: Send) -> None: async def wrapped_receive() -> Message: msg = await receive() if msg["type"] == "http.request": # pragma: no branch msg["body"] = msg["body"] * 2 return msg await app(scope, wrapped_receive, send) return wrapped_app client = test_client_factory(ConsumingMiddleware(modifying_middleware(endpoint))) > resp = client.post("/", content=b"foo ") tests/middleware/test_base.py:957: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:529: in post return super().post( /usr/lib/python3.13/site-packages/httpx/_client.py:1157: in post return self.request( starlette/testclient.py:428: in request return super().request( /usr/lib/python3.13/site-packages/httpx/_client.py:837: in request return self.send(request, auth=auth, follow_redirects=follow_redirects) /usr/lib/python3.13/site-packages/httpx/_client.py:926: in send response = self._send_handling_auth( /usr/lib/python3.13/site-packages/httpx/_client.py:954: in _send_handling_auth response = self._send_handling_redirects( /usr/lib/python3.13/site-packages/httpx/_client.py:991: in _send_handling_redirects response = self._send_single_request(request) /usr/lib/python3.13/site-packages/httpx/_client.py:1027: in _send_single_request response = transport.handle_request(request) starlette/testclient.py:337: in handle_request raise exc starlette/testclient.py:334: in handle_request portal.call(self.app, scope, receive, send) /usr/lib/python3.13/site-packages/anyio/from_thread.py:277: in call return cast(T_Retval, self.start_task_soon(func, *args).result()) /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = .ConsumingMiddleware object at 0x7f25d9cd0ad0> scope = {'client': ('testclient', 50000), 'extensions': {'http.response.debug': {}}, 'headers': [(b'host', b'testserver'), (b'...(b'connection', b'keep-alive'), (b'user-agent', b'testclient'), (b'content-length', b'4')], 'http_version': '1.1', ...} receive = .receive at 0x7f25d97251c0> send = .send at 0x7f25d9724220> async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: if scope["type"] != "http": await self.app(scope, receive, send) return request = _CachedRequest(scope, receive) wrapped_receive = request.wrapped_receive response_sent = anyio.Event() async def call_next(request: Request) -> Response: app_exc: Exception | None = None async def receive_or_disconnect() -> Message: if response_sent.is_set(): return {"type": "http.disconnect"} async with anyio.create_task_group() as task_group: async def wrap(func: typing.Callable[[], typing.Awaitable[T]]) -> T: result = await func() task_group.cancel_scope.cancel() return result task_group.start_soon(wrap, response_sent.wait) message = await wrap(wrapped_receive) if response_sent.is_set(): return {"type": "http.disconnect"} return message async def send_no_error(message: Message) -> None: try: await send_stream.send(message) except anyio.BrokenResourceError: # recv_stream has been closed, i.e. response_sent has been set. return async def coro() -> None: nonlocal app_exc with send_stream: try: await self.app(scope, receive_or_disconnect, send_no_error) except Exception as exc: app_exc = exc task_group.start_soon(coro) try: message = await recv_stream.receive() info = message.get("info", None) if message["type"] == "http.response.debug" and info is not None: message = await recv_stream.receive() except anyio.EndOfStream: if app_exc is not None: raise app_exc raise RuntimeError("No response returned.") assert message["type"] == "http.response.start" async def body_stream() -> typing.AsyncGenerator[bytes, None]: async for message in recv_stream: assert message["type"] == "http.response.body" body = message.get("body", b"") if body: yield body if not message.get("more_body", False): break if app_exc is not None: raise app_exc response = _StreamingResponse(status_code=message["status"], content=body_stream(), info=info) response.raw_headers = message["headers"] return response > send_stream, recv_stream = anyio.create_memory_object_stream[Message]() E TypeError: 'function' object is not subscriptable starlette/middleware/base.py:175: TypeError ___________________ test_pr_1519_comment_1236166180_example ____________________ def test_pr_1519_comment_1236166180_example() -> None: """ https://github.com/encode/starlette/pull/1519#issuecomment-1236166180 """ bodies: list[bytes] = [] class LogRequestBodySize(BaseHTTPMiddleware): async def dispatch( self, request: Request, call_next: RequestResponseEndpoint, ) -> Response: print(len(await request.body())) return await call_next(request) def replace_body_middleware(app: ASGIApp) -> ASGIApp: async def wrapped_app(scope: Scope, receive: Receive, send: Send) -> None: async def wrapped_rcv() -> Message: msg = await receive() msg["body"] += b"-foo" return msg await app(scope, wrapped_rcv, send) return wrapped_app async def endpoint(request: Request) -> Response: body = await request.body() bodies.append(body) return Response() app: ASGIApp = Starlette(routes=[Route("/", endpoint, methods=["POST"])]) app = replace_body_middleware(app) app = LogRequestBodySize(app) client = TestClient(app) > resp = client.post("/", content=b"Hello, World!") tests/middleware/test_base.py:997: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:529: in post return super().post( /usr/lib/python3.13/site-packages/httpx/_client.py:1157: in post return self.request( starlette/testclient.py:428: in request return super().request( /usr/lib/python3.13/site-packages/httpx/_client.py:837: in request return self.send(request, auth=auth, follow_redirects=follow_redirects) /usr/lib/python3.13/site-packages/httpx/_client.py:926: in send response = self._send_handling_auth( /usr/lib/python3.13/site-packages/httpx/_client.py:954: in _send_handling_auth response = self._send_handling_redirects( /usr/lib/python3.13/site-packages/httpx/_client.py:991: in _send_handling_redirects response = self._send_single_request(request) /usr/lib/python3.13/site-packages/httpx/_client.py:1027: in _send_single_request response = transport.handle_request(request) starlette/testclient.py:337: in handle_request raise exc starlette/testclient.py:334: in handle_request portal.call(self.app, scope, receive, send) /usr/lib/python3.13/site-packages/anyio/from_thread.py:277: in call return cast(T_Retval, self.start_task_soon(func, *args).result()) /usr/lib64/python3.13/concurrent/futures/_base.py:456: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = .LogRequestBodySize object at 0x7f25d9cd0590> scope = {'client': ('testclient', 50000), 'extensions': {'http.response.debug': {}}, 'headers': [(b'host', b'testserver'), (b'...b'connection', b'keep-alive'), (b'user-agent', b'testclient'), (b'content-length', b'13')], 'http_version': '1.1', ...} receive = .receive at 0x7f25d9726200> send = .send at 0x7f25d9727240> async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: if scope["type"] != "http": await self.app(scope, receive, send) return request = _CachedRequest(scope, receive) wrapped_receive = request.wrapped_receive response_sent = anyio.Event() async def call_next(request: Request) -> Response: app_exc: Exception | None = None async def receive_or_disconnect() -> Message: if response_sent.is_set(): return {"type": "http.disconnect"} async with anyio.create_task_group() as task_group: async def wrap(func: typing.Callable[[], typing.Awaitable[T]]) -> T: result = await func() task_group.cancel_scope.cancel() return result task_group.start_soon(wrap, response_sent.wait) message = await wrap(wrapped_receive) if response_sent.is_set(): return {"type": "http.disconnect"} return message async def send_no_error(message: Message) -> None: try: await send_stream.send(message) except anyio.BrokenResourceError: # recv_stream has been closed, i.e. response_sent has been set. return async def coro() -> None: nonlocal app_exc with send_stream: try: await self.app(scope, receive_or_disconnect, send_no_error) except Exception as exc: app_exc = exc task_group.start_soon(coro) try: message = await recv_stream.receive() info = message.get("info", None) if message["type"] == "http.response.debug" and info is not None: message = await recv_stream.receive() except anyio.EndOfStream: if app_exc is not None: raise app_exc raise RuntimeError("No response returned.") assert message["type"] == "http.response.start" async def body_stream() -> typing.AsyncGenerator[bytes, None]: async for message in recv_stream: assert message["type"] == "http.response.body" body = message.get("body", b"") if body: yield body if not message.get("more_body", False): break if app_exc is not None: raise app_exc response = _StreamingResponse(status_code=message["status"], content=body_stream(), info=info) response.raw_headers = message["headers"] return response > send_stream, recv_stream = anyio.create_memory_object_stream[Message]() E TypeError: 'function' object is not subscriptable starlette/middleware/base.py:175: TypeError ________ test_multiple_middlewares_stacked_client_disconnected[asyncio] ________ @pytest.mark.anyio async def test_multiple_middlewares_stacked_client_disconnected() -> None: """ Tests for: - https://github.com/encode/starlette/issues/2516 - https://github.com/encode/starlette/pull/2687 """ ordered_events: list[str] = [] unordered_events: list[str] = [] class MyMiddleware(BaseHTTPMiddleware): def __init__(self, app: ASGIApp, version: int) -> None: self.version = version super().__init__(app) async def dispatch(self, request: Request, call_next: RequestResponseEndpoint) -> Response: ordered_events.append(f"{self.version}:STARTED") res = await call_next(request) ordered_events.append(f"{self.version}:COMPLETED") def background() -> None: unordered_events.append(f"{self.version}:BACKGROUND") assert res.background is None res.background = BackgroundTask(background) return res async def sleepy(request: Request) -> Response: try: await request.body() except ClientDisconnect: pass else: # pragma: no cover raise AssertionError("Should have raised ClientDisconnect") return Response(b"") app = Starlette( routes=[Route("/", sleepy)], middleware=[Middleware(MyMiddleware, version=_ + 1) for _ in range(10)], ) scope = { "type": "http", "version": "3", "method": "GET", "path": "/", } async def receive() -> AsyncIterator[Message]: yield {"type": "http.disconnect"} sent: list[Message] = [] async def send(message: Message) -> None: sent.append(message) > await app(scope, receive().__anext__, send) tests/middleware/test_base.py:1059: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/applications.py:112: in __call__ await self.middleware_stack(scope, receive, send) starlette/middleware/errors.py:187: in __call__ raise exc starlette/middleware/errors.py:165: in __call__ await self.app(scope, receive, _send) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = .MyMiddleware object at 0x7f25d9ae6a50> scope = {'app': , 'method': 'GET', 'path': '/', 'type': 'http', ...} receive = send = ._send at 0x7f25d9724360> async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: if scope["type"] != "http": await self.app(scope, receive, send) return request = _CachedRequest(scope, receive) wrapped_receive = request.wrapped_receive response_sent = anyio.Event() async def call_next(request: Request) -> Response: app_exc: Exception | None = None async def receive_or_disconnect() -> Message: if response_sent.is_set(): return {"type": "http.disconnect"} async with anyio.create_task_group() as task_group: async def wrap(func: typing.Callable[[], typing.Awaitable[T]]) -> T: result = await func() task_group.cancel_scope.cancel() return result task_group.start_soon(wrap, response_sent.wait) message = await wrap(wrapped_receive) if response_sent.is_set(): return {"type": "http.disconnect"} return message async def send_no_error(message: Message) -> None: try: await send_stream.send(message) except anyio.BrokenResourceError: # recv_stream has been closed, i.e. response_sent has been set. return async def coro() -> None: nonlocal app_exc with send_stream: try: await self.app(scope, receive_or_disconnect, send_no_error) except Exception as exc: app_exc = exc task_group.start_soon(coro) try: message = await recv_stream.receive() info = message.get("info", None) if message["type"] == "http.response.debug" and info is not None: message = await recv_stream.receive() except anyio.EndOfStream: if app_exc is not None: raise app_exc raise RuntimeError("No response returned.") assert message["type"] == "http.response.start" async def body_stream() -> typing.AsyncGenerator[bytes, None]: async for message in recv_stream: assert message["type"] == "http.response.body" body = message.get("body", b"") if body: yield body if not message.get("more_body", False): break if app_exc is not None: raise app_exc response = _StreamingResponse(status_code=message["status"], content=body_stream(), info=info) response.raw_headers = message["headers"] return response > send_stream, recv_stream = anyio.create_memory_object_stream[Message]() E TypeError: 'function' object is not subscriptable starlette/middleware/base.py:175: TypeError _________ test_multiple_middlewares_stacked_client_disconnected[trio] __________ @pytest.mark.anyio async def test_multiple_middlewares_stacked_client_disconnected() -> None: """ Tests for: - https://github.com/encode/starlette/issues/2516 - https://github.com/encode/starlette/pull/2687 """ ordered_events: list[str] = [] unordered_events: list[str] = [] class MyMiddleware(BaseHTTPMiddleware): def __init__(self, app: ASGIApp, version: int) -> None: self.version = version super().__init__(app) async def dispatch(self, request: Request, call_next: RequestResponseEndpoint) -> Response: ordered_events.append(f"{self.version}:STARTED") res = await call_next(request) ordered_events.append(f"{self.version}:COMPLETED") def background() -> None: unordered_events.append(f"{self.version}:BACKGROUND") assert res.background is None res.background = BackgroundTask(background) return res async def sleepy(request: Request) -> Response: try: await request.body() except ClientDisconnect: pass else: # pragma: no cover raise AssertionError("Should have raised ClientDisconnect") return Response(b"") app = Starlette( routes=[Route("/", sleepy)], middleware=[Middleware(MyMiddleware, version=_ + 1) for _ in range(10)], ) scope = { "type": "http", "version": "3", "method": "GET", "path": "/", } async def receive() -> AsyncIterator[Message]: yield {"type": "http.disconnect"} sent: list[Message] = [] async def send(message: Message) -> None: sent.append(message) > await app(scope, receive().__anext__, send) tests/middleware/test_base.py:1059: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/applications.py:112: in __call__ await self.middleware_stack(scope, receive, send) starlette/middleware/errors.py:187: in __call__ raise exc starlette/middleware/errors.py:165: in __call__ await self.app(scope, receive, _send) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = .MyMiddleware object at 0x7f25d9ae7c50> scope = {'app': , 'method': 'GET', 'path': '/', 'type': 'http', ...} receive = send = ._send at 0x7f25d9c6d9e0> async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: if scope["type"] != "http": await self.app(scope, receive, send) return request = _CachedRequest(scope, receive) wrapped_receive = request.wrapped_receive response_sent = anyio.Event() async def call_next(request: Request) -> Response: app_exc: Exception | None = None async def receive_or_disconnect() -> Message: if response_sent.is_set(): return {"type": "http.disconnect"} async with anyio.create_task_group() as task_group: async def wrap(func: typing.Callable[[], typing.Awaitable[T]]) -> T: result = await func() task_group.cancel_scope.cancel() return result task_group.start_soon(wrap, response_sent.wait) message = await wrap(wrapped_receive) if response_sent.is_set(): return {"type": "http.disconnect"} return message async def send_no_error(message: Message) -> None: try: await send_stream.send(message) except anyio.BrokenResourceError: # recv_stream has been closed, i.e. response_sent has been set. return async def coro() -> None: nonlocal app_exc with send_stream: try: await self.app(scope, receive_or_disconnect, send_no_error) except Exception as exc: app_exc = exc task_group.start_soon(coro) try: message = await recv_stream.receive() info = message.get("info", None) if message["type"] == "http.response.debug" and info is not None: message = await recv_stream.receive() except anyio.EndOfStream: if app_exc is not None: raise app_exc raise RuntimeError("No response returned.") assert message["type"] == "http.response.start" async def body_stream() -> typing.AsyncGenerator[bytes, None]: async for message in recv_stream: assert message["type"] == "http.response.body" body = message.get("body", b"") if body: yield body if not message.get("more_body", False): break if app_exc is not None: raise app_exc response = _StreamingResponse(status_code=message["status"], content=body_stream(), info=info) response.raw_headers = message["headers"] return response > send_stream, recv_stream = anyio.create_memory_object_stream[Message]() E TypeError: 'function' object is not subscriptable starlette/middleware/base.py:175: TypeError _______________ test_poll_for_disconnect_repeated[asyncio-True] ________________ send_body = True @pytest.mark.anyio @pytest.mark.parametrize("send_body", [True, False]) async def test_poll_for_disconnect_repeated(send_body: bool) -> None: async def app_poll_disconnect(scope: Scope, receive: Receive, send: Send) -> None: for _ in range(2): msg = await receive() while msg["type"] == "http.request": msg = await receive() assert msg["type"] == "http.disconnect" await Response(b"good!")(scope, receive, send) class MyMiddleware(BaseHTTPMiddleware): async def dispatch(self, request: Request, call_next: RequestResponseEndpoint) -> Response: return await call_next(request) app = MyMiddleware(app_poll_disconnect) scope = { "type": "http", "version": "3", "method": "GET", "path": "/", } async def receive() -> AsyncIterator[Message]: # the key here is that we only ever send 1 htt.disconnect message if send_body: yield {"type": "http.request", "body": b"hello", "more_body": True} yield {"type": "http.request", "body": b"", "more_body": False} yield {"type": "http.disconnect"} raise AssertionError("Should not be called, would hang") # pragma: no cover sent: list[Message] = [] async def send(message: Message) -> None: sent.append(message) > await app(scope, receive().__anext__, send) tests/middleware/test_base.py:1146: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = .MyMiddleware object at 0x7f25d9cd12b0> scope = {'method': 'GET', 'path': '/', 'type': 'http', 'version': '3'} receive = send = .send at 0x7f25d9c6c400> async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: if scope["type"] != "http": await self.app(scope, receive, send) return request = _CachedRequest(scope, receive) wrapped_receive = request.wrapped_receive response_sent = anyio.Event() async def call_next(request: Request) -> Response: app_exc: Exception | None = None async def receive_or_disconnect() -> Message: if response_sent.is_set(): return {"type": "http.disconnect"} async with anyio.create_task_group() as task_group: async def wrap(func: typing.Callable[[], typing.Awaitable[T]]) -> T: result = await func() task_group.cancel_scope.cancel() return result task_group.start_soon(wrap, response_sent.wait) message = await wrap(wrapped_receive) if response_sent.is_set(): return {"type": "http.disconnect"} return message async def send_no_error(message: Message) -> None: try: await send_stream.send(message) except anyio.BrokenResourceError: # recv_stream has been closed, i.e. response_sent has been set. return async def coro() -> None: nonlocal app_exc with send_stream: try: await self.app(scope, receive_or_disconnect, send_no_error) except Exception as exc: app_exc = exc task_group.start_soon(coro) try: message = await recv_stream.receive() info = message.get("info", None) if message["type"] == "http.response.debug" and info is not None: message = await recv_stream.receive() except anyio.EndOfStream: if app_exc is not None: raise app_exc raise RuntimeError("No response returned.") assert message["type"] == "http.response.start" async def body_stream() -> typing.AsyncGenerator[bytes, None]: async for message in recv_stream: assert message["type"] == "http.response.body" body = message.get("body", b"") if body: yield body if not message.get("more_body", False): break if app_exc is not None: raise app_exc response = _StreamingResponse(status_code=message["status"], content=body_stream(), info=info) response.raw_headers = message["headers"] return response > send_stream, recv_stream = anyio.create_memory_object_stream[Message]() E TypeError: 'function' object is not subscriptable starlette/middleware/base.py:175: TypeError _______________ test_poll_for_disconnect_repeated[asyncio-False] _______________ send_body = False @pytest.mark.anyio @pytest.mark.parametrize("send_body", [True, False]) async def test_poll_for_disconnect_repeated(send_body: bool) -> None: async def app_poll_disconnect(scope: Scope, receive: Receive, send: Send) -> None: for _ in range(2): msg = await receive() while msg["type"] == "http.request": msg = await receive() assert msg["type"] == "http.disconnect" await Response(b"good!")(scope, receive, send) class MyMiddleware(BaseHTTPMiddleware): async def dispatch(self, request: Request, call_next: RequestResponseEndpoint) -> Response: return await call_next(request) app = MyMiddleware(app_poll_disconnect) scope = { "type": "http", "version": "3", "method": "GET", "path": "/", } async def receive() -> AsyncIterator[Message]: # the key here is that we only ever send 1 htt.disconnect message if send_body: yield {"type": "http.request", "body": b"hello", "more_body": True} yield {"type": "http.request", "body": b"", "more_body": False} yield {"type": "http.disconnect"} raise AssertionError("Should not be called, would hang") # pragma: no cover sent: list[Message] = [] async def send(message: Message) -> None: sent.append(message) > await app(scope, receive().__anext__, send) tests/middleware/test_base.py:1146: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = .MyMiddleware object at 0x7f25d9cd1400> scope = {'method': 'GET', 'path': '/', 'type': 'http', 'version': '3'} receive = send = .send at 0x7f25d96e39c0> async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: if scope["type"] != "http": await self.app(scope, receive, send) return request = _CachedRequest(scope, receive) wrapped_receive = request.wrapped_receive response_sent = anyio.Event() async def call_next(request: Request) -> Response: app_exc: Exception | None = None async def receive_or_disconnect() -> Message: if response_sent.is_set(): return {"type": "http.disconnect"} async with anyio.create_task_group() as task_group: async def wrap(func: typing.Callable[[], typing.Awaitable[T]]) -> T: result = await func() task_group.cancel_scope.cancel() return result task_group.start_soon(wrap, response_sent.wait) message = await wrap(wrapped_receive) if response_sent.is_set(): return {"type": "http.disconnect"} return message async def send_no_error(message: Message) -> None: try: await send_stream.send(message) except anyio.BrokenResourceError: # recv_stream has been closed, i.e. response_sent has been set. return async def coro() -> None: nonlocal app_exc with send_stream: try: await self.app(scope, receive_or_disconnect, send_no_error) except Exception as exc: app_exc = exc task_group.start_soon(coro) try: message = await recv_stream.receive() info = message.get("info", None) if message["type"] == "http.response.debug" and info is not None: message = await recv_stream.receive() except anyio.EndOfStream: if app_exc is not None: raise app_exc raise RuntimeError("No response returned.") assert message["type"] == "http.response.start" async def body_stream() -> typing.AsyncGenerator[bytes, None]: async for message in recv_stream: assert message["type"] == "http.response.body" body = message.get("body", b"") if body: yield body if not message.get("more_body", False): break if app_exc is not None: raise app_exc response = _StreamingResponse(status_code=message["status"], content=body_stream(), info=info) response.raw_headers = message["headers"] return response > send_stream, recv_stream = anyio.create_memory_object_stream[Message]() E TypeError: 'function' object is not subscriptable starlette/middleware/base.py:175: TypeError _________________ test_poll_for_disconnect_repeated[trio-True] _________________ send_body = True @pytest.mark.anyio @pytest.mark.parametrize("send_body", [True, False]) async def test_poll_for_disconnect_repeated(send_body: bool) -> None: async def app_poll_disconnect(scope: Scope, receive: Receive, send: Send) -> None: for _ in range(2): msg = await receive() while msg["type"] == "http.request": msg = await receive() assert msg["type"] == "http.disconnect" await Response(b"good!")(scope, receive, send) class MyMiddleware(BaseHTTPMiddleware): async def dispatch(self, request: Request, call_next: RequestResponseEndpoint) -> Response: return await call_next(request) app = MyMiddleware(app_poll_disconnect) scope = { "type": "http", "version": "3", "method": "GET", "path": "/", } async def receive() -> AsyncIterator[Message]: # the key here is that we only ever send 1 htt.disconnect message if send_body: yield {"type": "http.request", "body": b"hello", "more_body": True} yield {"type": "http.request", "body": b"", "more_body": False} yield {"type": "http.disconnect"} raise AssertionError("Should not be called, would hang") # pragma: no cover sent: list[Message] = [] async def send(message: Message) -> None: sent.append(message) > await app(scope, receive().__anext__, send) tests/middleware/test_base.py:1146: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = .MyMiddleware object at 0x7f25d9cd0980> scope = {'method': 'GET', 'path': '/', 'type': 'http', 'version': '3'} receive = send = .send at 0x7f25d9c6db20> async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: if scope["type"] != "http": await self.app(scope, receive, send) return request = _CachedRequest(scope, receive) wrapped_receive = request.wrapped_receive response_sent = anyio.Event() async def call_next(request: Request) -> Response: app_exc: Exception | None = None async def receive_or_disconnect() -> Message: if response_sent.is_set(): return {"type": "http.disconnect"} async with anyio.create_task_group() as task_group: async def wrap(func: typing.Callable[[], typing.Awaitable[T]]) -> T: result = await func() task_group.cancel_scope.cancel() return result task_group.start_soon(wrap, response_sent.wait) message = await wrap(wrapped_receive) if response_sent.is_set(): return {"type": "http.disconnect"} return message async def send_no_error(message: Message) -> None: try: await send_stream.send(message) except anyio.BrokenResourceError: # recv_stream has been closed, i.e. response_sent has been set. return async def coro() -> None: nonlocal app_exc with send_stream: try: await self.app(scope, receive_or_disconnect, send_no_error) except Exception as exc: app_exc = exc task_group.start_soon(coro) try: message = await recv_stream.receive() info = message.get("info", None) if message["type"] == "http.response.debug" and info is not None: message = await recv_stream.receive() except anyio.EndOfStream: if app_exc is not None: raise app_exc raise RuntimeError("No response returned.") assert message["type"] == "http.response.start" async def body_stream() -> typing.AsyncGenerator[bytes, None]: async for message in recv_stream: assert message["type"] == "http.response.body" body = message.get("body", b"") if body: yield body if not message.get("more_body", False): break if app_exc is not None: raise app_exc response = _StreamingResponse(status_code=message["status"], content=body_stream(), info=info) response.raw_headers = message["headers"] return response > send_stream, recv_stream = anyio.create_memory_object_stream[Message]() E TypeError: 'function' object is not subscriptable starlette/middleware/base.py:175: TypeError ________________ test_poll_for_disconnect_repeated[trio-False] _________________ send_body = False @pytest.mark.anyio @pytest.mark.parametrize("send_body", [True, False]) async def test_poll_for_disconnect_repeated(send_body: bool) -> None: async def app_poll_disconnect(scope: Scope, receive: Receive, send: Send) -> None: for _ in range(2): msg = await receive() while msg["type"] == "http.request": msg = await receive() assert msg["type"] == "http.disconnect" await Response(b"good!")(scope, receive, send) class MyMiddleware(BaseHTTPMiddleware): async def dispatch(self, request: Request, call_next: RequestResponseEndpoint) -> Response: return await call_next(request) app = MyMiddleware(app_poll_disconnect) scope = { "type": "http", "version": "3", "method": "GET", "path": "/", } async def receive() -> AsyncIterator[Message]: # the key here is that we only ever send 1 htt.disconnect message if send_body: yield {"type": "http.request", "body": b"hello", "more_body": True} yield {"type": "http.request", "body": b"", "more_body": False} yield {"type": "http.disconnect"} raise AssertionError("Should not be called, would hang") # pragma: no cover sent: list[Message] = [] async def send(message: Message) -> None: sent.append(message) > await app(scope, receive().__anext__, send) tests/middleware/test_base.py:1146: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = .MyMiddleware object at 0x7f25d9cd3cb0> scope = {'method': 'GET', 'path': '/', 'type': 'http', 'version': '3'} receive = send = .send at 0x7f25d9c6d940> async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: if scope["type"] != "http": await self.app(scope, receive, send) return request = _CachedRequest(scope, receive) wrapped_receive = request.wrapped_receive response_sent = anyio.Event() async def call_next(request: Request) -> Response: app_exc: Exception | None = None async def receive_or_disconnect() -> Message: if response_sent.is_set(): return {"type": "http.disconnect"} async with anyio.create_task_group() as task_group: async def wrap(func: typing.Callable[[], typing.Awaitable[T]]) -> T: result = await func() task_group.cancel_scope.cancel() return result task_group.start_soon(wrap, response_sent.wait) message = await wrap(wrapped_receive) if response_sent.is_set(): return {"type": "http.disconnect"} return message async def send_no_error(message: Message) -> None: try: await send_stream.send(message) except anyio.BrokenResourceError: # recv_stream has been closed, i.e. response_sent has been set. return async def coro() -> None: nonlocal app_exc with send_stream: try: await self.app(scope, receive_or_disconnect, send_no_error) except Exception as exc: app_exc = exc task_group.start_soon(coro) try: message = await recv_stream.receive() info = message.get("info", None) if message["type"] == "http.response.debug" and info is not None: message = await recv_stream.receive() except anyio.EndOfStream: if app_exc is not None: raise app_exc raise RuntimeError("No response returned.") assert message["type"] == "http.response.start" async def body_stream() -> typing.AsyncGenerator[bytes, None]: async for message in recv_stream: assert message["type"] == "http.response.body" body = message.get("body", b"") if body: yield body if not message.get("more_body", False): break if app_exc is not None: raise app_exc response = _StreamingResponse(status_code=message["status"], content=body_stream(), info=info) response.raw_headers = message["headers"] return response > send_stream, recv_stream = anyio.create_memory_object_stream[Message]() E TypeError: 'function' object is not subscriptable starlette/middleware/base.py:175: TypeError _________________________ test_debug_not_http[asyncio] _________________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_debug_not_http(test_client_factory: TestClientFactory) -> None: """ DebugMiddleware should just pass through any non-http messages as-is. """ async def app(scope: Scope, receive: Receive, send: Send) -> None: raise RuntimeError("Something went wrong") app = ServerErrorMiddleware(app) with pytest.raises(RuntimeError): client = test_client_factory(app) > with client.websocket_connect("/"): tests/middleware/test_errors.py:79: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:456: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError __________________________ test_debug_not_http[trio] ___________________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_debug_not_http(test_client_factory: TestClientFactory) -> None: """ DebugMiddleware should just pass through any non-http messages as-is. """ async def app(scope: Scope, receive: Receive, send: Send) -> None: raise RuntimeError("Something went wrong") app = ServerErrorMiddleware(app) with pytest.raises(RuntimeError): client = test_client_factory(app) > with client.websocket_connect("/"): tests/middleware/test_errors.py:79: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError ____________________ test_app_add_websocket_route[asyncio] _____________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_app_add_websocket_route(test_client_factory: TestClientFactory) -> None: async def websocket_endpoint(session: WebSocket) -> None: await session.accept() await session.send_text("Hello, world!") await session.close() app = Starlette( routes=[ WebSocketRoute("/ws", endpoint=websocket_endpoint), ] ) client = test_client_factory(app) > with client.websocket_connect("/ws") as session: tests/test_applications.py:350: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:456: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError ______________________ test_app_add_websocket_route[trio] ______________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_app_add_websocket_route(test_client_factory: TestClientFactory) -> None: async def websocket_endpoint(session: WebSocket) -> None: await session.accept() await session.send_text("Hello, world!") await session.close() app = Starlette( routes=[ WebSocketRoute("/ws", endpoint=websocket_endpoint), ] ) client = test_client_factory(app) > with client.websocket_connect("/ws") as session: tests/test_applications.py:350: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError _____________________ test_app_add_event_handler[asyncio] ______________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_app_add_event_handler(test_client_factory: TestClientFactory) -> None: startup_complete = False cleanup_complete = False def run_startup() -> None: nonlocal startup_complete startup_complete = True def run_cleanup() -> None: nonlocal cleanup_complete cleanup_complete = True with pytest.deprecated_call(match="The on_startup and on_shutdown parameters are deprecated"): app = Starlette( on_startup=[run_startup], on_shutdown=[run_cleanup], ) assert not startup_complete assert not cleanup_complete > with test_client_factory(app): tests/test_applications.py:375: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError _______________________ test_app_add_event_handler[trio] _______________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_app_add_event_handler(test_client_factory: TestClientFactory) -> None: startup_complete = False cleanup_complete = False def run_startup() -> None: nonlocal startup_complete startup_complete = True def run_cleanup() -> None: nonlocal cleanup_complete cleanup_complete = True with pytest.deprecated_call(match="The on_startup and on_shutdown parameters are deprecated"): app = Starlette( on_startup=[run_startup], on_shutdown=[run_cleanup], ) assert not startup_complete assert not cleanup_complete > with test_client_factory(app): tests/test_applications.py:375: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError _____________________ test_app_async_cm_lifespan[asyncio] ______________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_app_async_cm_lifespan(test_client_factory: TestClientFactory) -> None: startup_complete = False cleanup_complete = False @asynccontextmanager async def lifespan(app: ASGIApp) -> AsyncGenerator[None, None]: nonlocal startup_complete, cleanup_complete startup_complete = True yield cleanup_complete = True app = Starlette(lifespan=lifespan) assert not startup_complete assert not cleanup_complete > with test_client_factory(app): tests/test_applications.py:397: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError _______________________ test_app_async_cm_lifespan[trio] _______________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_app_async_cm_lifespan(test_client_factory: TestClientFactory) -> None: startup_complete = False cleanup_complete = False @asynccontextmanager async def lifespan(app: ASGIApp) -> AsyncGenerator[None, None]: nonlocal startup_complete, cleanup_complete startup_complete = True yield cleanup_complete = True app = Starlette(lifespan=lifespan) assert not startup_complete assert not cleanup_complete > with test_client_factory(app): tests/test_applications.py:397: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError _____________________ test_app_async_gen_lifespan[asyncio] _____________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) @deprecated_lifespan def test_app_async_gen_lifespan(test_client_factory: TestClientFactory) -> None: startup_complete = False cleanup_complete = False async def lifespan(app: ASGIApp) -> AsyncGenerator[None, None]: nonlocal startup_complete, cleanup_complete startup_complete = True yield cleanup_complete = True app = Starlette(lifespan=lifespan) # type: ignore assert not startup_complete assert not cleanup_complete > with test_client_factory(app): tests/test_applications.py:428: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError ______________________ test_app_async_gen_lifespan[trio] _______________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) @deprecated_lifespan def test_app_async_gen_lifespan(test_client_factory: TestClientFactory) -> None: startup_complete = False cleanup_complete = False async def lifespan(app: ASGIApp) -> AsyncGenerator[None, None]: nonlocal startup_complete, cleanup_complete startup_complete = True yield cleanup_complete = True app = Starlette(lifespan=lifespan) # type: ignore assert not startup_complete assert not cleanup_complete > with test_client_factory(app): tests/test_applications.py:428: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError _____________________ test_app_sync_gen_lifespan[asyncio] ______________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) @deprecated_lifespan def test_app_sync_gen_lifespan(test_client_factory: TestClientFactory) -> None: startup_complete = False cleanup_complete = False def lifespan(app: ASGIApp) -> Generator[None, None, None]: nonlocal startup_complete, cleanup_complete startup_complete = True yield cleanup_complete = True app = Starlette(lifespan=lifespan) # type: ignore assert not startup_complete assert not cleanup_complete > with test_client_factory(app): tests/test_applications.py:450: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError _______________________ test_app_sync_gen_lifespan[trio] _______________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) @deprecated_lifespan def test_app_sync_gen_lifespan(test_client_factory: TestClientFactory) -> None: startup_complete = False cleanup_complete = False def lifespan(app: ASGIApp) -> Generator[None, None, None]: nonlocal startup_complete, cleanup_complete startup_complete = True yield cleanup_complete = True app = Starlette(lifespan=lifespan) # type: ignore assert not startup_complete assert not cleanup_complete > with test_client_factory(app): tests/test_applications.py:450: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError _____________________ test_middleware_stack_init[asyncio] ______________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_middleware_stack_init(test_client_factory: TestClientFactory) -> None: class NoOpMiddleware: def __init__(self, app: ASGIApp): self.app = app async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: await self.app(scope, receive, send) class SimpleInitializableMiddleware: counter = 0 def __init__(self, app: ASGIApp): self.app = app SimpleInitializableMiddleware.counter += 1 async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: await self.app(scope, receive, send) def get_app() -> ASGIApp: app = Starlette() app.add_middleware(SimpleInitializableMiddleware) app.add_middleware(NoOpMiddleware) return app app = get_app() > with test_client_factory(app): tests/test_applications.py:523: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError _______________________ test_middleware_stack_init[trio] _______________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_middleware_stack_init(test_client_factory: TestClientFactory) -> None: class NoOpMiddleware: def __init__(self, app: ASGIApp): self.app = app async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: await self.app(scope, receive, send) class SimpleInitializableMiddleware: counter = 0 def __init__(self, app: ASGIApp): self.app = app SimpleInitializableMiddleware.counter += 1 async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: await self.app(scope, receive, send) def get_app() -> ASGIApp: app = Starlette() app.add_middleware(SimpleInitializableMiddleware) app.add_middleware(NoOpMiddleware) return app app = get_app() > with test_client_factory(app): tests/test_applications.py:523: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError ________________________ test_middleware_args[asyncio] _________________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_middleware_args(test_client_factory: TestClientFactory) -> None: calls: list[str] = [] class MiddlewareWithArgs: def __init__(self, app: ASGIApp, arg: str) -> None: self.app = app self.arg = arg async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: calls.append(self.arg) await self.app(scope, receive, send) app = Starlette() app.add_middleware(MiddlewareWithArgs, "foo") app.add_middleware(MiddlewareWithArgs, "bar") > with test_client_factory(app): tests/test_applications.py:555: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError __________________________ test_middleware_args[trio] __________________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_middleware_args(test_client_factory: TestClientFactory) -> None: calls: list[str] = [] class MiddlewareWithArgs: def __init__(self, app: ASGIApp, arg: str) -> None: self.app = app self.arg = arg async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: calls.append(self.arg) await self.app(scope, receive, send) app = Starlette() app.add_middleware(MiddlewareWithArgs, "foo") app.add_middleware(MiddlewareWithArgs, "bar") > with test_client_factory(app): tests/test_applications.py:555: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError _______________________ test_middleware_factory[asyncio] _______________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_middleware_factory(test_client_factory: TestClientFactory) -> None: calls: list[str] = [] def _middleware_factory(app: ASGIApp, arg: str) -> ASGIApp: async def _app(scope: Scope, receive: Receive, send: Send) -> None: calls.append(arg) await app(scope, receive, send) return _app def get_middleware_factory() -> Callable[[ASGIApp, str], ASGIApp]: return _middleware_factory app = Starlette() app.add_middleware(_middleware_factory, arg="foo") app.add_middleware(get_middleware_factory(), "bar") > with test_client_factory(app): tests/test_applications.py:578: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError ________________________ test_middleware_factory[trio] _________________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_middleware_factory(test_client_factory: TestClientFactory) -> None: calls: list[str] = [] def _middleware_factory(app: ASGIApp, arg: str) -> ASGIApp: async def _app(scope: Scope, receive: Receive, send: Send) -> None: calls.append(arg) await app(scope, receive, send) return _app def get_middleware_factory() -> Callable[[ASGIApp, str], ASGIApp]: return _middleware_factory app = Starlette() app.add_middleware(_middleware_factory, arg="foo") app.add_middleware(get_middleware_factory(), "bar") > with test_client_factory(app): tests/test_applications.py:578: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError _________________________ test_user_interface[asyncio] _________________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_user_interface(test_client_factory: TestClientFactory) -> None: > with test_client_factory(app) as client: tests/test_authentication.py:213: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError __________________________ test_user_interface[trio] ___________________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_user_interface(test_client_factory: TestClientFactory) -> None: > with test_client_factory(app) as client: tests/test_authentication.py:213: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError ____________________ test_authentication_required[asyncio] _____________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_authentication_required(test_client_factory: TestClientFactory) -> None: > with test_client_factory(app) as client: tests/test_authentication.py:224: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError ______________________ test_authentication_required[trio] ______________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_authentication_required(test_client_factory: TestClientFactory) -> None: > with test_client_factory(app) as client: tests/test_authentication.py:224: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError _______________ test_websocket_authentication_required[asyncio] ________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_websocket_authentication_required( test_client_factory: TestClientFactory, ) -> None: > with test_client_factory(app) as client: tests/test_authentication.py:276: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError _________________ test_websocket_authentication_required[trio] _________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_websocket_authentication_required( test_client_factory: TestClientFactory, ) -> None: > with test_client_factory(app) as client: tests/test_authentication.py:276: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError ____________________ test_authentication_redirect[asyncio] _____________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_authentication_redirect(test_client_factory: TestClientFactory) -> None: > with test_client_factory(app) as client: tests/test_authentication.py:307: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError ______________________ test_authentication_redirect[trio] ______________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_authentication_redirect(test_client_factory: TestClientFactory) -> None: > with test_client_factory(app) as client: tests/test_authentication.py:307: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError ________________________ test_custom_on_error[asyncio] _________________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_custom_on_error(test_client_factory: TestClientFactory) -> None: > with test_client_factory(other_app) as client: tests/test_authentication.py:348: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError __________________________ test_custom_on_error[trio] __________________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_custom_on_error(test_client_factory: TestClientFactory) -> None: > with test_client_factory(other_app) as client: tests/test_authentication.py:348: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError _________________ test_websocket_endpoint_on_connect[asyncio] __________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_websocket_endpoint_on_connect(test_client_factory: TestClientFactory) -> None: class WebSocketApp(WebSocketEndpoint): async def on_connect(self, websocket: WebSocket) -> None: assert websocket["subprotocols"] == ["soap", "wamp"] await websocket.accept(subprotocol="wamp") client = test_client_factory(WebSocketApp) > with client.websocket_connect("/ws", subprotocols=["soap", "wamp"]) as websocket: tests/test_endpoints.py:57: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:456: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError ___________________ test_websocket_endpoint_on_connect[trio] ___________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_websocket_endpoint_on_connect(test_client_factory: TestClientFactory) -> None: class WebSocketApp(WebSocketEndpoint): async def on_connect(self, websocket: WebSocket) -> None: assert websocket["subprotocols"] == ["soap", "wamp"] await websocket.accept(subprotocol="wamp") client = test_client_factory(WebSocketApp) > with client.websocket_connect("/ws", subprotocols=["soap", "wamp"]) as websocket: tests/test_endpoints.py:57: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:456: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError ______________ test_websocket_endpoint_on_receive_bytes[asyncio] _______________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_websocket_endpoint_on_receive_bytes( test_client_factory: TestClientFactory, ) -> None: class WebSocketApp(WebSocketEndpoint): encoding = "bytes" async def on_receive(self, websocket: WebSocket, data: bytes) -> None: await websocket.send_bytes(b"Message bytes was: " + data) client = test_client_factory(WebSocketApp) > with client.websocket_connect("/ws") as websocket: tests/test_endpoints.py:71: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError ________________ test_websocket_endpoint_on_receive_bytes[trio] ________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_websocket_endpoint_on_receive_bytes( test_client_factory: TestClientFactory, ) -> None: class WebSocketApp(WebSocketEndpoint): encoding = "bytes" async def on_receive(self, websocket: WebSocket, data: bytes) -> None: await websocket.send_bytes(b"Message bytes was: " + data) client = test_client_factory(WebSocketApp) > with client.websocket_connect("/ws") as websocket: tests/test_endpoints.py:71: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:456: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError _______________ test_websocket_endpoint_on_receive_json[asyncio] _______________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_websocket_endpoint_on_receive_json( test_client_factory: TestClientFactory, ) -> None: class WebSocketApp(WebSocketEndpoint): encoding = "json" async def on_receive(self, websocket: WebSocket, data: str) -> None: await websocket.send_json({"message": data}) client = test_client_factory(WebSocketApp) > with client.websocket_connect("/ws") as websocket: tests/test_endpoints.py:91: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:456: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError ________________ test_websocket_endpoint_on_receive_json[trio] _________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_websocket_endpoint_on_receive_json( test_client_factory: TestClientFactory, ) -> None: class WebSocketApp(WebSocketEndpoint): encoding = "json" async def on_receive(self, websocket: WebSocket, data: str) -> None: await websocket.send_json({"message": data}) client = test_client_factory(WebSocketApp) > with client.websocket_connect("/ws") as websocket: tests/test_endpoints.py:91: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError ___________ test_websocket_endpoint_on_receive_json_binary[asyncio] ____________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_websocket_endpoint_on_receive_json_binary( test_client_factory: TestClientFactory, ) -> None: class WebSocketApp(WebSocketEndpoint): encoding = "json" async def on_receive(self, websocket: WebSocket, data: str) -> None: await websocket.send_json({"message": data}, mode="binary") client = test_client_factory(WebSocketApp) > with client.websocket_connect("/ws") as websocket: tests/test_endpoints.py:111: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:456: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError _____________ test_websocket_endpoint_on_receive_json_binary[trio] _____________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_websocket_endpoint_on_receive_json_binary( test_client_factory: TestClientFactory, ) -> None: class WebSocketApp(WebSocketEndpoint): encoding = "json" async def on_receive(self, websocket: WebSocket, data: str) -> None: await websocket.send_json({"message": data}, mode="binary") client = test_client_factory(WebSocketApp) > with client.websocket_connect("/ws") as websocket: tests/test_endpoints.py:111: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError _______________ test_websocket_endpoint_on_receive_text[asyncio] _______________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_websocket_endpoint_on_receive_text( test_client_factory: TestClientFactory, ) -> None: class WebSocketApp(WebSocketEndpoint): encoding = "text" async def on_receive(self, websocket: WebSocket, data: str) -> None: await websocket.send_text(f"Message text was: {data}") client = test_client_factory(WebSocketApp) > with client.websocket_connect("/ws") as websocket: tests/test_endpoints.py:127: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:456: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError ________________ test_websocket_endpoint_on_receive_text[trio] _________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_websocket_endpoint_on_receive_text( test_client_factory: TestClientFactory, ) -> None: class WebSocketApp(WebSocketEndpoint): encoding = "text" async def on_receive(self, websocket: WebSocket, data: str) -> None: await websocket.send_text(f"Message text was: {data}") client = test_client_factory(WebSocketApp) > with client.websocket_connect("/ws") as websocket: tests/test_endpoints.py:127: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError _________________ test_websocket_endpoint_on_default[asyncio] __________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_websocket_endpoint_on_default(test_client_factory: TestClientFactory) -> None: class WebSocketApp(WebSocketEndpoint): encoding = None async def on_receive(self, websocket: WebSocket, data: str) -> None: await websocket.send_text(f"Message text was: {data}") client = test_client_factory(WebSocketApp) > with client.websocket_connect("/ws") as websocket: tests/test_endpoints.py:145: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:456: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError ___________________ test_websocket_endpoint_on_default[trio] ___________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_websocket_endpoint_on_default(test_client_factory: TestClientFactory) -> None: class WebSocketApp(WebSocketEndpoint): encoding = None async def on_receive(self, websocket: WebSocket, data: str) -> None: await websocket.send_text(f"Message text was: {data}") client = test_client_factory(WebSocketApp) > with client.websocket_connect("/ws") as websocket: tests/test_endpoints.py:145: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:456: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError ________________ test_websocket_endpoint_on_disconnect[asyncio] ________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_websocket_endpoint_on_disconnect( test_client_factory: TestClientFactory, ) -> None: class WebSocketApp(WebSocketEndpoint): async def on_disconnect(self, websocket: WebSocket, close_code: int) -> None: assert close_code == 1001 await websocket.close(code=close_code) client = test_client_factory(WebSocketApp) > with client.websocket_connect("/ws") as websocket: tests/test_endpoints.py:160: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError _________________ test_websocket_endpoint_on_disconnect[trio] __________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_websocket_endpoint_on_disconnect( test_client_factory: TestClientFactory, ) -> None: class WebSocketApp(WebSocketEndpoint): async def on_disconnect(self, websocket: WebSocket, close_code: int) -> None: assert close_code == 1001 await websocket.close(code=close_code) client = test_client_factory(WebSocketApp) > with client.websocket_connect("/ws") as websocket: tests/test_endpoints.py:160: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:456: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError ________________________ test_protocol_switch[asyncio] _________________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_protocol_switch(test_client_factory: TestClientFactory) -> None: client = test_client_factory(mixed_protocol_app) response = client.get("/") assert response.status_code == 200 assert response.text == "URL: http://testserver/" > with client.websocket_connect("/") as session: tests/test_routing.py:363: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:456: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError __________________________ test_protocol_switch[trio] __________________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_protocol_switch(test_client_factory: TestClientFactory) -> None: client = test_client_factory(mixed_protocol_app) response = client.get("/") assert response.status_code == 200 assert response.text == "URL: http://testserver/" > with client.websocket_connect("/") as session: tests/test_routing.py:363: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError __________________ test_standalone_ws_route_matches[asyncio] ___________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_standalone_ws_route_matches( test_client_factory: TestClientFactory, ) -> None: app = WebSocketRoute("/", ws_helloworld) client = test_client_factory(app) > with client.websocket_connect("/") as websocket: tests/test_routing.py:609: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:456: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError ____________________ test_standalone_ws_route_matches[trio] ____________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_standalone_ws_route_matches( test_client_factory: TestClientFactory, ) -> None: app = WebSocketRoute("/", ws_helloworld) client = test_client_factory(app) > with client.websocket_connect("/") as websocket: tests/test_routing.py:609: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError _______________ test_standalone_ws_route_does_not_match[asyncio] _______________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_standalone_ws_route_does_not_match( test_client_factory: TestClientFactory, ) -> None: app = WebSocketRoute("/", ws_helloworld) client = test_client_factory(app) with pytest.raises(WebSocketDisconnect): > with client.websocket_connect("/invalid"): tests/test_routing.py:620: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:456: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError ________________ test_standalone_ws_route_does_not_match[trio] _________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_standalone_ws_route_does_not_match( test_client_factory: TestClientFactory, ) -> None: app = WebSocketRoute("/", ws_helloworld) client = test_client_factory(app) with pytest.raises(WebSocketDisconnect): > with client.websocket_connect("/invalid"): tests/test_routing.py:620: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError _________________________ test_lifespan_async[asyncio] _________________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_lifespan_async(test_client_factory: TestClientFactory) -> None: startup_complete = False shutdown_complete = False async def hello_world(request: Request) -> PlainTextResponse: return PlainTextResponse("hello, world") async def run_startup() -> None: nonlocal startup_complete startup_complete = True async def run_shutdown() -> None: nonlocal shutdown_complete shutdown_complete = True with pytest.deprecated_call(match="The on_startup and on_shutdown parameters are deprecated"): app = Router( on_startup=[run_startup], on_shutdown=[run_shutdown], routes=[Route("/", hello_world)], ) assert not startup_complete assert not shutdown_complete > with test_client_factory(app) as client: tests/test_routing.py:648: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError __________________________ test_lifespan_async[trio] ___________________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_lifespan_async(test_client_factory: TestClientFactory) -> None: startup_complete = False shutdown_complete = False async def hello_world(request: Request) -> PlainTextResponse: return PlainTextResponse("hello, world") async def run_startup() -> None: nonlocal startup_complete startup_complete = True async def run_shutdown() -> None: nonlocal shutdown_complete shutdown_complete = True with pytest.deprecated_call(match="The on_startup and on_shutdown parameters are deprecated"): app = Router( on_startup=[run_startup], on_shutdown=[run_shutdown], routes=[Route("/", hello_world)], ) assert not startup_complete assert not shutdown_complete > with test_client_factory(app) as client: tests/test_routing.py:648: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError _________________________ test_lifespan_sync[asyncio] __________________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_lifespan_sync(test_client_factory: TestClientFactory) -> None: startup_complete = False shutdown_complete = False def hello_world(request: Request) -> PlainTextResponse: return PlainTextResponse("hello, world") def run_startup() -> None: nonlocal startup_complete startup_complete = True def run_shutdown() -> None: nonlocal shutdown_complete shutdown_complete = True with pytest.deprecated_call(match="The on_startup and on_shutdown parameters are deprecated"): app = Router( on_startup=[run_startup], on_shutdown=[run_shutdown], routes=[Route("/", hello_world)], ) assert not startup_complete assert not shutdown_complete > with test_client_factory(app) as client: tests/test_routing.py:720: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError ___________________________ test_lifespan_sync[trio] ___________________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_lifespan_sync(test_client_factory: TestClientFactory) -> None: startup_complete = False shutdown_complete = False def hello_world(request: Request) -> PlainTextResponse: return PlainTextResponse("hello, world") def run_startup() -> None: nonlocal startup_complete startup_complete = True def run_shutdown() -> None: nonlocal shutdown_complete shutdown_complete = True with pytest.deprecated_call(match="The on_startup and on_shutdown parameters are deprecated"): app = Router( on_startup=[run_startup], on_shutdown=[run_shutdown], routes=[Route("/", hello_world)], ) assert not startup_complete assert not shutdown_complete > with test_client_factory(app) as client: tests/test_routing.py:720: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError ___________________ test_lifespan_state_unsupported[asyncio] ___________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_lifespan_state_unsupported( test_client_factory: TestClientFactory, ) -> None: @contextlib.asynccontextmanager async def lifespan( app: ASGIApp, ) -> typing.AsyncGenerator[dict[str, str], None]: yield {"foo": "bar"} app = Router( lifespan=lifespan, routes=[Mount("/", PlainTextResponse("hello, world"))], ) async def no_state_wrapper(scope: Scope, receive: Receive, send: Send) -> None: del scope["state"] await app(scope, receive, send) with pytest.raises(RuntimeError, match='The server does not support "state" in the lifespan scope'): > with test_client_factory(no_state_wrapper): tests/test_routing.py:747: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError ____________________ test_lifespan_state_unsupported[trio] _____________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_lifespan_state_unsupported( test_client_factory: TestClientFactory, ) -> None: @contextlib.asynccontextmanager async def lifespan( app: ASGIApp, ) -> typing.AsyncGenerator[dict[str, str], None]: yield {"foo": "bar"} app = Router( lifespan=lifespan, routes=[Mount("/", PlainTextResponse("hello, world"))], ) async def no_state_wrapper(scope: Scope, receive: Receive, send: Send) -> None: del scope["state"] await app(scope, receive, send) with pytest.raises(RuntimeError, match='The server does not support "state" in the lifespan scope'): > with test_client_factory(no_state_wrapper): tests/test_routing.py:747: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError ____________________ test_lifespan_state_async_cm[asyncio] _____________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_lifespan_state_async_cm(test_client_factory: TestClientFactory) -> None: startup_complete = False shutdown_complete = False class State(typing.TypedDict): count: int items: list[int] async def hello_world(request: Request) -> Response: # modifications to the state should not leak across requests assert request.state.count == 0 # modify the state, this should not leak to the lifespan or other requests request.state.count += 1 # since state.items is a mutable object this modification _will_ leak across # requests and to the lifespan request.state.items.append(1) return PlainTextResponse("hello, world") @contextlib.asynccontextmanager async def lifespan(app: Starlette) -> typing.AsyncIterator[State]: nonlocal startup_complete, shutdown_complete startup_complete = True state = State(count=0, items=[]) yield state shutdown_complete = True # modifications made to the state from a request do not leak to the lifespan assert state["count"] == 0 # unless of course the request mutates a mutable object that is referenced # via state assert state["items"] == [1, 1] app = Router( lifespan=lifespan, routes=[Route("/", hello_world)], ) assert not startup_complete assert not shutdown_complete > with test_client_factory(app) as client: tests/test_routing.py:789: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError ______________________ test_lifespan_state_async_cm[trio] ______________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_lifespan_state_async_cm(test_client_factory: TestClientFactory) -> None: startup_complete = False shutdown_complete = False class State(typing.TypedDict): count: int items: list[int] async def hello_world(request: Request) -> Response: # modifications to the state should not leak across requests assert request.state.count == 0 # modify the state, this should not leak to the lifespan or other requests request.state.count += 1 # since state.items is a mutable object this modification _will_ leak across # requests and to the lifespan request.state.items.append(1) return PlainTextResponse("hello, world") @contextlib.asynccontextmanager async def lifespan(app: Starlette) -> typing.AsyncIterator[State]: nonlocal startup_complete, shutdown_complete startup_complete = True state = State(count=0, items=[]) yield state shutdown_complete = True # modifications made to the state from a request do not leak to the lifespan assert state["count"] == 0 # unless of course the request mutates a mutable object that is referenced # via state assert state["items"] == [1, 1] app = Router( lifespan=lifespan, routes=[Route("/", hello_world)], ) assert not startup_complete assert not shutdown_complete > with test_client_factory(app) as client: tests/test_routing.py:789: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError ________________________ test_raise_on_startup[asyncio] ________________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_raise_on_startup(test_client_factory: TestClientFactory) -> None: def run_startup() -> None: raise RuntimeError() with pytest.deprecated_call(match="The on_startup and on_shutdown parameters are deprecated"): router = Router(on_startup=[run_startup]) startup_failed = False async def app(scope: Scope, receive: Receive, send: Send) -> None: async def _send(message: Message) -> None: nonlocal startup_failed if message["type"] == "lifespan.startup.failed": # pragma: no branch startup_failed = True return await send(message) await router(scope, receive, _send) with pytest.raises(RuntimeError): > with test_client_factory(app): tests/test_routing.py:817: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError _________________________ test_raise_on_startup[trio] __________________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_raise_on_startup(test_client_factory: TestClientFactory) -> None: def run_startup() -> None: raise RuntimeError() with pytest.deprecated_call(match="The on_startup and on_shutdown parameters are deprecated"): router = Router(on_startup=[run_startup]) startup_failed = False async def app(scope: Scope, receive: Receive, send: Send) -> None: async def _send(message: Message) -> None: nonlocal startup_failed if message["type"] == "lifespan.startup.failed": # pragma: no branch startup_failed = True return await send(message) await router(scope, receive, _send) with pytest.raises(RuntimeError): > with test_client_factory(app): tests/test_routing.py:817: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError _______________________ test_raise_on_shutdown[asyncio] ________________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_raise_on_shutdown(test_client_factory: TestClientFactory) -> None: def run_shutdown() -> None: raise RuntimeError() with pytest.deprecated_call(match="The on_startup and on_shutdown parameters are deprecated"): app = Router(on_shutdown=[run_shutdown]) with pytest.raises(RuntimeError): > with test_client_factory(app): tests/test_routing.py:830: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError _________________________ test_raise_on_shutdown[trio] _________________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_raise_on_shutdown(test_client_factory: TestClientFactory) -> None: def run_shutdown() -> None: raise RuntimeError() with pytest.deprecated_call(match="The on_startup and on_shutdown parameters are deprecated"): app = Router(on_shutdown=[run_shutdown]) with pytest.raises(RuntimeError): > with test_client_factory(app): tests/test_routing.py:830: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError ___________________ test_partial_async_ws_endpoint[asyncio] ____________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_partial_async_ws_endpoint( test_client_factory: TestClientFactory, ) -> None: test_client = test_client_factory(app) > with test_client.websocket_connect("/partial/ws") as websocket: tests/test_routing.py:849: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:456: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError _____________________ test_partial_async_ws_endpoint[trio] _____________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_partial_async_ws_endpoint( test_client_factory: TestClientFactory, ) -> None: test_client = test_client_factory(app) > with test_client.websocket_connect("/partial/ws") as websocket: tests/test_routing.py:849: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError ___________________ test_websocket_route_middleware[asyncio] ___________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_websocket_route_middleware( test_client_factory: TestClientFactory, ) -> None: async def websocket_endpoint(session: WebSocket) -> None: await session.accept() await session.send_text("Hello, world!") await session.close() class WebsocketMiddleware: def __init__(self, app: ASGIApp) -> None: self.app = app async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: async def modified_send(msg: Message) -> None: if msg["type"] == "websocket.accept": msg["headers"].append((b"X-Test", b"Set by middleware")) await send(msg) await self.app(scope, receive, modified_send) app = Starlette( routes=[ WebSocketRoute( "/ws", endpoint=websocket_endpoint, middleware=[Middleware(WebsocketMiddleware)], ) ] ) client = test_client_factory(app) > with client.websocket_connect("/ws") as websocket: tests/test_routing.py:1127: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError ____________________ test_websocket_route_middleware[trio] _____________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_websocket_route_middleware( test_client_factory: TestClientFactory, ) -> None: async def websocket_endpoint(session: WebSocket) -> None: await session.accept() await session.send_text("Hello, world!") await session.close() class WebsocketMiddleware: def __init__(self, app: ASGIApp) -> None: self.app = app async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: async def modified_send(msg: Message) -> None: if msg["type"] == "websocket.accept": msg["headers"].append((b"X-Test", b"Set by middleware")) await send(msg) await self.app(scope, receive, modified_send) app = Starlette( routes=[ WebSocketRoute( "/ws", endpoint=websocket_endpoint, middleware=[Middleware(WebsocketMiddleware)], ) ] ) client = test_client_factory(app) > with client.websocket_connect("/ws") as websocket: tests/test_routing.py:1127: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError ________________ test_staticfiles_head_with_middleware[asyncio] ________________ tmpdir = local('/tmp/pytest-of-mockbuild/pytest-0/test_staticfiles_head_with_mid0') test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_staticfiles_head_with_middleware(tmpdir: Path, test_client_factory: TestClientFactory) -> None: """ see https://github.com/encode/starlette/pull/935 """ path = os.path.join(tmpdir, "example.txt") with open(path, "w") as file: file.write("x" * 100) async def does_nothing_middleware(request: Request, call_next: RequestResponseEndpoint) -> Response: response = await call_next(request) return response routes = [Mount("/static", app=StaticFiles(directory=tmpdir), name="static")] middleware = [Middleware(BaseHTTPMiddleware, dispatch=does_nothing_middleware)] app = Starlette(routes=routes, middleware=middleware) client = test_client_factory(app) > response = client.head("/static/example.txt") tests/test_staticfiles.py:63: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:502: in head return super().head( /usr/lib/python3.13/site-packages/httpx/_client.py:1124: in head return self.request( starlette/testclient.py:428: in request return super().request( /usr/lib/python3.13/site-packages/httpx/_client.py:837: in request return self.send(request, auth=auth, follow_redirects=follow_redirects) /usr/lib/python3.13/site-packages/httpx/_client.py:926: in send response = self._send_handling_auth( /usr/lib/python3.13/site-packages/httpx/_client.py:954: in _send_handling_auth response = self._send_handling_redirects( /usr/lib/python3.13/site-packages/httpx/_client.py:991: in _send_handling_redirects response = self._send_single_request(request) /usr/lib/python3.13/site-packages/httpx/_client.py:1027: in _send_single_request response = transport.handle_request(request) starlette/testclient.py:337: in handle_request raise exc starlette/testclient.py:334: in handle_request portal.call(self.app, scope, receive, send) /usr/lib/python3.13/site-packages/anyio/from_thread.py:277: in call return cast(T_Retval, self.start_task_soon(func, *args).result()) /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval starlette/applications.py:112: in __call__ await self.middleware_stack(scope, receive, send) starlette/middleware/errors.py:187: in __call__ raise exc starlette/middleware/errors.py:165: in __call__ await self.app(scope, receive, _send) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = scope = {'app': , 'client': ('testclient', 50000), 'extensions': {'... b'*/*'), (b'accept-encoding', b'gzip, deflate'), (b'connection', b'keep-alive'), (b'user-agent', b'testclient')], ...} receive = .receive at 0x7f25d231a520> send = ._send at 0x7f25d8cbc9a0> async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: if scope["type"] != "http": await self.app(scope, receive, send) return request = _CachedRequest(scope, receive) wrapped_receive = request.wrapped_receive response_sent = anyio.Event() async def call_next(request: Request) -> Response: app_exc: Exception | None = None async def receive_or_disconnect() -> Message: if response_sent.is_set(): return {"type": "http.disconnect"} async with anyio.create_task_group() as task_group: async def wrap(func: typing.Callable[[], typing.Awaitable[T]]) -> T: result = await func() task_group.cancel_scope.cancel() return result task_group.start_soon(wrap, response_sent.wait) message = await wrap(wrapped_receive) if response_sent.is_set(): return {"type": "http.disconnect"} return message async def send_no_error(message: Message) -> None: try: await send_stream.send(message) except anyio.BrokenResourceError: # recv_stream has been closed, i.e. response_sent has been set. return async def coro() -> None: nonlocal app_exc with send_stream: try: await self.app(scope, receive_or_disconnect, send_no_error) except Exception as exc: app_exc = exc task_group.start_soon(coro) try: message = await recv_stream.receive() info = message.get("info", None) if message["type"] == "http.response.debug" and info is not None: message = await recv_stream.receive() except anyio.EndOfStream: if app_exc is not None: raise app_exc raise RuntimeError("No response returned.") assert message["type"] == "http.response.start" async def body_stream() -> typing.AsyncGenerator[bytes, None]: async for message in recv_stream: assert message["type"] == "http.response.body" body = message.get("body", b"") if body: yield body if not message.get("more_body", False): break if app_exc is not None: raise app_exc response = _StreamingResponse(status_code=message["status"], content=body_stream(), info=info) response.raw_headers = message["headers"] return response > send_stream, recv_stream = anyio.create_memory_object_stream[Message]() E TypeError: 'function' object is not subscriptable starlette/middleware/base.py:175: TypeError _________________ test_staticfiles_head_with_middleware[trio] __________________ tmpdir = local('/tmp/pytest-of-mockbuild/pytest-0/test_staticfiles_head_with_mid1') test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_staticfiles_head_with_middleware(tmpdir: Path, test_client_factory: TestClientFactory) -> None: """ see https://github.com/encode/starlette/pull/935 """ path = os.path.join(tmpdir, "example.txt") with open(path, "w") as file: file.write("x" * 100) async def does_nothing_middleware(request: Request, call_next: RequestResponseEndpoint) -> Response: response = await call_next(request) return response routes = [Mount("/static", app=StaticFiles(directory=tmpdir), name="static")] middleware = [Middleware(BaseHTTPMiddleware, dispatch=does_nothing_middleware)] app = Starlette(routes=routes, middleware=middleware) client = test_client_factory(app) > response = client.head("/static/example.txt") tests/test_staticfiles.py:63: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:502: in head return super().head( /usr/lib/python3.13/site-packages/httpx/_client.py:1124: in head return self.request( starlette/testclient.py:428: in request return super().request( /usr/lib/python3.13/site-packages/httpx/_client.py:837: in request return self.send(request, auth=auth, follow_redirects=follow_redirects) /usr/lib/python3.13/site-packages/httpx/_client.py:926: in send response = self._send_handling_auth( /usr/lib/python3.13/site-packages/httpx/_client.py:954: in _send_handling_auth response = self._send_handling_redirects( /usr/lib/python3.13/site-packages/httpx/_client.py:991: in _send_handling_redirects response = self._send_single_request(request) /usr/lib/python3.13/site-packages/httpx/_client.py:1027: in _send_single_request response = transport.handle_request(request) starlette/testclient.py:337: in handle_request raise exc starlette/testclient.py:334: in handle_request portal.call(self.app, scope, receive, send) /usr/lib/python3.13/site-packages/anyio/from_thread.py:277: in call return cast(T_Retval, self.start_task_soon(func, *args).result()) /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval starlette/applications.py:112: in __call__ await self.middleware_stack(scope, receive, send) starlette/middleware/errors.py:187: in __call__ raise exc starlette/middleware/errors.py:165: in __call__ await self.app(scope, receive, _send) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = scope = {'app': , 'client': ('testclient', 50000), 'extensions': {'... b'*/*'), (b'accept-encoding', b'gzip, deflate'), (b'connection', b'keep-alive'), (b'user-agent', b'testclient')], ...} receive = .receive at 0x7f25d231b560> send = ._send at 0x7f25d8d3a980> async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: if scope["type"] != "http": await self.app(scope, receive, send) return request = _CachedRequest(scope, receive) wrapped_receive = request.wrapped_receive response_sent = anyio.Event() async def call_next(request: Request) -> Response: app_exc: Exception | None = None async def receive_or_disconnect() -> Message: if response_sent.is_set(): return {"type": "http.disconnect"} async with anyio.create_task_group() as task_group: async def wrap(func: typing.Callable[[], typing.Awaitable[T]]) -> T: result = await func() task_group.cancel_scope.cancel() return result task_group.start_soon(wrap, response_sent.wait) message = await wrap(wrapped_receive) if response_sent.is_set(): return {"type": "http.disconnect"} return message async def send_no_error(message: Message) -> None: try: await send_stream.send(message) except anyio.BrokenResourceError: # recv_stream has been closed, i.e. response_sent has been set. return async def coro() -> None: nonlocal app_exc with send_stream: try: await self.app(scope, receive_or_disconnect, send_no_error) except Exception as exc: app_exc = exc task_group.start_soon(coro) try: message = await recv_stream.receive() info = message.get("info", None) if message["type"] == "http.response.debug" and info is not None: message = await recv_stream.receive() except anyio.EndOfStream: if app_exc is not None: raise app_exc raise RuntimeError("No response returned.") assert message["type"] == "http.response.start" async def body_stream() -> typing.AsyncGenerator[bytes, None]: async for message in recv_stream: assert message["type"] == "http.response.body" body = message.get("body", b"") if body: yield body if not message.get("more_body", False): break if app_exc is not None: raise app_exc response = _StreamingResponse(status_code=message["status"], content=body_stream(), info=info) response.raw_headers = message["headers"] return response > send_stream, recv_stream = anyio.create_memory_object_stream[Message]() E TypeError: 'function' object is not subscriptable starlette/middleware/base.py:175: TypeError ____________________ test_template_with_middleware[asyncio] ____________________ tmpdir = local('/tmp/pytest-of-mockbuild/pytest-0/test_template_with_middleware_0') test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_template_with_middleware(tmpdir: Path, test_client_factory: TestClientFactory) -> None: path = os.path.join(tmpdir, "index.html") with open(path, "w") as file: file.write("Hello, world") async def homepage(request: Request) -> Response: return templates.TemplateResponse(request, "index.html") class CustomMiddleware(BaseHTTPMiddleware): async def dispatch(self, request: Request, call_next: RequestResponseEndpoint) -> Response: return await call_next(request) app = Starlette( debug=True, routes=[Route("/", endpoint=homepage)], middleware=[Middleware(CustomMiddleware)], ) templates = Jinja2Templates(directory=str(tmpdir)) client = test_client_factory(app) > response = client.get("/") tests/test_templates.py:87: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:456: in get return super().get( /usr/lib/python3.13/site-packages/httpx/_client.py:1066: in get return self.request( starlette/testclient.py:428: in request return super().request( /usr/lib/python3.13/site-packages/httpx/_client.py:837: in request return self.send(request, auth=auth, follow_redirects=follow_redirects) /usr/lib/python3.13/site-packages/httpx/_client.py:926: in send response = self._send_handling_auth( /usr/lib/python3.13/site-packages/httpx/_client.py:954: in _send_handling_auth response = self._send_handling_redirects( /usr/lib/python3.13/site-packages/httpx/_client.py:991: in _send_handling_redirects response = self._send_single_request(request) /usr/lib/python3.13/site-packages/httpx/_client.py:1027: in _send_single_request response = transport.handle_request(request) starlette/testclient.py:337: in handle_request raise exc starlette/testclient.py:334: in handle_request portal.call(self.app, scope, receive, send) /usr/lib/python3.13/site-packages/anyio/from_thread.py:277: in call return cast(T_Retval, self.start_task_soon(func, *args).result()) /usr/lib64/python3.13/concurrent/futures/_base.py:456: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval starlette/applications.py:112: in __call__ await self.middleware_stack(scope, receive, send) starlette/middleware/errors.py:187: in __call__ raise exc starlette/middleware/errors.py:165: in __call__ await self.app(scope, receive, _send) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = .CustomMiddleware object at 0x7f25d9cd2cf0> scope = {'app': , 'client': ('testclient', 50000), 'extensions': {'... b'*/*'), (b'accept-encoding', b'gzip, deflate'), (b'connection', b'keep-alive'), (b'user-agent', b'testclient')], ...} receive = .receive at 0x7f25d8c285e0> send = ._send at 0x7f25d8c29e40> async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: if scope["type"] != "http": await self.app(scope, receive, send) return request = _CachedRequest(scope, receive) wrapped_receive = request.wrapped_receive response_sent = anyio.Event() async def call_next(request: Request) -> Response: app_exc: Exception | None = None async def receive_or_disconnect() -> Message: if response_sent.is_set(): return {"type": "http.disconnect"} async with anyio.create_task_group() as task_group: async def wrap(func: typing.Callable[[], typing.Awaitable[T]]) -> T: result = await func() task_group.cancel_scope.cancel() return result task_group.start_soon(wrap, response_sent.wait) message = await wrap(wrapped_receive) if response_sent.is_set(): return {"type": "http.disconnect"} return message async def send_no_error(message: Message) -> None: try: await send_stream.send(message) except anyio.BrokenResourceError: # recv_stream has been closed, i.e. response_sent has been set. return async def coro() -> None: nonlocal app_exc with send_stream: try: await self.app(scope, receive_or_disconnect, send_no_error) except Exception as exc: app_exc = exc task_group.start_soon(coro) try: message = await recv_stream.receive() info = message.get("info", None) if message["type"] == "http.response.debug" and info is not None: message = await recv_stream.receive() except anyio.EndOfStream: if app_exc is not None: raise app_exc raise RuntimeError("No response returned.") assert message["type"] == "http.response.start" async def body_stream() -> typing.AsyncGenerator[bytes, None]: async for message in recv_stream: assert message["type"] == "http.response.body" body = message.get("body", b"") if body: yield body if not message.get("more_body", False): break if app_exc is not None: raise app_exc response = _StreamingResponse(status_code=message["status"], content=body_stream(), info=info) response.raw_headers = message["headers"] return response > send_stream, recv_stream = anyio.create_memory_object_stream[Message]() E TypeError: 'function' object is not subscriptable starlette/middleware/base.py:175: TypeError _____________________ test_template_with_middleware[trio] ______________________ tmpdir = local('/tmp/pytest-of-mockbuild/pytest-0/test_template_with_middleware_1') test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_template_with_middleware(tmpdir: Path, test_client_factory: TestClientFactory) -> None: path = os.path.join(tmpdir, "index.html") with open(path, "w") as file: file.write("Hello, world") async def homepage(request: Request) -> Response: return templates.TemplateResponse(request, "index.html") class CustomMiddleware(BaseHTTPMiddleware): async def dispatch(self, request: Request, call_next: RequestResponseEndpoint) -> Response: return await call_next(request) app = Starlette( debug=True, routes=[Route("/", endpoint=homepage)], middleware=[Middleware(CustomMiddleware)], ) templates = Jinja2Templates(directory=str(tmpdir)) client = test_client_factory(app) > response = client.get("/") tests/test_templates.py:87: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:456: in get return super().get( /usr/lib/python3.13/site-packages/httpx/_client.py:1066: in get return self.request( starlette/testclient.py:428: in request return super().request( /usr/lib/python3.13/site-packages/httpx/_client.py:837: in request return self.send(request, auth=auth, follow_redirects=follow_redirects) /usr/lib/python3.13/site-packages/httpx/_client.py:926: in send response = self._send_handling_auth( /usr/lib/python3.13/site-packages/httpx/_client.py:954: in _send_handling_auth response = self._send_handling_redirects( /usr/lib/python3.13/site-packages/httpx/_client.py:991: in _send_handling_redirects response = self._send_single_request(request) /usr/lib/python3.13/site-packages/httpx/_client.py:1027: in _send_single_request response = transport.handle_request(request) starlette/testclient.py:337: in handle_request raise exc starlette/testclient.py:334: in handle_request portal.call(self.app, scope, receive, send) /usr/lib/python3.13/site-packages/anyio/from_thread.py:277: in call return cast(T_Retval, self.start_task_soon(func, *args).result()) /usr/lib64/python3.13/concurrent/futures/_base.py:456: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval starlette/applications.py:112: in __call__ await self.middleware_stack(scope, receive, send) starlette/middleware/errors.py:187: in __call__ raise exc starlette/middleware/errors.py:165: in __call__ await self.app(scope, receive, _send) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = .CustomMiddleware object at 0x7f25da262510> scope = {'app': , 'client': ('testclient', 50000), 'extensions': {'... b'*/*'), (b'accept-encoding', b'gzip, deflate'), (b'connection', b'keep-alive'), (b'user-agent', b'testclient')], ...} receive = .receive at 0x7f25d8cbe020> send = ._send at 0x7f25d8bbb9c0> async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: if scope["type"] != "http": await self.app(scope, receive, send) return request = _CachedRequest(scope, receive) wrapped_receive = request.wrapped_receive response_sent = anyio.Event() async def call_next(request: Request) -> Response: app_exc: Exception | None = None async def receive_or_disconnect() -> Message: if response_sent.is_set(): return {"type": "http.disconnect"} async with anyio.create_task_group() as task_group: async def wrap(func: typing.Callable[[], typing.Awaitable[T]]) -> T: result = await func() task_group.cancel_scope.cancel() return result task_group.start_soon(wrap, response_sent.wait) message = await wrap(wrapped_receive) if response_sent.is_set(): return {"type": "http.disconnect"} return message async def send_no_error(message: Message) -> None: try: await send_stream.send(message) except anyio.BrokenResourceError: # recv_stream has been closed, i.e. response_sent has been set. return async def coro() -> None: nonlocal app_exc with send_stream: try: await self.app(scope, receive_or_disconnect, send_no_error) except Exception as exc: app_exc = exc task_group.start_soon(coro) try: message = await recv_stream.receive() info = message.get("info", None) if message["type"] == "http.response.debug" and info is not None: message = await recv_stream.receive() except anyio.EndOfStream: if app_exc is not None: raise app_exc raise RuntimeError("No response returned.") assert message["type"] == "http.response.start" async def body_stream() -> typing.AsyncGenerator[bytes, None]: async for message in recv_stream: assert message["type"] == "http.response.body" body = message.get("body", b"") if body: yield body if not message.get("more_body", False): break if app_exc is not None: raise app_exc response = _StreamingResponse(status_code=message["status"], content=body_stream(), info=info) response.raw_headers = message["headers"] return response > send_stream, recv_stream = anyio.create_memory_object_stream[Message]() E TypeError: 'function' object is not subscriptable starlette/middleware/base.py:175: TypeError ________________ test_use_testclient_as_contextmanager[asyncio] ________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) anyio_backend_name = 'asyncio' def test_use_testclient_as_contextmanager(test_client_factory: TestClientFactory, anyio_backend_name: str) -> None: """ This test asserts a number of properties that are important for an app level task_group """ counter = itertools.count() identity_runvar = anyio.lowlevel.RunVar[int]("identity_runvar") def get_identity() -> int: try: return identity_runvar.get() except LookupError: token = next(counter) identity_runvar.set(token) return token startup_task = object() startup_loop = None shutdown_task = object() shutdown_loop = None @asynccontextmanager async def lifespan_context(app: Starlette) -> AsyncGenerator[None, None]: nonlocal startup_task, startup_loop, shutdown_task, shutdown_loop startup_task = current_task() startup_loop = get_identity() async with anyio.create_task_group(): yield shutdown_task = current_task() shutdown_loop = get_identity() async def loop_id(request: Request) -> JSONResponse: return JSONResponse(get_identity()) app = Starlette( lifespan=lifespan_context, routes=[Route("/loop_id", endpoint=loop_id)], ) client = test_client_factory(app) > with client: tests/test_testclient.py:134: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError _________________ test_use_testclient_as_contextmanager[trio] __________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) anyio_backend_name = 'trio' def test_use_testclient_as_contextmanager(test_client_factory: TestClientFactory, anyio_backend_name: str) -> None: """ This test asserts a number of properties that are important for an app level task_group """ counter = itertools.count() identity_runvar = anyio.lowlevel.RunVar[int]("identity_runvar") def get_identity() -> int: try: return identity_runvar.get() except LookupError: token = next(counter) identity_runvar.set(token) return token startup_task = object() startup_loop = None shutdown_task = object() shutdown_loop = None @asynccontextmanager async def lifespan_context(app: Starlette) -> AsyncGenerator[None, None]: nonlocal startup_task, startup_loop, shutdown_task, shutdown_loop startup_task = current_task() startup_loop = get_identity() async with anyio.create_task_group(): yield shutdown_task = current_task() shutdown_loop = get_identity() async def loop_id(request: Request) -> JSONResponse: return JSONResponse(get_identity()) app = Starlette( lifespan=lifespan_context, routes=[Route("/loop_id", endpoint=loop_id)], ) client = test_client_factory(app) > with client: tests/test_testclient.py:134: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError ________________________ test_error_on_startup[asyncio] ________________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_error_on_startup(test_client_factory: TestClientFactory) -> None: with pytest.deprecated_call(match="The on_startup and on_shutdown parameters are deprecated"): startup_error_app = Starlette(on_startup=[startup]) with pytest.raises(RuntimeError): > with test_client_factory(startup_error_app): tests/test_testclient.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError _________________________ test_error_on_startup[trio] __________________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_error_on_startup(test_client_factory: TestClientFactory) -> None: with pytest.deprecated_call(match="The on_startup and on_shutdown parameters are deprecated"): startup_error_app = Starlette(on_startup=[startup]) with pytest.raises(RuntimeError): > with test_client_factory(startup_error_app): tests/test_testclient.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError ____________________ test_exception_in_middleware[asyncio] _____________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_exception_in_middleware(test_client_factory: TestClientFactory) -> None: class MiddlewareException(Exception): pass class BrokenMiddleware: def __init__(self, app: ASGIApp): self.app = app async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: raise MiddlewareException() broken_middleware = Starlette(middleware=[Middleware(BrokenMiddleware)]) with pytest.raises(MiddlewareException): > with test_client_factory(broken_middleware): tests/test_testclient.py:193: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError ______________________ test_exception_in_middleware[trio] ______________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_exception_in_middleware(test_client_factory: TestClientFactory) -> None: class MiddlewareException(Exception): pass class BrokenMiddleware: def __init__(self, app: ASGIApp): self.app = app async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: raise MiddlewareException() broken_middleware = Starlette(middleware=[Middleware(BrokenMiddleware)]) with pytest.raises(MiddlewareException): > with test_client_factory(broken_middleware): tests/test_testclient.py:193: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> TestClient: with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context(anyio.from_thread.start_blocking_portal(**self.async_backend)) @stack.callback def reset_portal() -> None: self.portal = None > send1, receive1 = anyio.create_memory_object_stream[ typing.Union[typing.MutableMapping[str, typing.Any], None] ](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:660: TypeError ___________________ test_websocket_blocking_receive[asyncio] ___________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_websocket_blocking_receive(test_client_factory: TestClientFactory) -> None: def app(scope: Scope) -> ASGIInstance: async def respond(websocket: WebSocket) -> None: await websocket.send_json({"message": "test"}) async def asgi(receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) await websocket.accept() async with anyio.create_task_group() as task_group: task_group.start_soon(respond, websocket) try: # this will block as the client does not send us data # it should not prevent `respond` from executing though await websocket.receive_json() except WebSocketDisconnect: pass return asgi client = test_client_factory(app) # type: ignore > with client.websocket_connect("/") as websocket: tests/test_testclient.py:252: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:456: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError ____________________ test_websocket_blocking_receive[trio] _____________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_websocket_blocking_receive(test_client_factory: TestClientFactory) -> None: def app(scope: Scope) -> ASGIInstance: async def respond(websocket: WebSocket) -> None: await websocket.send_json({"message": "test"}) async def asgi(receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) await websocket.accept() async with anyio.create_task_group() as task_group: task_group.start_soon(respond, websocket) try: # this will block as the client does not send us data # it should not prevent `respond` from executing though await websocket.receive_json() except WebSocketDisconnect: pass return asgi client = test_client_factory(app) # type: ignore > with client.websocket_connect("/") as websocket: tests/test_testclient.py:252: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError __________________ test_websocket_not_block_on_close[asyncio] __________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_websocket_not_block_on_close(test_client_factory: TestClientFactory) -> None: cancelled = False def app(scope: Scope) -> ASGIInstance: async def asgi(receive: Receive, send: Send) -> None: nonlocal cancelled try: websocket = WebSocket(scope, receive=receive, send=send) await websocket.accept() await anyio.sleep_forever() except anyio.get_cancelled_exc_class(): cancelled = True raise return asgi client = test_client_factory(app) # type: ignore > with client.websocket_connect("/"): tests/test_testclient.py:274: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:456: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError ___________________ test_websocket_not_block_on_close[trio] ____________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_websocket_not_block_on_close(test_client_factory: TestClientFactory) -> None: cancelled = False def app(scope: Scope) -> ASGIInstance: async def asgi(receive: Receive, send: Send) -> None: nonlocal cancelled try: websocket = WebSocket(scope, receive=receive, send=send) await websocket.accept() await anyio.sleep_forever() except anyio.get_cancelled_exc_class(): cancelled = True raise return asgi client = test_client_factory(app) # type: ignore > with client.websocket_connect("/"): tests/test_testclient.py:274: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError _______________ test_websocket_raw_path_without_params[asyncio] ________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_websocket_raw_path_without_params(test_client_factory: TestClientFactory) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) await websocket.accept() raw_path = scope.get("raw_path") assert raw_path is not None await websocket.send_bytes(raw_path) client = test_client_factory(app) > with client.websocket_connect("/hello-world", params={"foo": "bar"}) as websocket: tests/test_testclient.py:422: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:456: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError _________________ test_websocket_raw_path_without_params[trio] _________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_websocket_raw_path_without_params(test_client_factory: TestClientFactory) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) await websocket.accept() raw_path = scope.get("raw_path") assert raw_path is not None await websocket.send_bytes(raw_path) client = test_client_factory(app) > with client.websocket_connect("/hello-world", params={"foo": "bar"}) as websocket: tests/test_testclient.py:422: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError _________________________ test_websocket_url[asyncio] __________________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_websocket_url(test_client_factory: TestClientFactory) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) await websocket.accept() await websocket.send_json({"url": str(websocket.url)}) await websocket.close() client = test_client_factory(app) > with client.websocket_connect("/123?a=abc") as websocket: tests/test_websockets.py:25: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:456: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError ___________________________ test_websocket_url[trio] ___________________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_websocket_url(test_client_factory: TestClientFactory) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) await websocket.accept() await websocket.send_json({"url": str(websocket.url)}) await websocket.close() client = test_client_factory(app) > with client.websocket_connect("/123?a=abc") as websocket: tests/test_websockets.py:25: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError _____________________ test_websocket_binary_json[asyncio] ______________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_websocket_binary_json(test_client_factory: TestClientFactory) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) await websocket.accept() message = await websocket.receive_json(mode="binary") await websocket.send_json(message, mode="binary") await websocket.close() client = test_client_factory(app) > with client.websocket_connect("/123?a=abc") as websocket: tests/test_websockets.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:456: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError _______________________ test_websocket_binary_json[trio] _______________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_websocket_binary_json(test_client_factory: TestClientFactory) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) await websocket.accept() message = await websocket.receive_json(mode="binary") await websocket.send_json(message, mode="binary") await websocket.close() client = test_client_factory(app) > with client.websocket_connect("/123?a=abc") as websocket: tests/test_websockets.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError _____________ test_websocket_ensure_unicode_on_send_json[asyncio] ______________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_websocket_ensure_unicode_on_send_json( test_client_factory: TestClientFactory, ) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) await websocket.accept() message = await websocket.receive_json(mode="text") await websocket.send_json(message, mode="text") await websocket.close() client = test_client_factory(app) > with client.websocket_connect("/123?a=abc") as websocket: tests/test_websockets.py:57: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError _______________ test_websocket_ensure_unicode_on_send_json[trio] _______________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_websocket_ensure_unicode_on_send_json( test_client_factory: TestClientFactory, ) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) await websocket.accept() message = await websocket.receive_json(mode="text") await websocket.send_json(message, mode="text") await websocket.close() client = test_client_factory(app) > with client.websocket_connect("/123?a=abc") as websocket: tests/test_websockets.py:57: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError _____________________ test_websocket_query_params[asyncio] _____________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_websocket_query_params(test_client_factory: TestClientFactory) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) query_params = dict(websocket.query_params) await websocket.accept() await websocket.send_json({"params": query_params}) await websocket.close() client = test_client_factory(app) > with client.websocket_connect("/?a=abc&b=456") as websocket: tests/test_websockets.py:72: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError ______________________ test_websocket_query_params[trio] _______________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_websocket_query_params(test_client_factory: TestClientFactory) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) query_params = dict(websocket.query_params) await websocket.accept() await websocket.send_json({"params": query_params}) await websocket.close() client = test_client_factory(app) > with client.websocket_connect("/?a=abc&b=456") as websocket: tests/test_websockets.py:72: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError _______________________ test_websocket_headers[asyncio] ________________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) @pytest.mark.skipif( any(module in sys.modules for module in ("brotli", "brotlicffi")), reason='urllib3 includes "br" to the "accept-encoding" headers.', ) def test_websocket_headers(test_client_factory: TestClientFactory) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) headers = dict(websocket.headers) await websocket.accept() await websocket.send_json({"headers": headers}) await websocket.close() client = test_client_factory(app) > with client.websocket_connect("/") as websocket: tests/test_websockets.py:90: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:456: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError _________________________ test_websocket_headers[trio] _________________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) @pytest.mark.skipif( any(module in sys.modules for module in ("brotli", "brotlicffi")), reason='urllib3 includes "br" to the "accept-encoding" headers.', ) def test_websocket_headers(test_client_factory: TestClientFactory) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) headers = dict(websocket.headers) await websocket.accept() await websocket.send_json({"headers": headers}) await websocket.close() client = test_client_factory(app) > with client.websocket_connect("/") as websocket: tests/test_websockets.py:90: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError _________________________ test_websocket_port[asyncio] _________________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_websocket_port(test_client_factory: TestClientFactory) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) await websocket.accept() await websocket.send_json({"port": websocket.url.port}) await websocket.close() client = test_client_factory(app) > with client.websocket_connect("ws://example.com:123/123?a=abc") as websocket: tests/test_websockets.py:112: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:456: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError __________________________ test_websocket_port[trio] ___________________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_websocket_port(test_client_factory: TestClientFactory) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) await websocket.accept() await websocket.send_json({"port": websocket.url.port}) await websocket.close() client = test_client_factory(app) > with client.websocket_connect("ws://example.com:123/123?a=abc") as websocket: tests/test_websockets.py:112: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError ________________ test_websocket_send_and_receive_text[asyncio] _________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_websocket_send_and_receive_text( test_client_factory: TestClientFactory, ) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) await websocket.accept() data = await websocket.receive_text() await websocket.send_text("Message was: " + data) await websocket.close() client = test_client_factory(app) > with client.websocket_connect("/") as websocket: tests/test_websockets.py:128: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError __________________ test_websocket_send_and_receive_text[trio] __________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_websocket_send_and_receive_text( test_client_factory: TestClientFactory, ) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) await websocket.accept() data = await websocket.receive_text() await websocket.send_text("Message was: " + data) await websocket.close() client = test_client_factory(app) > with client.websocket_connect("/") as websocket: tests/test_websockets.py:128: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError ________________ test_websocket_send_and_receive_bytes[asyncio] ________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_websocket_send_and_receive_bytes( test_client_factory: TestClientFactory, ) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) await websocket.accept() data = await websocket.receive_bytes() await websocket.send_bytes(b"Message was: " + data) await websocket.close() client = test_client_factory(app) > with client.websocket_connect("/") as websocket: tests/test_websockets.py:145: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:456: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError _________________ test_websocket_send_and_receive_bytes[trio] __________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_websocket_send_and_receive_bytes( test_client_factory: TestClientFactory, ) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) await websocket.accept() data = await websocket.receive_bytes() await websocket.send_bytes(b"Message was: " + data) await websocket.close() client = test_client_factory(app) > with client.websocket_connect("/") as websocket: tests/test_websockets.py:145: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError ________________ test_websocket_send_and_receive_json[asyncio] _________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_websocket_send_and_receive_json( test_client_factory: TestClientFactory, ) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) await websocket.accept() data = await websocket.receive_json() await websocket.send_json({"message": data}) await websocket.close() client = test_client_factory(app) > with client.websocket_connect("/") as websocket: tests/test_websockets.py:162: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:456: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError __________________ test_websocket_send_and_receive_json[trio] __________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_websocket_send_and_receive_json( test_client_factory: TestClientFactory, ) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) await websocket.accept() data = await websocket.receive_json() await websocket.send_json({"message": data}) await websocket.close() client = test_client_factory(app) > with client.websocket_connect("/") as websocket: tests/test_websockets.py:162: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError ______________________ test_websocket_iter_text[asyncio] _______________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_websocket_iter_text(test_client_factory: TestClientFactory) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) await websocket.accept() async for data in websocket.iter_text(): await websocket.send_text("Message was: " + data) client = test_client_factory(app) > with client.websocket_connect("/") as websocket: tests/test_websockets.py:176: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError ________________________ test_websocket_iter_text[trio] ________________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_websocket_iter_text(test_client_factory: TestClientFactory) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) await websocket.accept() async for data in websocket.iter_text(): await websocket.send_text("Message was: " + data) client = test_client_factory(app) > with client.websocket_connect("/") as websocket: tests/test_websockets.py:176: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError ______________________ test_websocket_iter_bytes[asyncio] ______________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_websocket_iter_bytes(test_client_factory: TestClientFactory) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) await websocket.accept() async for data in websocket.iter_bytes(): await websocket.send_bytes(b"Message was: " + data) client = test_client_factory(app) > with client.websocket_connect("/") as websocket: tests/test_websockets.py:190: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:456: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError _______________________ test_websocket_iter_bytes[trio] ________________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_websocket_iter_bytes(test_client_factory: TestClientFactory) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) await websocket.accept() async for data in websocket.iter_bytes(): await websocket.send_bytes(b"Message was: " + data) client = test_client_factory(app) > with client.websocket_connect("/") as websocket: tests/test_websockets.py:190: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError ______________________ test_websocket_iter_json[asyncio] _______________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_websocket_iter_json(test_client_factory: TestClientFactory) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) await websocket.accept() async for data in websocket.iter_json(): await websocket.send_json({"message": data}) client = test_client_factory(app) > with client.websocket_connect("/") as websocket: tests/test_websockets.py:204: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError ________________________ test_websocket_iter_json[trio] ________________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_websocket_iter_json(test_client_factory: TestClientFactory) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) await websocket.accept() async for data in websocket.iter_json(): await websocket.send_json({"message": data}) client = test_client_factory(app) > with client.websocket_connect("/") as websocket: tests/test_websockets.py:204: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError _________________ test_websocket_concurrency_pattern[asyncio] __________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_websocket_concurrency_pattern(test_client_factory: TestClientFactory) -> None: stream_send: ObjectSendStream[MutableMapping[str, Any]] stream_receive: ObjectReceiveStream[MutableMapping[str, Any]] stream_send, stream_receive = anyio.create_memory_object_stream() async def reader(websocket: WebSocket) -> None: async with stream_send: async for data in websocket.iter_json(): await stream_send.send(data) async def writer(websocket: WebSocket) -> None: async with stream_receive: async for message in stream_receive: await websocket.send_json(message) async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) await websocket.accept() async with anyio.create_task_group() as task_group: task_group.start_soon(reader, websocket) await writer(websocket) await websocket.close() client = test_client_factory(app) > with client.websocket_connect("/") as websocket: tests/test_websockets.py:234: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError ___________________ test_websocket_concurrency_pattern[trio] ___________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_websocket_concurrency_pattern(test_client_factory: TestClientFactory) -> None: stream_send: ObjectSendStream[MutableMapping[str, Any]] stream_receive: ObjectReceiveStream[MutableMapping[str, Any]] stream_send, stream_receive = anyio.create_memory_object_stream() async def reader(websocket: WebSocket) -> None: async with stream_send: async for data in websocket.iter_json(): await stream_send.send(data) async def writer(websocket: WebSocket) -> None: async with stream_receive: async for message in stream_receive: await websocket.send_json(message) async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) await websocket.accept() async with anyio.create_task_group() as task_group: task_group.start_soon(reader, websocket) await writer(websocket) await websocket.close() client = test_client_factory(app) > with client.websocket_connect("/") as websocket: tests/test_websockets.py:234: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError __________________________ test_client_close[asyncio] __________________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_client_close(test_client_factory: TestClientFactory) -> None: close_code = None close_reason = None async def app(scope: Scope, receive: Receive, send: Send) -> None: nonlocal close_code, close_reason websocket = WebSocket(scope, receive=receive, send=send) await websocket.accept() try: await websocket.receive_text() except WebSocketDisconnect as exc: close_code = exc.code close_reason = exc.reason client = test_client_factory(app) > with client.websocket_connect("/") as websocket: tests/test_websockets.py:255: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:456: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError ___________________________ test_client_close[trio] ____________________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_client_close(test_client_factory: TestClientFactory) -> None: close_code = None close_reason = None async def app(scope: Scope, receive: Receive, send: Send) -> None: nonlocal close_code, close_reason websocket = WebSocket(scope, receive=receive, send=send) await websocket.accept() try: await websocket.receive_text() except WebSocketDisconnect as exc: close_code = exc.code close_reason = exc.reason client = test_client_factory(app) > with client.websocket_connect("/") as websocket: tests/test_websockets.py:255: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError _______________________ test_application_close[asyncio] ________________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_application_close(test_client_factory: TestClientFactory) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) await websocket.accept() await websocket.close(status.WS_1001_GOING_AWAY) client = test_client_factory(app) > with client.websocket_connect("/") as websocket: tests/test_websockets.py:289: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:456: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError _________________________ test_application_close[trio] _________________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_application_close(test_client_factory: TestClientFactory) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) await websocket.accept() await websocket.close(status.WS_1001_GOING_AWAY) client = test_client_factory(app) > with client.websocket_connect("/") as websocket: tests/test_websockets.py:289: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError ______________________ test_rejected_connection[asyncio] _______________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_rejected_connection(test_client_factory: TestClientFactory) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) msg = await websocket.receive() assert msg == {"type": "websocket.connect"} await websocket.close(status.WS_1001_GOING_AWAY) client = test_client_factory(app) with pytest.raises(WebSocketDisconnect) as exc: > with client.websocket_connect("/"): tests/test_websockets.py:304: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:456: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError ________________________ test_rejected_connection[trio] ________________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_rejected_connection(test_client_factory: TestClientFactory) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) msg = await websocket.receive() assert msg == {"type": "websocket.connect"} await websocket.close(status.WS_1001_GOING_AWAY) client = test_client_factory(app) with pytest.raises(WebSocketDisconnect) as exc: > with client.websocket_connect("/"): tests/test_websockets.py:304: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError ______________________ test_send_denial_response[asyncio] ______________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_send_denial_response(test_client_factory: TestClientFactory) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) msg = await websocket.receive() assert msg == {"type": "websocket.connect"} response = Response(status_code=404, content="foo") await websocket.send_denial_response(response) client = test_client_factory(app) with pytest.raises(WebSocketDenialResponse) as exc: > with client.websocket_connect("/"): tests/test_websockets.py:319: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:456: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError _______________________ test_send_denial_response[trio] ________________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_send_denial_response(test_client_factory: TestClientFactory) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) msg = await websocket.receive() assert msg == {"type": "websocket.connect"} response = Response(status_code=404, content="foo") await websocket.send_denial_response(response) client = test_client_factory(app) with pytest.raises(WebSocketDenialResponse) as exc: > with client.websocket_connect("/"): tests/test_websockets.py:319: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError ______________________ test_send_response_multi[asyncio] _______________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_send_response_multi(test_client_factory: TestClientFactory) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) msg = await websocket.receive() assert msg == {"type": "websocket.connect"} await websocket.send( { "type": "websocket.http.response.start", "status": 404, "headers": [(b"content-type", b"text/plain"), (b"foo", b"bar")], } ) await websocket.send({"type": "websocket.http.response.body", "body": b"hard", "more_body": True}) await websocket.send({"type": "websocket.http.response.body", "body": b"body"}) client = test_client_factory(app) with pytest.raises(WebSocketDenialResponse) as exc: > with client.websocket_connect("/"): tests/test_websockets.py:342: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:456: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError ________________________ test_send_response_multi[trio] ________________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_send_response_multi(test_client_factory: TestClientFactory) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) msg = await websocket.receive() assert msg == {"type": "websocket.connect"} await websocket.send( { "type": "websocket.http.response.start", "status": 404, "headers": [(b"content-type", b"text/plain"), (b"foo", b"bar")], } ) await websocket.send({"type": "websocket.http.response.body", "body": b"hard", "more_body": True}) await websocket.send({"type": "websocket.http.response.body", "body": b"body"}) client = test_client_factory(app) with pytest.raises(WebSocketDenialResponse) as exc: > with client.websocket_connect("/"): tests/test_websockets.py:342: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:456: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError ___________________ test_send_response_unsupported[asyncio] ____________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_send_response_unsupported(test_client_factory: TestClientFactory) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: del scope["extensions"]["websocket.http.response"] websocket = WebSocket(scope, receive=receive, send=send) msg = await websocket.receive() assert msg == {"type": "websocket.connect"} response = Response(status_code=404, content="foo") with pytest.raises( RuntimeError, match="The server doesn't support the Websocket Denial Response extension.", ): await websocket.send_denial_response(response) await websocket.close() client = test_client_factory(app) with pytest.raises(WebSocketDisconnect) as exc: > with client.websocket_connect("/"): tests/test_websockets.py:365: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:456: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError _____________________ test_send_response_unsupported[trio] _____________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_send_response_unsupported(test_client_factory: TestClientFactory) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: del scope["extensions"]["websocket.http.response"] websocket = WebSocket(scope, receive=receive, send=send) msg = await websocket.receive() assert msg == {"type": "websocket.connect"} response = Response(status_code=404, content="foo") with pytest.raises( RuntimeError, match="The server doesn't support the Websocket Denial Response extension.", ): await websocket.send_denial_response(response) await websocket.close() client = test_client_factory(app) with pytest.raises(WebSocketDisconnect) as exc: > with client.websocket_connect("/"): tests/test_websockets.py:365: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError _________________ test_send_response_duplicate_start[asyncio] __________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_send_response_duplicate_start(test_client_factory: TestClientFactory) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) msg = await websocket.receive() assert msg == {"type": "websocket.connect"} response = Response(status_code=404, content="foo") await websocket.send( { "type": "websocket.http.response.start", "status": response.status_code, "headers": response.raw_headers, } ) await websocket.send( { "type": "websocket.http.response.start", "status": response.status_code, "headers": response.raw_headers, } ) client = test_client_factory(app) with pytest.raises( RuntimeError, match=("Expected ASGI message \"websocket.http.response.body\", but got 'websocket.http.response.start'"), ): > with client.websocket_connect("/"): tests/test_websockets.py:396: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:456: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError ___________________ test_send_response_duplicate_start[trio] ___________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_send_response_duplicate_start(test_client_factory: TestClientFactory) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) msg = await websocket.receive() assert msg == {"type": "websocket.connect"} response = Response(status_code=404, content="foo") await websocket.send( { "type": "websocket.http.response.start", "status": response.status_code, "headers": response.raw_headers, } ) await websocket.send( { "type": "websocket.http.response.start", "status": response.status_code, "headers": response.raw_headers, } ) client = test_client_factory(app) with pytest.raises( RuntimeError, match=("Expected ASGI message \"websocket.http.response.body\", but got 'websocket.http.response.start'"), ): > with client.websocket_connect("/"): tests/test_websockets.py:396: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError __________________________ test_subprotocol[asyncio] ___________________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_subprotocol(test_client_factory: TestClientFactory) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) assert websocket["subprotocols"] == ["soap", "wamp"] await websocket.accept(subprotocol="wamp") await websocket.close() client = test_client_factory(app) > with client.websocket_connect("/", subprotocols=["soap", "wamp"]) as websocket: tests/test_websockets.py:408: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError ____________________________ test_subprotocol[trio] ____________________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_subprotocol(test_client_factory: TestClientFactory) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) assert websocket["subprotocols"] == ["soap", "wamp"] await websocket.accept(subprotocol="wamp") await websocket.close() client = test_client_factory(app) > with client.websocket_connect("/", subprotocols=["soap", "wamp"]) as websocket: tests/test_websockets.py:408: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError _______________________ test_additional_headers[asyncio] _______________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_additional_headers(test_client_factory: TestClientFactory) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) await websocket.accept(headers=[(b"additional", b"header")]) await websocket.close() client = test_client_factory(app) > with client.websocket_connect("/") as websocket: tests/test_websockets.py:419: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:456: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError ________________________ test_additional_headers[trio] _________________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_additional_headers(test_client_factory: TestClientFactory) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) await websocket.accept(headers=[(b"additional", b"header")]) await websocket.close() client = test_client_factory(app) > with client.websocket_connect("/") as websocket: tests/test_websockets.py:419: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError _____________________ test_no_additional_headers[asyncio] ______________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_no_additional_headers(test_client_factory: TestClientFactory) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) await websocket.accept() await websocket.close() client = test_client_factory(app) > with client.websocket_connect("/") as websocket: tests/test_websockets.py:430: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError _______________________ test_no_additional_headers[trio] _______________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_no_additional_headers(test_client_factory: TestClientFactory) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) await websocket.accept() await websocket.close() client = test_client_factory(app) > with client.websocket_connect("/") as websocket: tests/test_websockets.py:430: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError ______________________ test_websocket_exception[asyncio] _______________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_websocket_exception(test_client_factory: TestClientFactory) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: assert False client = test_client_factory(app) with pytest.raises(AssertionError): > with client.websocket_connect("/123?a=abc"): tests/test_websockets.py:440: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError ________________________ test_websocket_exception[trio] ________________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_websocket_exception(test_client_factory: TestClientFactory) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: assert False client = test_client_factory(app) with pytest.raises(AssertionError): > with client.websocket_connect("/123?a=abc"): tests/test_websockets.py:440: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError ________________________ test_duplicate_close[asyncio] _________________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_duplicate_close(test_client_factory: TestClientFactory) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) await websocket.accept() await websocket.close() await websocket.close() client = test_client_factory(app) with pytest.raises(RuntimeError): > with client.websocket_connect("/"): tests/test_websockets.py:453: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError __________________________ test_duplicate_close[trio] __________________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_duplicate_close(test_client_factory: TestClientFactory) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) await websocket.accept() await websocket.close() await websocket.close() client = test_client_factory(app) with pytest.raises(RuntimeError): > with client.websocket_connect("/"): tests/test_websockets.py:453: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError ______________________ test_duplicate_disconnect[asyncio] ______________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_duplicate_disconnect(test_client_factory: TestClientFactory) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) await websocket.accept() message = await websocket.receive() assert message["type"] == "websocket.disconnect" message = await websocket.receive() client = test_client_factory(app) with pytest.raises(RuntimeError): > with client.websocket_connect("/") as websocket: tests/test_websockets.py:467: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:456: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError _______________________ test_duplicate_disconnect[trio] ________________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_duplicate_disconnect(test_client_factory: TestClientFactory) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) await websocket.accept() message = await websocket.receive() assert message["type"] == "websocket.disconnect" message = await websocket.receive() client = test_client_factory(app) with pytest.raises(RuntimeError): > with client.websocket_connect("/") as websocket: tests/test_websockets.py:467: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError _____________________ test_websocket_close_reason[asyncio] _____________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_websocket_close_reason(test_client_factory: TestClientFactory) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) await websocket.accept() await websocket.close(code=status.WS_1001_GOING_AWAY, reason="Going Away") client = test_client_factory(app) > with client.websocket_connect("/") as websocket: tests/test_websockets.py:505: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError ______________________ test_websocket_close_reason[trio] _______________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_websocket_close_reason(test_client_factory: TestClientFactory) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) await websocket.accept() await websocket.close(code=status.WS_1001_GOING_AWAY, reason="Going Away") client = test_client_factory(app) > with client.websocket_connect("/") as websocket: tests/test_websockets.py:505: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:456: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError _____________________ test_send_json_invalid_mode[asyncio] _____________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_send_json_invalid_mode(test_client_factory: TestClientFactory) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) await websocket.accept() await websocket.send_json({}, mode="invalid") client = test_client_factory(app) with pytest.raises(RuntimeError): > with client.websocket_connect("/"): tests/test_websockets.py:520: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError ______________________ test_send_json_invalid_mode[trio] _______________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_send_json_invalid_mode(test_client_factory: TestClientFactory) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) await websocket.accept() await websocket.send_json({}, mode="invalid") client = test_client_factory(app) with pytest.raises(RuntimeError): > with client.websocket_connect("/"): tests/test_websockets.py:520: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError ___________________ test_receive_json_invalid_mode[asyncio] ____________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_receive_json_invalid_mode(test_client_factory: TestClientFactory) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) await websocket.accept() await websocket.receive_json(mode="invalid") client = test_client_factory(app) with pytest.raises(RuntimeError): > with client.websocket_connect("/"): tests/test_websockets.py:532: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError _____________________ test_receive_json_invalid_mode[trio] _____________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_receive_json_invalid_mode(test_client_factory: TestClientFactory) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) await websocket.accept() await websocket.receive_json(mode="invalid") client = test_client_factory(app) with pytest.raises(RuntimeError): > with client.websocket_connect("/"): tests/test_websockets.py:532: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:456: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError ___________________ test_receive_text_before_accept[asyncio] ___________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_receive_text_before_accept(test_client_factory: TestClientFactory) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) await websocket.receive_text() client = test_client_factory(app) with pytest.raises(RuntimeError): > with client.websocket_connect("/"): tests/test_websockets.py:543: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError ____________________ test_receive_text_before_accept[trio] _____________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_receive_text_before_accept(test_client_factory: TestClientFactory) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) await websocket.receive_text() client = test_client_factory(app) with pytest.raises(RuntimeError): > with client.websocket_connect("/"): tests/test_websockets.py:543: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError __________________ test_receive_bytes_before_accept[asyncio] ___________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_receive_bytes_before_accept(test_client_factory: TestClientFactory) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) await websocket.receive_bytes() client = test_client_factory(app) with pytest.raises(RuntimeError): > with client.websocket_connect("/"): tests/test_websockets.py:554: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError ____________________ test_receive_bytes_before_accept[trio] ____________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_receive_bytes_before_accept(test_client_factory: TestClientFactory) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) await websocket.receive_bytes() client = test_client_factory(app) with pytest.raises(RuntimeError): > with client.websocket_connect("/"): tests/test_websockets.py:554: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError ___________________ test_receive_json_before_accept[asyncio] ___________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_receive_json_before_accept(test_client_factory: TestClientFactory) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) await websocket.receive_json() client = test_client_factory(app) with pytest.raises(RuntimeError): > with client.websocket_connect("/"): tests/test_websockets.py:565: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:456: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError ____________________ test_receive_json_before_accept[trio] _____________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_receive_json_before_accept(test_client_factory: TestClientFactory) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) await websocket.receive_json() client = test_client_factory(app) with pytest.raises(RuntimeError): > with client.websocket_connect("/"): tests/test_websockets.py:565: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError _______________________ test_send_before_accept[asyncio] _______________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_send_before_accept(test_client_factory: TestClientFactory) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) await websocket.send({"type": "websocket.send"}) client = test_client_factory(app) with pytest.raises(RuntimeError): > with client.websocket_connect("/"): tests/test_websockets.py:576: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError ________________________ test_send_before_accept[trio] _________________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_send_before_accept(test_client_factory: TestClientFactory) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) await websocket.send({"type": "websocket.send"}) client = test_client_factory(app) with pytest.raises(RuntimeError): > with client.websocket_connect("/"): tests/test_websockets.py:576: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError ____________________ test_send_wrong_message_type[asyncio] _____________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_send_wrong_message_type(test_client_factory: TestClientFactory) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) await websocket.send({"type": "websocket.accept"}) await websocket.send({"type": "websocket.accept"}) client = test_client_factory(app) with pytest.raises(RuntimeError): > with client.websocket_connect("/"): tests/test_websockets.py:588: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError ______________________ test_send_wrong_message_type[trio] ______________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_send_wrong_message_type(test_client_factory: TestClientFactory) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) await websocket.send({"type": "websocket.accept"}) await websocket.send({"type": "websocket.accept"}) client = test_client_factory(app) with pytest.raises(RuntimeError): > with client.websocket_connect("/"): tests/test_websockets.py:588: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError _____________________ test_receive_before_accept[asyncio] ______________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_receive_before_accept(test_client_factory: TestClientFactory) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) await websocket.accept() websocket.client_state = WebSocketState.CONNECTING await websocket.receive() client = test_client_factory(app) with pytest.raises(RuntimeError): > with client.websocket_connect("/") as websocket: tests/test_websockets.py:601: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError _______________________ test_receive_before_accept[trio] _______________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_receive_before_accept(test_client_factory: TestClientFactory) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) await websocket.accept() websocket.client_state = WebSocketState.CONNECTING await websocket.receive() client = test_client_factory(app) with pytest.raises(RuntimeError): > with client.websocket_connect("/") as websocket: tests/test_websockets.py:601: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError ___________________ test_receive_wrong_message_type[asyncio] ___________________ test_client_factory = functools.partial(, backend='asyncio', backend_options={}) def test_receive_wrong_message_type(test_client_factory: TestClientFactory) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) await websocket.accept() await websocket.receive() client = test_client_factory(app) with pytest.raises(RuntimeError): > with client.websocket_connect("/") as websocket: tests/test_websockets.py:613: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError ____________________ test_receive_wrong_message_type[trio] _____________________ test_client_factory = functools.partial(, backend='trio', backend_options={}) def test_receive_wrong_message_type(test_client_factory: TestClientFactory) -> None: async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send) await websocket.accept() await websocket.receive() client = test_client_factory(app) with pytest.raises(RuntimeError): > with client.websocket_connect("/") as websocket: tests/test_websockets.py:613: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ starlette/testclient.py:101: in __enter__ fut, cs = portal.start_task(self._run) /usr/lib/python3.13/site-packages/anyio/from_thread.py:405: in start_task return f, task_status_future.result() /usr/lib64/python3.13/concurrent/futures/_base.py:449: in result return self.__get_result() /usr/lib64/python3.13/concurrent/futures/_base.py:401: in __get_result raise self._exception /usr/lib/python3.13/site-packages/anyio/from_thread.py:217: in _call_func retval = await retval _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = async def _run(self, *, task_status: anyio.abc.TaskStatus[anyio.CancelScope]) -> None: """ The sub-thread in which the websocket session runs. """ > send_tx, send_rx = anyio.create_memory_object_stream[Message](math.inf) E TypeError: 'function' object is not subscriptable starlette/testclient.py:120: TypeError ========== 203 failed, 631 passed, 2 deselected, 52 errors in 16.71s =========== RPM build errors: error: Bad exit status from /var/tmp/rpm-tmp.KkHLX6 (%check) Bad exit status from /var/tmp/rpm-tmp.KkHLX6 (%check) Finish: rpmbuild python-starlette-0.45.1-1.fc41.src.rpm Finish: build phase for python-starlette-0.45.1-1.fc41.src.rpm INFO: chroot_scan: 1 files copied to /var/lib/copr-rpmbuild/results/chroot_scan INFO: /var/lib/mock/fedora-41-x86_64-1735650614.339304/root/var/log/dnf5.log INFO: chroot_scan: creating tarball /var/lib/copr-rpmbuild/results/chroot_scan.tar.gz /bin/tar: Removing leading `/' from member names ERROR: Exception(/var/lib/copr-rpmbuild/results/python-starlette-0.45.1-1.fc41.src.rpm) Config(fedora-41-x86_64) 0 minutes 37 seconds INFO: Results and/or logs in: /var/lib/copr-rpmbuild/results INFO: Cleaning up build root ('cleanup_on_failure=True') Start: clean chroot INFO: unmounting tmpfs. Finish: clean chroot ERROR: Command failed: # /usr/bin/systemd-nspawn -q -M 09206137dfc1481d9fac49ab49970ba1 -D /var/lib/mock/fedora-41-x86_64-1735650614.339304/root -a -u mockbuild --capability=cap_ipc_lock --rlimit=RLIMIT_NOFILE=10240 --capability=cap_ipc_lock --bind=/tmp/mock-resolv.vp4v22t5:/etc/resolv.conf --bind=/dev/btrfs-control --bind=/dev/mapper/control --bind=/dev/fuse --bind=/dev/loop-control --bind=/dev/loop0 --bind=/dev/loop1 --bind=/dev/loop2 --bind=/dev/loop3 --bind=/dev/loop4 --bind=/dev/loop5 --bind=/dev/loop6 --bind=/dev/loop7 --bind=/dev/loop8 --bind=/dev/loop9 --bind=/dev/loop10 --bind=/dev/loop11 --console=pipe --setenv=TERM=vt100 --setenv=SHELL=/bin/bash --setenv=HOME=/builddir --setenv=HOSTNAME=mock --setenv=PATH=/usr/bin:/bin:/usr/sbin:/sbin '--setenv=PROMPT_COMMAND=printf "\033]0;\007"' '--setenv=PS1= \s-\v\$ ' --setenv=LANG=C.UTF-8 --resolv-conf=off bash --login -c '/usr/bin/rpmbuild -ba --noprep --target x86_64 /builddir/build/originals/python-starlette.spec' Copr build error: Build failed