https://launchpad.net/ubuntu/+source/sqlmodel/0.0.4-2/+build/22594287 RUN: /usr/share/launchpad-buildd/bin/builder-prep Kernel version: Linux lcy01-amd64-016 4.15.0-163-generic #171-Ubuntu SMP Fri Nov 5 11:55:11 UTC 2021 x86_64 Buildd toolchain package versions: launchpad-buildd_205~511~ubuntu18.04.1 python3-lpbuildd_205~511~ubuntu18.04.1 sbuild_0.75.0-1ubuntu1 bzr-builder_0.7.3+bzr174~ppa13~ubuntu16.04.1 bzr_2.7.0+bzr6622-10 git-build-recipe_0.3.6~git201906051340.ff11471~ubuntu18.04.1 git_1:2.17.1-1ubuntu0.9 dpkg-dev_1.19.0.5ubuntu2.3 python-debian_0.1.32 python3-debian_0.1.32. Syncing the system clock with the buildd NTP service... 12 Dec 08:25:59 ntpdate[1738]: adjust time server 10.211.37.1 offset 0.003551 sec RUN: /usr/share/launchpad-buildd/bin/in-target unpack-chroot --backend=chroot --series=jammy --arch=amd64 PACKAGEBUILD-22594287 --image-type chroot /home/buildd/filecache-default/b0c128df17a460089eca69348f06144377489985 Creating target for build PACKAGEBUILD-22594287 RUN: /usr/share/launchpad-buildd/bin/in-target mount-chroot --backend=chroot --series=jammy --arch=amd64 PACKAGEBUILD-22594287 Starting target for build PACKAGEBUILD-22594287 RUN: /usr/share/launchpad-buildd/bin/in-target override-sources-list --backend=chroot --series=jammy --arch=amd64 PACKAGEBUILD-22594287 'deb http://ftpmaster.internal/ubuntu jammy main universe' 'deb http://ftpmaster.internal/ubuntu jammy-security main universe' 'deb http://ftpmaster.internal/ubuntu jammy-updates main universe' 'deb http://ftpmaster.internal/ubuntu jammy-proposed main universe' Overriding sources.list in build-PACKAGEBUILD-22594287 RUN: /usr/share/launchpad-buildd/bin/in-target update-debian-chroot --backend=chroot --series=jammy --arch=amd64 PACKAGEBUILD-22594287 Updating target for build PACKAGEBUILD-22594287 Get:1 http://ftpmaster.internal/ubuntu jammy InRelease [270 kB] Get:2 http://ftpmaster.internal/ubuntu jammy-security InRelease [90.7 kB] Get:3 http://ftpmaster.internal/ubuntu jammy-updates InRelease [90.7 kB] Get:4 http://ftpmaster.internal/ubuntu jammy-proposed InRelease [121 kB] Get:5 http://ftpmaster.internal/ubuntu jammy/main amd64 Packages [1407 kB] Get:6 http://ftpmaster.internal/ubuntu jammy/main Translation-en [513 kB] Get:7 http://ftpmaster.internal/ubuntu jammy/universe amd64 Packages [13.2 MB] Get:8 http://ftpmaster.internal/ubuntu jammy/universe Translation-en [5549 kB] Get:9 http://ftpmaster.internal/ubuntu jammy-proposed/main amd64 Packages [90.4 kB] Get:10 http://ftpmaster.internal/ubuntu jammy-proposed/main Translation-en [35.4 kB] Get:11 http://ftpmaster.internal/ubuntu jammy-proposed/universe amd64 Packages [589 kB] Get:12 http://ftpmaster.internal/ubuntu jammy-proposed/universe Translation-en [302 kB] Fetched 22.3 MB in 6s (3731 kB/s) Reading package lists... Reading package lists... Building dependency tree... Reading state information... Calculating upgrade... The following package was automatically installed and is no longer required: libssl1.1 Use 'sudo apt autoremove' to remove it. The following packages will be REMOVED: libsemanage1* The following NEW packages will be installed: libsemanage2 libsepol2 libssl3 The following packages will be upgraded: apt base-files bash binutils binutils-common binutils-x86-64-linux-gnu bsdutils bzip2 ca-certificates cpp-11 dash debconf debianutils dpkg dpkg-dev e2fsprogs g++-11 gcc-11 gcc-11-base gpg gpg-agent gpgconf gpgv grep init init-system-helpers libapparmor1 libapt-pkg6.0 libasan6 libatomic1 libattr1 libbinutils libblkid1 libbz2-1.0 libcc1-0 libcom-err2 libcrypt-dev libcrypt1 libcryptsetup12 libctf-nobfd0 libctf0 libdpkg-perl libext2fs2 libgcc-11-dev libgcc-s1 libgcrypt20 libgdbm-compat4 libgdbm6 libgnutls30 libgomp1 libgpg-error0 libgssapi-krb5-2 libidn2-0 libip4tc2 libisl23 libitm1 libk5crypto3 libkmod2 libkrb5-3 libkrb5support0 liblsan0 libmount1 libmpc3 libncurses6 libncursesw6 libp11-kit0 libpam-modules libpam-modules-bin libpam-runtime libpam0g libpcre2-8-0 libquadmath0 libseccomp2 libselinux1 libsemanage-common libsmartcols1 libsqlite3-0 libss2 libstdc++-11-dev libstdc++6 libsystemd0 libtasn1-6 libtinfo6 libtsan0 libubsan1 libudev1 libuuid1 libzstd1 linux-libc-dev lockfile-progs login logsave lto-disabled-list make mount ncurses-base ncurses-bin openssl passwd pkgbinarymangler sed sensible-utils systemd systemd-sysv systemd-timesyncd tzdata usrmerge util-linux 108 upgraded, 3 newly installed, 1 to remove and 0 not upgraded. Need to get 84.3 MB of archives. After this operation, 354 MB disk space will be freed. Get:1 http://ftpmaster.internal/ubuntu jammy/main amd64 debconf all 1.5.79 [126 kB] Get:2 http://ftpmaster.internal/ubuntu jammy/main amd64 libpam0g amd64 1.4.0-10ubuntu2 [61.5 kB] Get:3 http://ftpmaster.internal/ubuntu jammy/main amd64 libcrypt-dev amd64 1:4.4.26-1 [112 kB] Get:4 http://ftpmaster.internal/ubuntu jammy/main amd64 libcrypt1 amd64 1:4.4.26-1 [82.1 kB] Get:5 http://ftpmaster.internal/ubuntu jammy/main amd64 base-files amd64 12ubuntu2 [63.3 kB] Get:6 http://ftpmaster.internal/ubuntu jammy/main amd64 debianutils amd64 5.5-1ubuntu1 [107 kB] Get:7 http://ftpmaster.internal/ubuntu jammy/main amd64 bash amd64 5.1-5ubuntu1 [771 kB] Get:8 http://ftpmaster.internal/ubuntu jammy/main amd64 bsdutils amd64 1:2.37.2-4ubuntu1 [80.9 kB] Get:9 http://ftpmaster.internal/ubuntu jammy/main amd64 libgpg-error0 amd64 1.42-3 [68.1 kB] Get:10 http://ftpmaster.internal/ubuntu jammy/main amd64 libgcrypt20 amd64 1.9.4-3ubuntu2 [515 kB] Get:11 http://ftpmaster.internal/ubuntu jammy/main amd64 bzip2 amd64 1.0.8-5 [34.8 kB] Get:12 http://ftpmaster.internal/ubuntu jammy/main amd64 libbz2-1.0 amd64 1.0.8-5 [34.5 kB] Get:13 http://ftpmaster.internal/ubuntu jammy/main amd64 libcc1-0 amd64 11.2.0-12ubuntu1 [53.8 kB] Get:14 http://ftpmaster.internal/ubuntu jammy/main amd64 gcc-11-base amd64 11.2.0-12ubuntu1 [20.7 kB] Get:15 http://ftpmaster.internal/ubuntu jammy/main amd64 libgcc-s1 amd64 11.2.0-12ubuntu1 [45.6 kB] Get:16 http://ftpmaster.internal/ubuntu jammy/main amd64 libgomp1 amd64 11.2.0-12ubuntu1 [117 kB] Get:17 http://ftpmaster.internal/ubuntu jammy/main amd64 libitm1 amd64 11.2.0-12ubuntu1 [30.0 kB] Get:18 http://ftpmaster.internal/ubuntu jammy/main amd64 libatomic1 amd64 11.2.0-12ubuntu1 [9998 B] Get:19 http://ftpmaster.internal/ubuntu jammy/main amd64 libasan6 amd64 11.2.0-12ubuntu1 [2282 kB] Get:20 http://ftpmaster.internal/ubuntu jammy/main amd64 liblsan0 amd64 11.2.0-12ubuntu1 [976 kB] Get:21 http://ftpmaster.internal/ubuntu jammy/main amd64 libtsan0 amd64 11.2.0-12ubuntu1 [2259 kB] Get:22 http://ftpmaster.internal/ubuntu jammy/main amd64 libubsan1 amd64 11.2.0-12ubuntu1 [922 kB] Get:23 http://ftpmaster.internal/ubuntu jammy/main amd64 libquadmath0 amd64 11.2.0-12ubuntu1 [154 kB] Get:24 http://ftpmaster.internal/ubuntu jammy/main amd64 g++-11 amd64 11.2.0-12ubuntu1 [11.4 MB] Get:25 http://ftpmaster.internal/ubuntu jammy/main amd64 libstdc++-11-dev amd64 11.2.0-12ubuntu1 [2098 kB] Get:26 http://ftpmaster.internal/ubuntu jammy/main amd64 libgcc-11-dev amd64 11.2.0-12ubuntu1 [2532 kB] Get:27 http://ftpmaster.internal/ubuntu jammy/main amd64 gcc-11 amd64 11.2.0-12ubuntu1 [20.1 MB] Get:28 http://ftpmaster.internal/ubuntu jammy/main amd64 cpp-11 amd64 11.2.0-12ubuntu1 [9962 kB] Get:29 http://ftpmaster.internal/ubuntu jammy/main amd64 libstdc++6 amd64 11.2.0-12ubuntu1 [656 kB] Get:30 http://ftpmaster.internal/ubuntu jammy/main amd64 libisl23 amd64 0.24-2 [728 kB] Get:31 http://ftpmaster.internal/ubuntu jammy/main amd64 libmpc3 amd64 1.2.1-1 [46.9 kB] Get:32 http://ftpmaster.internal/ubuntu jammy/main amd64 libzstd1 amd64 1.4.8+dfsg-3 [324 kB] Get:33 http://ftpmaster.internal/ubuntu jammy/main amd64 libctf0 amd64 2.37-10ubuntu1 [103 kB] Get:34 http://ftpmaster.internal/ubuntu jammy/main amd64 libctf-nobfd0 amd64 2.37-10ubuntu1 [106 kB] Get:35 http://ftpmaster.internal/ubuntu jammy/main amd64 libbinutils amd64 2.37-10ubuntu1 [653 kB] Get:36 http://ftpmaster.internal/ubuntu jammy/main amd64 binutils-common amd64 2.37-10ubuntu1 [213 kB] Get:37 http://ftpmaster.internal/ubuntu jammy/main amd64 binutils amd64 2.37-10ubuntu1 [3192 B] Get:38 http://ftpmaster.internal/ubuntu jammy/main amd64 binutils-x86-64-linux-gnu amd64 2.37-10ubuntu1 [2314 kB] Get:39 http://ftpmaster.internal/ubuntu jammy-proposed/main amd64 libssl3 amd64 3.0.0-1ubuntu2 [1896 kB] Get:40 http://ftpmaster.internal/ubuntu jammy/main amd64 libblkid1 amd64 2.37.2-4ubuntu1 [103 kB] Get:41 http://ftpmaster.internal/ubuntu jammy/main amd64 libuuid1 amd64 2.37.2-4ubuntu1 [23.8 kB] Get:42 http://ftpmaster.internal/ubuntu jammy/main amd64 libcryptsetup12 amd64 2:2.4.2-1ubuntu4 [208 kB] Get:43 http://ftpmaster.internal/ubuntu jammy/main amd64 libidn2-0 amd64 2.3.2-2 [66.5 kB] Get:44 http://ftpmaster.internal/ubuntu jammy/main amd64 libp11-kit0 amd64 0.24.0-6 [252 kB] Get:45 http://ftpmaster.internal/ubuntu jammy/main amd64 libtasn1-6 amd64 4.18.0-4 [42.9 kB] Get:46 http://ftpmaster.internal/ubuntu jammy/main amd64 libgnutls30 amd64 3.7.2-2ubuntu1 [957 kB] Get:47 http://ftpmaster.internal/ubuntu jammy/main amd64 systemd-sysv amd64 249.5-2ubuntu2 [10.5 kB] Get:48 http://ftpmaster.internal/ubuntu jammy/main amd64 systemd-timesyncd amd64 249.5-2ubuntu2 [30.9 kB] Get:49 http://ftpmaster.internal/ubuntu jammy/main amd64 libapparmor1 amd64 3.0.3-0ubuntu5 [38.0 kB] Get:50 http://ftpmaster.internal/ubuntu jammy/main amd64 libip4tc2 amd64 1.8.7-1ubuntu4 [19.8 kB] Get:51 http://ftpmaster.internal/ubuntu jammy/main amd64 libkmod2 amd64 28-1ubuntu5 [48.0 kB] Get:52 http://ftpmaster.internal/ubuntu jammy/main amd64 libpcre2-8-0 amd64 10.39-3 [220 kB] Get:53 http://ftpmaster.internal/ubuntu jammy-proposed/main amd64 libselinux1 amd64 3.3-1build1 [74.5 kB] Get:54 http://ftpmaster.internal/ubuntu jammy/main amd64 libmount1 amd64 2.37.2-4ubuntu1 [122 kB] Get:55 http://ftpmaster.internal/ubuntu jammy/main amd64 libseccomp2 amd64 2.5.2-2ubuntu2 [48.3 kB] Get:56 http://ftpmaster.internal/ubuntu jammy/main amd64 login amd64 1:4.8.1-2ubuntu1 [188 kB] Get:57 http://ftpmaster.internal/ubuntu jammy/main amd64 util-linux amd64 2.37.2-4ubuntu1 [1063 kB] Get:58 http://ftpmaster.internal/ubuntu jammy/main amd64 mount amd64 2.37.2-4ubuntu1 [114 kB] Get:59 http://ftpmaster.internal/ubuntu jammy/main amd64 systemd amd64 249.5-2ubuntu2 [4542 kB] Get:60 http://ftpmaster.internal/ubuntu jammy/main amd64 libsystemd0 amd64 249.5-2ubuntu2 [317 kB] Get:61 http://ftpmaster.internal/ubuntu jammy/main amd64 libudev1 amd64 249.5-2ubuntu2 [77.6 kB] Get:62 http://ftpmaster.internal/ubuntu jammy/main amd64 libapt-pkg6.0 amd64 2.3.13 [904 kB] Get:63 http://ftpmaster.internal/ubuntu jammy/main amd64 dpkg amd64 1.20.9ubuntu3 [1266 kB] Get:64 http://ftpmaster.internal/ubuntu jammy/main amd64 dash amd64 0.5.11+git20210903+057cd650a4ed-3 [91.8 kB] Get:65 http://ftpmaster.internal/ubuntu jammy/main amd64 grep amd64 3.7-1 [156 kB] Get:66 http://ftpmaster.internal/ubuntu jammy/main amd64 libncurses6 amd64 6.3-1 [111 kB] Get:67 http://ftpmaster.internal/ubuntu jammy/main amd64 libncursesw6 amd64 6.3-1 [147 kB] Get:68 http://ftpmaster.internal/ubuntu jammy/main amd64 libtinfo6 amd64 6.3-1 [104 kB] Get:69 http://ftpmaster.internal/ubuntu jammy/main amd64 ncurses-bin amd64 6.3-1 [184 kB] Get:70 http://ftpmaster.internal/ubuntu jammy-proposed/main amd64 sed amd64 4.8-1 [188 kB] Get:71 http://ftpmaster.internal/ubuntu jammy-proposed/main amd64 init-system-helpers all 1.61 [39.3 kB] Get:72 http://ftpmaster.internal/ubuntu jammy/main amd64 ncurses-base all 6.3-1 [19.9 kB] Get:73 http://ftpmaster.internal/ubuntu jammy/main amd64 gpgv amd64 2.2.27-2ubuntu1 [137 kB] Get:74 http://ftpmaster.internal/ubuntu jammy/main amd64 apt amd64 2.3.13 [1387 kB] Get:75 http://ftpmaster.internal/ubuntu jammy/main amd64 libsepol2 amd64 3.3-1 [281 kB] Get:76 http://ftpmaster.internal/ubuntu jammy-proposed/main amd64 libsemanage-common all 3.3-1build1 [10.0 kB] Get:77 http://ftpmaster.internal/ubuntu jammy-proposed/main amd64 libsemanage2 amd64 3.3-1build1 [92.4 kB] Get:78 http://ftpmaster.internal/ubuntu jammy/main amd64 passwd amd64 1:4.8.1-2ubuntu1 [765 kB] Get:79 http://ftpmaster.internal/ubuntu jammy/main amd64 libpam-modules-bin amd64 1.4.0-10ubuntu2 [37.6 kB] Get:80 http://ftpmaster.internal/ubuntu jammy/main amd64 libpam-modules amd64 1.4.0-10ubuntu2 [280 kB] Get:81 http://ftpmaster.internal/ubuntu jammy/main amd64 logsave amd64 1.46.4-1ubuntu1 [10.9 kB] Get:82 http://ftpmaster.internal/ubuntu jammy/main amd64 libext2fs2 amd64 1.46.4-1ubuntu1 [209 kB] Get:83 http://ftpmaster.internal/ubuntu jammy/main amd64 e2fsprogs amd64 1.46.4-1ubuntu1 [589 kB] Get:84 http://ftpmaster.internal/ubuntu jammy-proposed/main amd64 init amd64 1.61 [6102 B] Get:85 http://ftpmaster.internal/ubuntu jammy/main amd64 libattr1 amd64 1:2.5.1-1 [13.3 kB] Get:86 http://ftpmaster.internal/ubuntu jammy/main amd64 libcom-err2 amd64 1.46.4-1ubuntu1 [10.1 kB] Get:87 http://ftpmaster.internal/ubuntu jammy/main amd64 libk5crypto3 amd64 1.19.2-0ubuntu1 [86.3 kB] Get:88 http://ftpmaster.internal/ubuntu jammy/main amd64 libkrb5support0 amd64 1.19.2-0ubuntu1 [32.4 kB] Get:89 http://ftpmaster.internal/ubuntu jammy/main amd64 libkrb5-3 amd64 1.19.2-0ubuntu1 [356 kB] Get:90 http://ftpmaster.internal/ubuntu jammy/main amd64 libgssapi-krb5-2 amd64 1.19.2-0ubuntu1 [144 kB] Get:91 http://ftpmaster.internal/ubuntu jammy/main amd64 libpam-runtime all 1.4.0-10ubuntu2 [40.2 kB] Get:92 http://ftpmaster.internal/ubuntu jammy/main amd64 libsmartcols1 amd64 2.37.2-4ubuntu1 [50.9 kB] Get:93 http://ftpmaster.internal/ubuntu jammy/main amd64 libss2 amd64 1.46.4-1ubuntu1 [12.3 kB] Get:94 http://ftpmaster.internal/ubuntu jammy/main amd64 sensible-utils all 0.0.17 [20.1 kB] Get:95 http://ftpmaster.internal/ubuntu jammy/main amd64 usrmerge all 25ubuntu2 [54.7 kB] Get:96 http://ftpmaster.internal/ubuntu jammy-proposed/main amd64 openssl amd64 3.0.0-1ubuntu2 [1181 kB] Get:97 http://ftpmaster.internal/ubuntu jammy/main amd64 ca-certificates all 20211016 [148 kB] Get:98 http://ftpmaster.internal/ubuntu jammy/main amd64 libsqlite3-0 amd64 3.36.0-2 [641 kB] Get:99 http://ftpmaster.internal/ubuntu jammy/main amd64 tzdata all 2021e-1ubuntu1 [343 kB] Get:100 http://ftpmaster.internal/ubuntu jammy/main amd64 libgdbm6 amd64 1.22-1 [35.2 kB] Get:101 http://ftpmaster.internal/ubuntu jammy/main amd64 dpkg-dev all 1.20.9ubuntu3 [933 kB] Get:102 http://ftpmaster.internal/ubuntu jammy/main amd64 libdpkg-perl all 1.20.9ubuntu3 [235 kB] Get:103 http://ftpmaster.internal/ubuntu jammy/main amd64 make amd64 4.3-4ubuntu2 [179 kB] Get:104 http://ftpmaster.internal/ubuntu jammy/main amd64 lto-disabled-list all 17 [12.1 kB] Get:105 http://ftpmaster.internal/ubuntu jammy/main amd64 gpg amd64 2.2.27-2ubuntu1 [518 kB] Get:106 http://ftpmaster.internal/ubuntu jammy/main amd64 gpgconf amd64 2.2.27-2ubuntu1 [93.9 kB] Get:107 http://ftpmaster.internal/ubuntu jammy/main amd64 gpg-agent amd64 2.2.27-2ubuntu1 [209 kB] Get:108 http://ftpmaster.internal/ubuntu jammy/main amd64 libgdbm-compat4 amd64 1.22-1 [6450 B] Get:109 http://ftpmaster.internal/ubuntu jammy-proposed/main amd64 linux-libc-dev amd64 5.15.0-13.13 [1273 kB] Get:110 http://ftpmaster.internal/ubuntu jammy/main amd64 lockfile-progs amd64 0.1.19 [10.0 kB] Get:111 http://ftpmaster.internal/ubuntu jammy/main amd64 pkgbinarymangler all 149 [32.4 kB] debconf: delaying package configuration, since apt-utils is not installed Fetched 84.3 MB in 2s (39.8 MB/s) (Reading database ... 13258 files and directories currently installed.) Preparing to unpack .../debconf_1.5.79_all.deb ... Unpacking debconf (1.5.79) over (1.5.77) ... Setting up debconf (1.5.79) ... (Reading database ... 13257 files and directories currently installed.) Preparing to unpack .../libpam0g_1.4.0-10ubuntu2_amd64.deb ... Unpacking libpam0g:amd64 (1.4.0-10ubuntu2) over (1.3.1-5ubuntu11) ... Setting up libpam0g:amd64 (1.4.0-10ubuntu2) ... Checking for services that may need to be restarted...Checking init scripts... Nothing to restart. (Reading database ... 13257 files and directories currently installed.) Preparing to unpack .../libcrypt-dev_1%3a4.4.26-1_amd64.deb ... Unpacking libcrypt-dev:amd64 (1:4.4.26-1) over (1:4.4.18-4ubuntu2) ... Preparing to unpack .../libcrypt1_1%3a4.4.26-1_amd64.deb ... Unpacking libcrypt1:amd64 (1:4.4.26-1) over (1:4.4.18-4ubuntu2) ... Setting up libcrypt1:amd64 (1:4.4.26-1) ... (Reading database ... 13257 files and directories currently installed.) Preparing to unpack .../base-files_12ubuntu2_amd64.deb ... Unpacking base-files (12ubuntu2) over (12ubuntu1) ... Setting up base-files (12ubuntu2) ... (Reading database ... 13257 files and directories currently installed.) Preparing to unpack .../debianutils_5.5-1ubuntu1_amd64.deb ... Unpacking debianutils (5.5-1ubuntu1) over (4.11.2build1) ... Setting up debianutils (5.5-1ubuntu1) ... update-alternatives: using /usr/bin/which.debianutils to provide /usr/bin/which (which) in auto mode (Reading database ... 13261 files and directories currently installed.) Preparing to unpack .../bash_5.1-5ubuntu1_amd64.deb ... Unpacking bash (5.1-5ubuntu1) over (5.1-3ubuntu2) ... Setting up bash (5.1-5ubuntu1) ... update-alternatives: using /usr/share/man/man7/bash-builtins.7.gz to provide /usr/share/man/man7/builtins.7.gz (builtins.7.gz) in auto mode (Reading database ... 13261 files and directories currently installed.) Preparing to unpack .../bsdutils_1%3a2.37.2-4ubuntu1_amd64.deb ... Unpacking bsdutils (1:2.37.2-4ubuntu1) over (1:2.36.1-8ubuntu1) ... Setting up bsdutils (1:2.37.2-4ubuntu1) ... (Reading database ... 13261 files and directories currently installed.) Preparing to unpack .../libgpg-error0_1.42-3_amd64.deb ... Unpacking libgpg-error0:amd64 (1.42-3) over (1.38-2build2) ... Setting up libgpg-error0:amd64 (1.42-3) ... (Reading database ... 13261 files and directories currently installed.) Preparing to unpack .../libgcrypt20_1.9.4-3ubuntu2_amd64.deb ... Unpacking libgcrypt20:amd64 (1.9.4-3ubuntu2) over (1.8.7-5ubuntu2) ... Setting up libgcrypt20:amd64 (1.9.4-3ubuntu2) ... (Reading database ... 13261 files and directories currently installed.) Preparing to unpack .../bzip2_1.0.8-5_amd64.deb ... Unpacking bzip2 (1.0.8-5) over (1.0.8-4ubuntu4) ... Preparing to unpack .../libbz2-1.0_1.0.8-5_amd64.deb ... Unpacking libbz2-1.0:amd64 (1.0.8-5) over (1.0.8-4ubuntu4) ... Setting up libbz2-1.0:amd64 (1.0.8-5) ... (Reading database ... 13261 files and directories currently installed.) Preparing to unpack .../libcc1-0_11.2.0-12ubuntu1_amd64.deb ... Unpacking libcc1-0:amd64 (11.2.0-12ubuntu1) over (11.2.0-7ubuntu2) ... Preparing to unpack .../gcc-11-base_11.2.0-12ubuntu1_amd64.deb ... Unpacking gcc-11-base:amd64 (11.2.0-12ubuntu1) over (11.2.0-7ubuntu2) ... Setting up gcc-11-base:amd64 (11.2.0-12ubuntu1) ... (Reading database ... 13261 files and directories currently installed.) Preparing to unpack .../libgcc-s1_11.2.0-12ubuntu1_amd64.deb ... Unpacking libgcc-s1:amd64 (11.2.0-12ubuntu1) over (11.2.0-7ubuntu2) ... Setting up libgcc-s1:amd64 (11.2.0-12ubuntu1) ... (Reading database ... 13261 files and directories currently installed.) Preparing to unpack .../00-libgomp1_11.2.0-12ubuntu1_amd64.deb ... Unpacking libgomp1:amd64 (11.2.0-12ubuntu1) over (11.2.0-7ubuntu2) ... Preparing to unpack .../01-libitm1_11.2.0-12ubuntu1_amd64.deb ... Unpacking libitm1:amd64 (11.2.0-12ubuntu1) over (11.2.0-7ubuntu2) ... Preparing to unpack .../02-libatomic1_11.2.0-12ubuntu1_amd64.deb ... Unpacking libatomic1:amd64 (11.2.0-12ubuntu1) over (11.2.0-7ubuntu2) ... Preparing to unpack .../03-libasan6_11.2.0-12ubuntu1_amd64.deb ... Unpacking libasan6:amd64 (11.2.0-12ubuntu1) over (11.2.0-7ubuntu2) ... Preparing to unpack .../04-liblsan0_11.2.0-12ubuntu1_amd64.deb ... Unpacking liblsan0:amd64 (11.2.0-12ubuntu1) over (11.2.0-7ubuntu2) ... Preparing to unpack .../05-libtsan0_11.2.0-12ubuntu1_amd64.deb ... Unpacking libtsan0:amd64 (11.2.0-12ubuntu1) over (11.2.0-7ubuntu2) ... Preparing to unpack .../06-libubsan1_11.2.0-12ubuntu1_amd64.deb ... Unpacking libubsan1:amd64 (11.2.0-12ubuntu1) over (11.2.0-7ubuntu2) ... Preparing to unpack .../07-libquadmath0_11.2.0-12ubuntu1_amd64.deb ... Unpacking libquadmath0:amd64 (11.2.0-12ubuntu1) over (11.2.0-7ubuntu2) ... Preparing to unpack .../08-g++-11_11.2.0-12ubuntu1_amd64.deb ... Unpacking g++-11 (11.2.0-12ubuntu1) over (11.2.0-7ubuntu2) ... Preparing to unpack .../09-libstdc++-11-dev_11.2.0-12ubuntu1_amd64.deb ... Unpacking libstdc++-11-dev:amd64 (11.2.0-12ubuntu1) over (11.2.0-7ubuntu2) ... Preparing to unpack .../10-libgcc-11-dev_11.2.0-12ubuntu1_amd64.deb ... Unpacking libgcc-11-dev:amd64 (11.2.0-12ubuntu1) over (11.2.0-7ubuntu2) ... Preparing to unpack .../11-gcc-11_11.2.0-12ubuntu1_amd64.deb ... Unpacking gcc-11 (11.2.0-12ubuntu1) over (11.2.0-7ubuntu2) ... Preparing to unpack .../12-cpp-11_11.2.0-12ubuntu1_amd64.deb ... Unpacking cpp-11 (11.2.0-12ubuntu1) over (11.2.0-7ubuntu2) ... Preparing to unpack .../13-libstdc++6_11.2.0-12ubuntu1_amd64.deb ... Unpacking libstdc++6:amd64 (11.2.0-12ubuntu1) over (11.2.0-7ubuntu2) ... Setting up libstdc++6:amd64 (11.2.0-12ubuntu1) ... (Reading database ... 13263 files and directories currently installed.) Preparing to unpack .../libisl23_0.24-2_amd64.deb ... Unpacking libisl23:amd64 (0.24-2) over (0.24-1build1) ... Preparing to unpack .../libmpc3_1.2.1-1_amd64.deb ... Unpacking libmpc3:amd64 (1.2.1-1) over (1.2.0-1build2) ... Preparing to unpack .../libzstd1_1.4.8+dfsg-3_amd64.deb ... Unpacking libzstd1:amd64 (1.4.8+dfsg-3) over (1.4.8+dfsg-2.1build1) ... Setting up libzstd1:amd64 (1.4.8+dfsg-3) ... (Reading database ... 13263 files and directories currently installed.) Preparing to unpack .../0-libctf0_2.37-10ubuntu1_amd64.deb ... Unpacking libctf0:amd64 (2.37-10ubuntu1) over (2.37-7ubuntu1) ... Preparing to unpack .../1-libctf-nobfd0_2.37-10ubuntu1_amd64.deb ... Unpacking libctf-nobfd0:amd64 (2.37-10ubuntu1) over (2.37-7ubuntu1) ... Preparing to unpack .../2-libbinutils_2.37-10ubuntu1_amd64.deb ... Unpacking libbinutils:amd64 (2.37-10ubuntu1) over (2.37-7ubuntu1) ... Preparing to unpack .../3-binutils-common_2.37-10ubuntu1_amd64.deb ... Unpacking binutils-common:amd64 (2.37-10ubuntu1) over (2.37-7ubuntu1) ... Preparing to unpack .../4-binutils_2.37-10ubuntu1_amd64.deb ... Unpacking binutils (2.37-10ubuntu1) over (2.37-7ubuntu1) ... Preparing to unpack .../5-binutils-x86-64-linux-gnu_2.37-10ubuntu1_amd64.deb ... Unpacking binutils-x86-64-linux-gnu (2.37-10ubuntu1) over (2.37-7ubuntu1) ... Selecting previously unselected package libssl3:amd64. Preparing to unpack .../6-libssl3_3.0.0-1ubuntu2_amd64.deb ... Unpacking libssl3:amd64 (3.0.0-1ubuntu2) ... Setting up libssl3:amd64 (3.0.0-1ubuntu2) ... (Reading database ... 13274 files and directories currently installed.) Preparing to unpack .../libblkid1_2.37.2-4ubuntu1_amd64.deb ... Unpacking libblkid1:amd64 (2.37.2-4ubuntu1) over (2.36.1-8ubuntu1) ... Setting up libblkid1:amd64 (2.37.2-4ubuntu1) ... (Reading database ... 13274 files and directories currently installed.) Preparing to unpack .../libuuid1_2.37.2-4ubuntu1_amd64.deb ... Unpacking libuuid1:amd64 (2.37.2-4ubuntu1) over (2.36.1-8ubuntu1) ... Setting up libuuid1:amd64 (2.37.2-4ubuntu1) ... (Reading database ... 13274 files and directories currently installed.) Preparing to unpack .../libcryptsetup12_2%3a2.4.2-1ubuntu4_amd64.deb ... Unpacking libcryptsetup12:amd64 (2:2.4.2-1ubuntu4) over (2:2.3.6-0ubuntu1) ... Preparing to unpack .../libidn2-0_2.3.2-2_amd64.deb ... Unpacking libidn2-0:amd64 (2.3.2-2) over (2.3.1-1build1) ... Setting up libidn2-0:amd64 (2.3.2-2) ... (Reading database ... 13276 files and directories currently installed.) Preparing to unpack .../libp11-kit0_0.24.0-6_amd64.deb ... Unpacking libp11-kit0:amd64 (0.24.0-6) over (0.23.22-1build1) ... Setting up libp11-kit0:amd64 (0.24.0-6) ... (Reading database ... 13276 files and directories currently installed.) Preparing to unpack .../libtasn1-6_4.18.0-4_amd64.deb ... Unpacking libtasn1-6:amd64 (4.18.0-4) over (4.16.0-2build1) ... Setting up libtasn1-6:amd64 (4.18.0-4) ... (Reading database ... 13276 files and directories currently installed.) Preparing to unpack .../libgnutls30_3.7.2-2ubuntu1_amd64.deb ... Unpacking libgnutls30:amd64 (3.7.2-2ubuntu1) over (3.7.1-5ubuntu1) ... Setting up libgnutls30:amd64 (3.7.2-2ubuntu1) ... (Reading database ... 13276 files and directories currently installed.) Preparing to unpack .../0-systemd-sysv_249.5-2ubuntu2_amd64.deb ... Unpacking systemd-sysv (249.5-2ubuntu2) over (248.3-1ubuntu8) ... Preparing to unpack .../1-systemd-timesyncd_249.5-2ubuntu2_amd64.deb ... Unpacking systemd-timesyncd (249.5-2ubuntu2) over (248.3-1ubuntu8) ... Preparing to unpack .../2-libapparmor1_3.0.3-0ubuntu5_amd64.deb ... Unpacking libapparmor1:amd64 (3.0.3-0ubuntu5) over (3.0.3-0ubuntu1) ... Preparing to unpack .../3-libip4tc2_1.8.7-1ubuntu4_amd64.deb ... Unpacking libip4tc2:amd64 (1.8.7-1ubuntu4) over (1.8.7-1ubuntu3) ... Preparing to unpack .../4-libkmod2_28-1ubuntu5_amd64.deb ... Unpacking libkmod2:amd64 (28-1ubuntu5) over (28-1ubuntu4) ... Preparing to unpack .../5-libpcre2-8-0_10.39-3_amd64.deb ... Unpacking libpcre2-8-0:amd64 (10.39-3) over (10.37-0ubuntu2) ... Setting up libpcre2-8-0:amd64 (10.39-3) ... (Reading database ... 13276 files and directories currently installed.) Preparing to unpack .../libselinux1_3.3-1build1_amd64.deb ... Unpacking libselinux1:amd64 (3.3-1build1) over (3.1-3build2) ... Setting up libselinux1:amd64 (3.3-1build1) ... (Reading database ... 13276 files and directories currently installed.) Preparing to unpack .../libmount1_2.37.2-4ubuntu1_amd64.deb ... Unpacking libmount1:amd64 (2.37.2-4ubuntu1) over (2.36.1-8ubuntu1) ... Setting up libmount1:amd64 (2.37.2-4ubuntu1) ... (Reading database ... 13276 files and directories currently installed.) Preparing to unpack .../libseccomp2_2.5.2-2ubuntu2_amd64.deb ... Unpacking libseccomp2:amd64 (2.5.2-2ubuntu2) over (2.5.1-1ubuntu1) ... Setting up libseccomp2:amd64 (2.5.2-2ubuntu2) ... (Reading database ... 13276 files and directories currently installed.) Preparing to unpack .../login_1%3a4.8.1-2ubuntu1_amd64.deb ... Unpacking login (1:4.8.1-2ubuntu1) over (1:4.8.1-1ubuntu9) ... Setting up login (1:4.8.1-2ubuntu1) ... (Reading database ... 13276 files and directories currently installed.) Preparing to unpack .../util-linux_2.37.2-4ubuntu1_amd64.deb ... Unpacking util-linux (2.37.2-4ubuntu1) over (2.36.1-8ubuntu1) ... Setting up util-linux (2.37.2-4ubuntu1) ... (Reading database ... 13271 files and directories currently installed.) Preparing to unpack .../mount_2.37.2-4ubuntu1_amd64.deb ... Unpacking mount (2.37.2-4ubuntu1) over (2.36.1-8ubuntu1) ... Preparing to unpack .../systemd_249.5-2ubuntu2_amd64.deb ... Unpacking systemd (249.5-2ubuntu2) over (248.3-1ubuntu8) ... Preparing to unpack .../libsystemd0_249.5-2ubuntu2_amd64.deb ... Unpacking libsystemd0:amd64 (249.5-2ubuntu2) over (248.3-1ubuntu8) ... Setting up libsystemd0:amd64 (249.5-2ubuntu2) ... (Reading database ... 13273 files and directories currently installed.) Preparing to unpack .../libudev1_249.5-2ubuntu2_amd64.deb ... Unpacking libudev1:amd64 (249.5-2ubuntu2) over (248.3-1ubuntu8) ... Setting up libudev1:amd64 (249.5-2ubuntu2) ... (Reading database ... 13273 files and directories currently installed.) Preparing to unpack .../libapt-pkg6.0_2.3.13_amd64.deb ... Unpacking libapt-pkg6.0:amd64 (2.3.13) over (2.3.9) ... Setting up libapt-pkg6.0:amd64 (2.3.13) ... (Reading database ... 13273 files and directories currently installed.) Preparing to unpack .../dpkg_1.20.9ubuntu3_amd64.deb ... Unpacking dpkg (1.20.9ubuntu3) over (1.20.9ubuntu2) ... Setting up dpkg (1.20.9ubuntu3) ... (Reading database ... 13273 files and directories currently installed.) Preparing to unpack .../dash_0.5.11+git20210903+057cd650a4ed-3_amd64.deb ... Unpacking dash (0.5.11+git20210903+057cd650a4ed-3) over (0.5.11+git20210120+802ebd4-1build1) ... Setting up dash (0.5.11+git20210903+057cd650a4ed-3) ... (Reading database ... 13273 files and directories currently installed.) Preparing to unpack .../archives/grep_3.7-1_amd64.deb ... Unpacking grep (3.7-1) over (3.7-0ubuntu1) ... Setting up grep (3.7-1) ... (Reading database ... 13273 files and directories currently installed.) Preparing to unpack .../libncurses6_6.3-1_amd64.deb ... Unpacking libncurses6:amd64 (6.3-1) over (6.2+20201114-2build2) ... Preparing to unpack .../libncursesw6_6.3-1_amd64.deb ... Unpacking libncursesw6:amd64 (6.3-1) over (6.2+20201114-2build2) ... Preparing to unpack .../libtinfo6_6.3-1_amd64.deb ... Unpacking libtinfo6:amd64 (6.3-1) over (6.2+20201114-2build2) ... Setting up libtinfo6:amd64 (6.3-1) ... (Reading database ... 13273 files and directories currently installed.) Preparing to unpack .../ncurses-bin_6.3-1_amd64.deb ... Unpacking ncurses-bin (6.3-1) over (6.2+20201114-2build2) ... Setting up ncurses-bin (6.3-1) ... (Reading database ... 13273 files and directories currently installed.) Preparing to unpack .../archives/sed_4.8-1_amd64.deb ... Unpacking sed (4.8-1) over (4.7-1ubuntu2) ... Setting up sed (4.8-1) ... (Reading database ... 13273 files and directories currently installed.) Preparing to unpack .../init-system-helpers_1.61_all.deb ... Unpacking init-system-helpers (1.61) over (1.60build1) ... Setting up init-system-helpers (1.61) ... (Reading database ... 13273 files and directories currently installed.) Preparing to unpack .../ncurses-base_6.3-1_all.deb ... Unpacking ncurses-base (6.3-1) over (6.2+20201114-2build2) ... Setting up ncurses-base (6.3-1) ... (Reading database ... 13273 files and directories currently installed.) Preparing to unpack .../gpgv_2.2.27-2ubuntu1_amd64.deb ... Unpacking gpgv (2.2.27-2ubuntu1) over (2.2.20-1ubuntu4) ... Setting up gpgv (2.2.27-2ubuntu1) ... (Reading database ... 13273 files and directories currently installed.) Preparing to unpack .../archives/apt_2.3.13_amd64.deb ... Unpacking apt (2.3.13) over (2.3.9) ... Setting up apt (2.3.13) ... Installing new version of config file /etc/cron.daily/apt-compat ... Selecting previously unselected package libsepol2:amd64. (Reading database ... 13273 files and directories currently installed.) Preparing to unpack .../libsepol2_3.3-1_amd64.deb ... Unpacking libsepol2:amd64 (3.3-1) ... Setting up libsepol2:amd64 (3.3-1) ... (Reading database ... 13277 files and directories currently installed.) Preparing to unpack .../libsemanage-common_3.3-1build1_all.deb ... Unpacking libsemanage-common (3.3-1build1) over (3.1-1ubuntu3) ... Setting up libsemanage-common (3.3-1build1) ... Selecting previously unselected package libsemanage2:amd64. (Reading database ... 13277 files and directories currently installed.) Preparing to unpack .../libsemanage2_3.3-1build1_amd64.deb ... Unpacking libsemanage2:amd64 (3.3-1build1) ... Setting up libsemanage2:amd64 (3.3-1build1) ... (Reading database ... 13281 files and directories currently installed.) Preparing to unpack .../passwd_1%3a4.8.1-2ubuntu1_amd64.deb ... Unpacking passwd (1:4.8.1-2ubuntu1) over (1:4.8.1-1ubuntu9) ... Setting up passwd (1:4.8.1-2ubuntu1) ... (Reading database ... 13288 files and directories currently installed.) Removing libsemanage1:amd64 (3.1-1ubuntu3) ... (Reading database ... 13284 files and directories currently installed.) Preparing to unpack .../libpam-modules-bin_1.4.0-10ubuntu2_amd64.deb ... Unpacking libpam-modules-bin (1.4.0-10ubuntu2) over (1.3.1-5ubuntu11) ... Setting up libpam-modules-bin (1.4.0-10ubuntu2) ... (Reading database ... 13282 files and directories currently installed.) Preparing to unpack .../libpam-modules_1.4.0-10ubuntu2_amd64.deb ... Unpacking libpam-modules:amd64 (1.4.0-10ubuntu2) over (1.3.1-5ubuntu11) ... Setting up libpam-modules:amd64 (1.4.0-10ubuntu2) ... Installing new version of config file /etc/security/namespace.conf ... Installing new version of config file /etc/security/pam_env.conf ... (Reading database ... 13283 files and directories currently installed.) Preparing to unpack .../logsave_1.46.4-1ubuntu1_amd64.deb ... Unpacking logsave (1.46.4-1ubuntu1) over (1.46.3-1ubuntu3) ... Preparing to unpack .../libext2fs2_1.46.4-1ubuntu1_amd64.deb ... Unpacking libext2fs2:amd64 (1.46.4-1ubuntu1) over (1.46.3-1ubuntu3) ... Setting up libext2fs2:amd64 (1.46.4-1ubuntu1) ... (Reading database ... 13283 files and directories currently installed.) Preparing to unpack .../e2fsprogs_1.46.4-1ubuntu1_amd64.deb ... Unpacking e2fsprogs (1.46.4-1ubuntu1) over (1.46.3-1ubuntu3) ... Setting up libapparmor1:amd64 (3.0.3-0ubuntu5) ... Setting up libcryptsetup12:amd64 (2:2.4.2-1ubuntu4) ... Setting up libip4tc2:amd64 (1.8.7-1ubuntu4) ... Setting up libkmod2:amd64 (28-1ubuntu5) ... Setting up mount (2.37.2-4ubuntu1) ... Setting up systemd (249.5-2ubuntu2) ... Installing new version of config file /etc/systemd/networkd.conf ... Installing new version of config file /etc/systemd/resolved.conf ... Initializing machine ID from random generator. Setting up systemd-sysv (249.5-2ubuntu2) ... (Reading database ... 13283 files and directories currently installed.) Preparing to unpack .../archives/init_1.61_amd64.deb ... Unpacking init (1.61) over (1.60build1) ... Preparing to unpack .../libattr1_1%3a2.5.1-1_amd64.deb ... Unpacking libattr1:amd64 (1:2.5.1-1) over (1:2.4.48-6build2) ... Setting up libattr1:amd64 (1:2.5.1-1) ... Installing new version of config file /etc/xattr.conf ... (Reading database ... 13283 files and directories currently installed.) Preparing to unpack .../libcom-err2_1.46.4-1ubuntu1_amd64.deb ... Unpacking libcom-err2:amd64 (1.46.4-1ubuntu1) over (1.46.3-1ubuntu3) ... Setting up libcom-err2:amd64 (1.46.4-1ubuntu1) ... (Reading database ... 13283 files and directories currently installed.) Preparing to unpack .../libk5crypto3_1.19.2-0ubuntu1_amd64.deb ... Unpacking libk5crypto3:amd64 (1.19.2-0ubuntu1) over (1.18.3-6) ... Setting up libk5crypto3:amd64 (1.19.2-0ubuntu1) ... (Reading database ... 13283 files and directories currently installed.) Preparing to unpack .../libkrb5support0_1.19.2-0ubuntu1_amd64.deb ... Unpacking libkrb5support0:amd64 (1.19.2-0ubuntu1) over (1.18.3-6) ... Setting up libkrb5support0:amd64 (1.19.2-0ubuntu1) ... (Reading database ... 13283 files and directories currently installed.) Preparing to unpack .../libkrb5-3_1.19.2-0ubuntu1_amd64.deb ... Unpacking libkrb5-3:amd64 (1.19.2-0ubuntu1) over (1.18.3-6) ... Setting up libkrb5-3:amd64 (1.19.2-0ubuntu1) ... (Reading database ... 13283 files and directories currently installed.) Preparing to unpack .../libgssapi-krb5-2_1.19.2-0ubuntu1_amd64.deb ... Unpacking libgssapi-krb5-2:amd64 (1.19.2-0ubuntu1) over (1.18.3-6) ... Setting up libgssapi-krb5-2:amd64 (1.19.2-0ubuntu1) ... (Reading database ... 13283 files and directories currently installed.) Preparing to unpack .../libpam-runtime_1.4.0-10ubuntu2_all.deb ... Unpacking libpam-runtime (1.4.0-10ubuntu2) over (1.3.1-5ubuntu11) ... Setting up libpam-runtime (1.4.0-10ubuntu2) ... (Reading database ... 13283 files and directories currently installed.) Preparing to unpack .../libsmartcols1_2.37.2-4ubuntu1_amd64.deb ... Unpacking libsmartcols1:amd64 (2.37.2-4ubuntu1) over (2.36.1-8ubuntu1) ... Setting up libsmartcols1:amd64 (2.37.2-4ubuntu1) ... (Reading database ... 13283 files and directories currently installed.) Preparing to unpack .../00-libss2_1.46.4-1ubuntu1_amd64.deb ... Unpacking libss2:amd64 (1.46.4-1ubuntu1) over (1.46.3-1ubuntu3) ... Preparing to unpack .../01-sensible-utils_0.0.17_all.deb ... Unpacking sensible-utils (0.0.17) over (0.0.14) ... Preparing to unpack .../02-usrmerge_25ubuntu2_all.deb ... Unpacking usrmerge (25ubuntu2) over (25ubuntu1) ... Preparing to unpack .../03-openssl_3.0.0-1ubuntu2_amd64.deb ... Unpacking openssl (3.0.0-1ubuntu2) over (1.1.1l-1ubuntu1) ... Preparing to unpack .../04-ca-certificates_20211016_all.deb ... Unpacking ca-certificates (20211016) over (20210119ubuntu1) ... Preparing to unpack .../05-libsqlite3-0_3.36.0-2_amd64.deb ... Unpacking libsqlite3-0:amd64 (3.36.0-2) over (3.35.5-1) ... Preparing to unpack .../06-tzdata_2021e-1ubuntu1_all.deb ... Unpacking tzdata (2021e-1ubuntu1) over (2021a-2ubuntu1) ... Preparing to unpack .../07-libgdbm6_1.22-1_amd64.deb ... Unpacking libgdbm6:amd64 (1.22-1) over (1.19-2build1) ... Preparing to unpack .../08-dpkg-dev_1.20.9ubuntu3_all.deb ... Unpacking dpkg-dev (1.20.9ubuntu3) over (1.20.9ubuntu2) ... Preparing to unpack .../09-libdpkg-perl_1.20.9ubuntu3_all.deb ... Unpacking libdpkg-perl (1.20.9ubuntu3) over (1.20.9ubuntu2) ... Preparing to unpack .../10-make_4.3-4ubuntu2_amd64.deb ... Unpacking make (4.3-4ubuntu2) over (4.3-4ubuntu1) ... Preparing to unpack .../11-lto-disabled-list_17_all.deb ... Unpacking lto-disabled-list (17) over (16) ... Preparing to unpack .../12-gpg_2.2.27-2ubuntu1_amd64.deb ... Unpacking gpg (2.2.27-2ubuntu1) over (2.2.20-1ubuntu4) ... Preparing to unpack .../13-gpgconf_2.2.27-2ubuntu1_amd64.deb ... Unpacking gpgconf (2.2.27-2ubuntu1) over (2.2.20-1ubuntu4) ... Preparing to unpack .../14-gpg-agent_2.2.27-2ubuntu1_amd64.deb ... Unpacking gpg-agent (2.2.27-2ubuntu1) over (2.2.20-1ubuntu4) ... Preparing to unpack .../15-libgdbm-compat4_1.22-1_amd64.deb ... Unpacking libgdbm-compat4:amd64 (1.22-1) over (1.19-2build1) ... Preparing to unpack .../16-linux-libc-dev_5.15.0-13.13_amd64.deb ... Unpacking linux-libc-dev:amd64 (5.15.0-13.13) over (5.13.0-19.19) ... Preparing to unpack .../17-lockfile-progs_0.1.19_amd64.deb ... Unpacking lockfile-progs (0.1.19) over (0.1.18build1) ... Preparing to unpack .../18-pkgbinarymangler_149_all.deb ... Unpacking pkgbinarymangler (149) over (148) ... Setting up lto-disabled-list (17) ... Setting up init (1.61) ... Setting up libsqlite3-0:amd64 (3.36.0-2) ... Setting up binutils-common:amd64 (2.37-10ubuntu1) ... Setting up linux-libc-dev:amd64 (5.15.0-13.13) ... Setting up libctf-nobfd0:amd64 (2.37-10ubuntu1) ... Setting up libgomp1:amd64 (11.2.0-12ubuntu1) ... Setting up bzip2 (1.0.8-5) ... Setting up libasan6:amd64 (11.2.0-12ubuntu1) ... Setting up tzdata (2021e-1ubuntu1) ... Current default time zone: 'Etc/UTC' Local time is now: Sun Dec 12 08:26:39 UTC 2021. Universal Time is now: Sun Dec 12 08:26:39 UTC 2021. Run 'dpkg-reconfigure tzdata' if you wish to change it. Setting up make (4.3-4ubuntu2) ... Setting up libncurses6:amd64 (6.3-1) ... Setting up libquadmath0:amd64 (11.2.0-12ubuntu1) ... Setting up libmpc3:amd64 (1.2.1-1) ... Setting up systemd-timesyncd (249.5-2ubuntu2) ... Setting up lockfile-progs (0.1.19) ... Setting up libatomic1:amd64 (11.2.0-12ubuntu1) ... Setting up usrmerge (25ubuntu2) ... Setting up libss2:amd64 (1.46.4-1ubuntu1) ... Setting up libncursesw6:amd64 (6.3-1) ... Setting up libdpkg-perl (1.20.9ubuntu3) ... Setting up logsave (1.46.4-1ubuntu1) ... Setting up libubsan1:amd64 (11.2.0-12ubuntu1) ... Setting up sensible-utils (0.0.17) ... Setting up libcrypt-dev:amd64 (1:4.4.26-1) ... Setting up gpgconf (2.2.27-2ubuntu1) ... Setting up libbinutils:amd64 (2.37-10ubuntu1) ... Setting up libisl23:amd64 (0.24-2) ... Setting up openssl (3.0.0-1ubuntu2) ... Installing new version of config file /etc/ssl/openssl.cnf ... Setting up libcc1-0:amd64 (11.2.0-12ubuntu1) ... Setting up gpg (2.2.27-2ubuntu1) ... Setting up liblsan0:amd64 (11.2.0-12ubuntu1) ... Setting up libitm1:amd64 (11.2.0-12ubuntu1) ... Setting up libgdbm6:amd64 (1.22-1) ... Setting up libtsan0:amd64 (11.2.0-12ubuntu1) ... Setting up libctf0:amd64 (2.37-10ubuntu1) ... Setting up cpp-11 (11.2.0-12ubuntu1) ... Setting up gpg-agent (2.2.27-2ubuntu1) ... Setting up pkgbinarymangler (149) ... Setting up e2fsprogs (1.46.4-1ubuntu1) ... Installing new version of config file /etc/mke2fs.conf ... Setting up ca-certificates (20211016) ... Updating certificates in /etc/ssl/certs... rehash: warning: skipping ca-certificates.crt,it does not contain exactly one certificate or CRL 7 added, 8 removed; done. Setting up libgdbm-compat4:amd64 (1.22-1) ... Setting up libgcc-11-dev:amd64 (11.2.0-12ubuntu1) ... Setting up binutils-x86-64-linux-gnu (2.37-10ubuntu1) ... Setting up binutils (2.37-10ubuntu1) ... Setting up dpkg-dev (1.20.9ubuntu3) ... Setting up libstdc++-11-dev:amd64 (11.2.0-12ubuntu1) ... Setting up gcc-11 (11.2.0-12ubuntu1) ... Setting up g++-11 (11.2.0-12ubuntu1) ... Processing triggers for libc-bin (2.34-0ubuntu3) ... Processing triggers for ca-certificates (20211016) ... Updating certificates in /etc/ssl/certs... 0 added, 0 removed; done. Running hooks in /etc/ca-certificates/update.d... done. RUN: /usr/share/launchpad-buildd/bin/sbuild-package PACKAGEBUILD-22594287 amd64 jammy-proposed -c chroot:build-PACKAGEBUILD-22594287 --arch=amd64 --dist=jammy-proposed --nolog -A sqlmodel_0.0.4-2.dsc Initiating build PACKAGEBUILD-22594287 with 4 jobs across 4 processor cores. Kernel reported to sbuild: 4.15.0-163-generic #171-Ubuntu SMP Fri Nov 5 11:55:11 UTC 2021 x86_64 sbuild (Debian sbuild) 0.75.0 (21 Mar 2018) on lcy01-amd64-016.buildd +==============================================================================+ | sqlmodel 0.0.4-2 (amd64) Sun, 12 Dec 2021 08:26:45 +0000 | +==============================================================================+ Package: sqlmodel Version: 0.0.4-2 Source Version: 0.0.4-2 Distribution: jammy-proposed Machine Architecture: amd64 Host Architecture: amd64 Build Architecture: amd64 Build Type: binary I: NOTICE: Log filtering will replace 'home/buildd/build-PACKAGEBUILD-22594287/chroot-autobuild' with '<>' +------------------------------------------------------------------------------+ | Fetch source files | +------------------------------------------------------------------------------+ Local sources ------------- sqlmodel_0.0.4-2.dsc exists in .; copying to chroot I: NOTICE: Log filtering will replace 'build/sqlmodel-FsnI8h/sqlmodel-0.0.4' with '<>' I: NOTICE: Log filtering will replace 'build/sqlmodel-FsnI8h' with '<>' +------------------------------------------------------------------------------+ | Install build-essential | +------------------------------------------------------------------------------+ Setup apt archive ----------------- Merged Build-Depends: build-essential, fakeroot Filtered Build-Depends: build-essential, fakeroot dpkg-deb: building package 'sbuild-build-depends-core-dummy' in '/<>/resolver-1YDo7n/apt_archive/sbuild-build-depends-core-dummy.deb'. dpkg-scanpackages: warning: Packages in archive but missing from override file: dpkg-scanpackages: warning: sbuild-build-depends-core-dummy dpkg-scanpackages: info: Wrote 1 entries to output Packages file. Ign:1 copy:/<>/resolver-1YDo7n/apt_archive ./ InRelease Get:2 copy:/<>/resolver-1YDo7n/apt_archive ./ Release [957 B] Ign:3 copy:/<>/resolver-1YDo7n/apt_archive ./ Release.gpg Get:4 copy:/<>/resolver-1YDo7n/apt_archive ./ Sources [349 B] Get:5 copy:/<>/resolver-1YDo7n/apt_archive ./ Packages [432 B] Fetched 1738 B in 0s (91.8 kB/s) Reading package lists... Reading package lists... Install core build dependencies (apt-based resolver) ---------------------------------------------------- Installing build dependencies Reading package lists... Building dependency tree... Reading state information... The following packages were automatically installed and are no longer required: libssl1.1 systemd-timesyncd Use 'apt autoremove' to remove them. The following NEW packages will be installed: sbuild-build-depends-core-dummy 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Need to get 650 B of archives. After this operation, 0 B of additional disk space will be used. Get:1 copy:/<>/resolver-1YDo7n/apt_archive ./ sbuild-build-depends-core-dummy 0.invalid.0 [650 B] debconf: delaying package configuration, since apt-utils is not installed Fetched 650 B in 0s (0 B/s) Selecting previously unselected package sbuild-build-depends-core-dummy. (Reading database ... 13453 files and directories currently installed.) Preparing to unpack .../sbuild-build-depends-core-dummy_0.invalid.0_amd64.deb ... Unpacking sbuild-build-depends-core-dummy (0.invalid.0) ... Setting up sbuild-build-depends-core-dummy (0.invalid.0) ... +------------------------------------------------------------------------------+ | Check architectures | +------------------------------------------------------------------------------+ Arch check ok (amd64 included in all) +------------------------------------------------------------------------------+ | Install package build dependencies | +------------------------------------------------------------------------------+ Setup apt archive ----------------- Merged Build-Depends: debhelper-compat (= 13), dh-python, python3-all, python3-fastapi, python3-pydantic, python3-pytest, python3-requests, python3-sqlalchemy (>= 1.4) Filtered Build-Depends: debhelper-compat (= 13), dh-python, python3-all, python3-fastapi, python3-pydantic, python3-pytest, python3-requests, python3-sqlalchemy (>= 1.4) dpkg-deb: building package 'sbuild-build-depends-sqlmodel-dummy' in '/<>/resolver-1YDo7n/apt_archive/sbuild-build-depends-sqlmodel-dummy.deb'. dpkg-scanpackages: warning: Packages in archive but missing from override file: dpkg-scanpackages: warning: sbuild-build-depends-core-dummy sbuild-build-depends-sqlmodel-dummy dpkg-scanpackages: info: Wrote 2 entries to output Packages file. Ign:1 copy:/<>/resolver-1YDo7n/apt_archive ./ InRelease Get:2 copy:/<>/resolver-1YDo7n/apt_archive ./ Release [963 B] Ign:3 copy:/<>/resolver-1YDo7n/apt_archive ./ Release.gpg Get:4 copy:/<>/resolver-1YDo7n/apt_archive ./ Sources [562 B] Get:5 copy:/<>/resolver-1YDo7n/apt_archive ./ Packages [629 B] Fetched 2154 B in 0s (109 kB/s) Reading package lists... Reading package lists... Install sqlmodel build dependencies (apt-based resolver) -------------------------------------------------------- Installing build dependencies Reading package lists... Building dependency tree... Reading state information... The following packages were automatically installed and are no longer required: libssl1.1 systemd-timesyncd Use 'apt autoremove' to remove them. The following additional packages will be installed: autoconf automake autopoint autotools-dev bsdextrautils debhelper debugedit dh-autoreconf dh-python dh-strip-nondeterminism dwz file gettext gettext-base groff-base intltool-debian libarchive-zip-perl libbsd0 libdebhelper-perl libdw1 libedit2 libelf1 libexpat1 libfile-stripnondeterminism-perl libicu67 libmagic-mgc libmagic1 libmd0 libmpdec3 libpipeline1 libpython3-stdlib libpython3.10-minimal libpython3.10-stdlib libpython3.9-minimal libpython3.9-stdlib libsigsegv2 libsub-override-perl libtool libuchardet0 libxml2 m4 man-db media-types po-debconf python3 python3-all python3-anyio python3-attr python3-certifi python3-chardet python3-click python3-colorama python3-distutils python3-fastapi python3-greenlet python3-h11 python3-idna python3-importlib-metadata python3-iniconfig python3-lib2to3 python3-minimal python3-more-itertools python3-packaging python3-pkg-resources python3-pluggy python3-py python3-pydantic python3-pyparsing python3-pytest python3-requests python3-six python3-sniffio python3-sqlalchemy python3-starlette python3-toml python3-typing-extensions python3-urllib3 python3-uvicorn python3-wsproto python3-zipp python3.10 python3.10-minimal python3.9 python3.9-minimal Suggested packages: autoconf-archive gnu-standards autoconf-doc dh-make flit gettext-doc libasprintf-dev libgettextpo-dev groff libtool-doc gfortran | fortran95-compiler gcj-jdk m4-doc apparmor less www-browser libmail-box-perl python3-doc python3-tk python3-venv python-attr-doc python-greenlet-dev python-greenlet-doc python3-setuptools subversion python-pyparsing-doc python3-cryptography python3-openssl python3-socks python-requests-doc python-sqlalchemy-doc python3-fdb python3-pymssql python3-mysqldb python3-psycopg2 python3-databases python3-multipart python-uvicorn-doc python3.10-venv python3.10-doc binfmt-support python3.9-venv python3.9-doc Recommended packages: curl | wget | lynx libarchive-cpio-perl libltdl-dev libmail-sendmail-perl python3-pygments python3-sqlalchemy-ext python3-aiofiles python3-itsdangerous python3-graphene python3-jinja2 python3-yaml The following NEW packages will be installed: autoconf automake autopoint autotools-dev bsdextrautils debhelper debugedit dh-autoreconf dh-python dh-strip-nondeterminism dwz file gettext gettext-base groff-base intltool-debian libarchive-zip-perl libbsd0 libdebhelper-perl libdw1 libedit2 libelf1 libexpat1 libfile-stripnondeterminism-perl libicu67 libmagic-mgc libmagic1 libmd0 libmpdec3 libpipeline1 libpython3-stdlib libpython3.10-minimal libpython3.10-stdlib libpython3.9-minimal libpython3.9-stdlib libsigsegv2 libsub-override-perl libtool libuchardet0 libxml2 m4 man-db media-types po-debconf python3 python3-all python3-anyio python3-attr python3-certifi python3-chardet python3-click python3-colorama python3-distutils python3-fastapi python3-greenlet python3-h11 python3-idna python3-importlib-metadata python3-iniconfig python3-lib2to3 python3-minimal python3-more-itertools python3-packaging python3-pkg-resources python3-pluggy python3-py python3-pydantic python3-pyparsing python3-pytest python3-requests python3-six python3-sniffio python3-sqlalchemy python3-starlette python3-toml python3-typing-extensions python3-urllib3 python3-uvicorn python3-wsproto python3-zipp python3.10 python3.10-minimal python3.9 python3.9-minimal sbuild-build-depends-sqlmodel-dummy 0 upgraded, 85 newly installed, 0 to remove and 0 not upgraded. Need to get 31.7 MB of archives. After this operation, 121 MB of additional disk space will be used. Get:1 copy:/<>/resolver-1YDo7n/apt_archive ./ sbuild-build-depends-sqlmodel-dummy 0.invalid.0 [716 B] Get:2 http://ftpmaster.internal/ubuntu jammy/main amd64 libpython3.9-minimal amd64 3.9.9-1build1 [790 kB] Get:3 http://ftpmaster.internal/ubuntu jammy/main amd64 libexpat1 amd64 2.4.1-3 [90.1 kB] Get:4 http://ftpmaster.internal/ubuntu jammy/main amd64 python3.9-minimal amd64 3.9.9-1build1 [2072 kB] Get:5 http://ftpmaster.internal/ubuntu jammy-proposed/main amd64 python3-minimal amd64 3.9.7-4 [24.7 kB] Get:6 http://ftpmaster.internal/ubuntu jammy/main amd64 media-types all 4.0.0 [22.2 kB] Get:7 http://ftpmaster.internal/ubuntu jammy/main amd64 libmpdec3 amd64 2.5.1-2build1 [86.8 kB] Get:8 http://ftpmaster.internal/ubuntu jammy/main amd64 libpython3.9-stdlib amd64 3.9.9-1build1 [1807 kB] Get:9 http://ftpmaster.internal/ubuntu jammy/main amd64 python3.9 amd64 3.9.9-1build1 [437 kB] Get:10 http://ftpmaster.internal/ubuntu jammy-proposed/main amd64 libpython3-stdlib amd64 3.9.7-4 [7298 B] Get:11 http://ftpmaster.internal/ubuntu jammy-proposed/main amd64 python3 amd64 3.9.7-4 [22.8 kB] Get:12 http://ftpmaster.internal/ubuntu jammy/main amd64 bsdextrautils amd64 2.37.2-4ubuntu1 [71.1 kB] Get:13 http://ftpmaster.internal/ubuntu jammy/main amd64 libuchardet0 amd64 0.0.7-1build1 [76.7 kB] Get:14 http://ftpmaster.internal/ubuntu jammy/main amd64 groff-base amd64 1.22.4-7 [956 kB] Get:15 http://ftpmaster.internal/ubuntu jammy/main amd64 libpipeline1 amd64 1.5.4-1 [23.6 kB] Get:16 http://ftpmaster.internal/ubuntu jammy/main amd64 man-db amd64 2.9.4-2build1 [1180 kB] Get:17 http://ftpmaster.internal/ubuntu jammy/main amd64 libpython3.10-minimal amd64 3.10.1-1 [808 kB] Get:18 http://ftpmaster.internal/ubuntu jammy/main amd64 python3.10-minimal amd64 3.10.1-1 [2099 kB] Get:19 http://ftpmaster.internal/ubuntu jammy/main amd64 libmd0 amd64 1.0.4-1 [22.9 kB] Get:20 http://ftpmaster.internal/ubuntu jammy/main amd64 libbsd0 amd64 0.11.3-1ubuntu3 [44.7 kB] Get:21 http://ftpmaster.internal/ubuntu jammy/main amd64 libelf1 amd64 0.186-1 [51.4 kB] Get:22 http://ftpmaster.internal/ubuntu jammy/main amd64 libicu67 amd64 67.1-7ubuntu1 [10.1 MB] Get:23 http://ftpmaster.internal/ubuntu jammy/main amd64 libxml2 amd64 2.9.12+dfsg-5 [761 kB] Get:24 http://ftpmaster.internal/ubuntu jammy-proposed/main amd64 python3-pkg-resources all 59.4.0-1 [132 kB] Get:25 http://ftpmaster.internal/ubuntu jammy/main amd64 libmagic-mgc amd64 1:5.41-2 [257 kB] Get:26 http://ftpmaster.internal/ubuntu jammy/main amd64 libmagic1 amd64 1:5.41-2 [87.3 kB] Get:27 http://ftpmaster.internal/ubuntu jammy/main amd64 file amd64 1:5.41-2 [21.5 kB] Get:28 http://ftpmaster.internal/ubuntu jammy/main amd64 gettext-base amd64 0.21-4ubuntu3 [36.6 kB] Get:29 http://ftpmaster.internal/ubuntu jammy/main amd64 libedit2 amd64 3.1-20210910-1 [96.5 kB] Get:30 http://ftpmaster.internal/ubuntu jammy/main amd64 libsigsegv2 amd64 2.13-1ubuntu2 [14.6 kB] Get:31 http://ftpmaster.internal/ubuntu jammy/main amd64 m4 amd64 1.4.18-5ubuntu1 [199 kB] Get:32 http://ftpmaster.internal/ubuntu jammy/main amd64 autoconf all 2.71-2 [338 kB] Get:33 http://ftpmaster.internal/ubuntu jammy/main amd64 autotools-dev all 20180224.1+nmu1 [39.4 kB] Get:34 http://ftpmaster.internal/ubuntu jammy/main amd64 automake all 1:1.16.5-1.1 [558 kB] Get:35 http://ftpmaster.internal/ubuntu jammy/main amd64 autopoint all 0.21-4ubuntu3 [422 kB] Get:36 http://ftpmaster.internal/ubuntu jammy/main amd64 libdebhelper-perl all 13.5.2ubuntu1 [66.0 kB] Get:37 http://ftpmaster.internal/ubuntu jammy/main amd64 libtool all 2.4.6-15build1 [164 kB] Get:38 http://ftpmaster.internal/ubuntu jammy/main amd64 dh-autoreconf all 20 [16.1 kB] Get:39 http://ftpmaster.internal/ubuntu jammy/main amd64 libarchive-zip-perl all 1.68-1 [90.2 kB] Get:40 http://ftpmaster.internal/ubuntu jammy/main amd64 libsub-override-perl all 0.09-2 [9532 B] Get:41 http://ftpmaster.internal/ubuntu jammy/main amd64 libfile-stripnondeterminism-perl all 1.12.1-1 [18.1 kB] Get:42 http://ftpmaster.internal/ubuntu jammy/main amd64 dh-strip-nondeterminism all 1.12.1-1 [5200 B] Get:43 http://ftpmaster.internal/ubuntu jammy/main amd64 libdw1 amd64 0.186-1 [251 kB] Get:44 http://ftpmaster.internal/ubuntu jammy/main amd64 debugedit amd64 1:5.0-3 [47.0 kB] Get:45 http://ftpmaster.internal/ubuntu jammy/main amd64 dwz amd64 0.14-1build1 [104 kB] Get:46 http://ftpmaster.internal/ubuntu jammy/main amd64 gettext amd64 0.21-4ubuntu3 [824 kB] Get:47 http://ftpmaster.internal/ubuntu jammy/main amd64 intltool-debian all 0.35.0+20060710.5 [24.9 kB] Get:48 http://ftpmaster.internal/ubuntu jammy/main amd64 po-debconf all 1.0.21+nmu1 [233 kB] Get:49 http://ftpmaster.internal/ubuntu jammy/main amd64 debhelper all 13.5.2ubuntu1 [926 kB] Get:50 http://ftpmaster.internal/ubuntu jammy-proposed/main amd64 python3-lib2to3 all 3.9.9-3 [77.7 kB] Get:51 http://ftpmaster.internal/ubuntu jammy-proposed/main amd64 python3-distutils all 3.9.9-3 [144 kB] Get:52 http://ftpmaster.internal/ubuntu jammy/universe amd64 dh-python all 5.20211114 [99.8 kB] Get:53 http://ftpmaster.internal/ubuntu jammy/main amd64 libpython3.10-stdlib amd64 3.10.1-1 [1824 kB] Get:54 http://ftpmaster.internal/ubuntu jammy/main amd64 python3.10 amd64 3.10.1-1 [480 kB] Get:55 http://ftpmaster.internal/ubuntu jammy-proposed/main amd64 python3-all amd64 3.9.7-4 [912 B] Get:56 http://ftpmaster.internal/ubuntu jammy/main amd64 python3-idna all 2.10-1 [35.2 kB] Get:57 http://ftpmaster.internal/ubuntu jammy/universe amd64 python3-sniffio all 1.2.0-1 [6438 B] Get:58 http://ftpmaster.internal/ubuntu jammy/universe amd64 python3-anyio all 2.0.2-2 [38.5 kB] Get:59 http://ftpmaster.internal/ubuntu jammy/main amd64 python3-attr all 20.3.0-1ubuntu1 [41.0 kB] Get:60 http://ftpmaster.internal/ubuntu jammy/main amd64 python3-certifi all 2020.6.20-1 [150 kB] Get:61 http://ftpmaster.internal/ubuntu jammy/main amd64 python3-chardet all 4.0.0-1 [98.0 kB] Get:62 http://ftpmaster.internal/ubuntu jammy/main amd64 python3-colorama all 0.4.4-1 [24.5 kB] Get:63 http://ftpmaster.internal/ubuntu jammy-proposed/main amd64 python3-click all 8.0.2-1 [78.3 kB] Get:64 http://ftpmaster.internal/ubuntu jammy/universe amd64 python3-typing-extensions all 3.10.0.2-1 [35.7 kB] Get:65 http://ftpmaster.internal/ubuntu jammy/universe amd64 python3-pydantic all 1.8.2-1 [121 kB] Get:66 http://ftpmaster.internal/ubuntu jammy/universe amd64 python3-starlette all 0.16.0-1 [44.3 kB] Get:67 http://ftpmaster.internal/ubuntu jammy/universe amd64 python3-h11 all 0.12.0-2 [49.0 kB] Get:68 http://ftpmaster.internal/ubuntu jammy/universe amd64 python3-wsproto all 1.0.0-1 [23.7 kB] Get:69 http://ftpmaster.internal/ubuntu jammy/universe amd64 python3-uvicorn all 0.13.3-1 [29.5 kB] Get:70 http://ftpmaster.internal/ubuntu jammy/universe amd64 python3-fastapi all 0.63.0-2 [36.2 kB] Get:71 http://ftpmaster.internal/ubuntu jammy/main amd64 python3-more-itertools all 8.10.0-2 [47.9 kB] Get:72 http://ftpmaster.internal/ubuntu jammy/main amd64 python3-zipp all 1.0.0-3 [5440 B] Get:73 http://ftpmaster.internal/ubuntu jammy/main amd64 python3-importlib-metadata all 4.6.4-1 [16.2 kB] Get:74 http://ftpmaster.internal/ubuntu jammy/universe amd64 python3-iniconfig all 1.1.1-1 [5960 B] Get:75 http://ftpmaster.internal/ubuntu jammy/main amd64 python3-pyparsing all 2.4.7-1 [61.4 kB] Get:76 http://ftpmaster.internal/ubuntu jammy-proposed/main amd64 python3-packaging all 21.3-1 [30.7 kB] Get:77 http://ftpmaster.internal/ubuntu jammy/universe amd64 python3-pluggy all 0.13.0-7.1 [19.0 kB] Get:78 http://ftpmaster.internal/ubuntu jammy/universe amd64 python3-py all 1.10.0-1 [71.9 kB] Get:79 http://ftpmaster.internal/ubuntu jammy/universe amd64 python3-toml all 0.10.2-1 [16.5 kB] Get:80 http://ftpmaster.internal/ubuntu jammy/universe amd64 python3-pytest all 6.2.5-1ubuntu1 [214 kB] Get:81 http://ftpmaster.internal/ubuntu jammy/main amd64 python3-six all 1.16.0-2 [12.6 kB] Get:82 http://ftpmaster.internal/ubuntu jammy/main amd64 python3-urllib3 all 1.26.5-1~exp1 [96.4 kB] Get:83 http://ftpmaster.internal/ubuntu jammy/main amd64 python3-requests all 2.25.1+dfsg-2 [47.9 kB] Get:84 http://ftpmaster.internal/ubuntu jammy/main amd64 python3-greenlet amd64 1.1.2-3 [68.0 kB] Get:85 http://ftpmaster.internal/ubuntu jammy-proposed/main amd64 python3-sqlalchemy all 1.4.23+ds1-5 [974 kB] debconf: delaying package configuration, since apt-utils is not installed Fetched 31.7 MB in 1s (45.2 MB/s) Selecting previously unselected package libpython3.9-minimal:amd64. (Reading database ... 13453 files and directories currently installed.) Preparing to unpack .../libpython3.9-minimal_3.9.9-1build1_amd64.deb ... Unpacking libpython3.9-minimal:amd64 (3.9.9-1build1) ... Selecting previously unselected package libexpat1:amd64. Preparing to unpack .../libexpat1_2.4.1-3_amd64.deb ... Unpacking libexpat1:amd64 (2.4.1-3) ... Selecting previously unselected package python3.9-minimal. Preparing to unpack .../python3.9-minimal_3.9.9-1build1_amd64.deb ... Unpacking python3.9-minimal (3.9.9-1build1) ... Setting up libpython3.9-minimal:amd64 (3.9.9-1build1) ... Setting up libexpat1:amd64 (2.4.1-3) ... Setting up python3.9-minimal (3.9.9-1build1) ... Selecting previously unselected package python3-minimal. (Reading database ... 13746 files and directories currently installed.) Preparing to unpack .../0-python3-minimal_3.9.7-4_amd64.deb ... Unpacking python3-minimal (3.9.7-4) ... Selecting previously unselected package media-types. Preparing to unpack .../1-media-types_4.0.0_all.deb ... Unpacking media-types (4.0.0) ... Selecting previously unselected package libmpdec3:amd64. Preparing to unpack .../2-libmpdec3_2.5.1-2build1_amd64.deb ... Unpacking libmpdec3:amd64 (2.5.1-2build1) ... Selecting previously unselected package libpython3.9-stdlib:amd64. Preparing to unpack .../3-libpython3.9-stdlib_3.9.9-1build1_amd64.deb ... Unpacking libpython3.9-stdlib:amd64 (3.9.9-1build1) ... Selecting previously unselected package python3.9. Preparing to unpack .../4-python3.9_3.9.9-1build1_amd64.deb ... Unpacking python3.9 (3.9.9-1build1) ... Selecting previously unselected package libpython3-stdlib:amd64. Preparing to unpack .../5-libpython3-stdlib_3.9.7-4_amd64.deb ... Unpacking libpython3-stdlib:amd64 (3.9.7-4) ... Setting up python3-minimal (3.9.7-4) ... Selecting previously unselected package python3. (Reading database ... 14143 files and directories currently installed.) Preparing to unpack .../00-python3_3.9.7-4_amd64.deb ... Unpacking python3 (3.9.7-4) ... Selecting previously unselected package bsdextrautils. Preparing to unpack .../01-bsdextrautils_2.37.2-4ubuntu1_amd64.deb ... Unpacking bsdextrautils (2.37.2-4ubuntu1) ... Selecting previously unselected package libuchardet0:amd64. Preparing to unpack .../02-libuchardet0_0.0.7-1build1_amd64.deb ... Unpacking libuchardet0:amd64 (0.0.7-1build1) ... Selecting previously unselected package groff-base. Preparing to unpack .../03-groff-base_1.22.4-7_amd64.deb ... Unpacking groff-base (1.22.4-7) ... Selecting previously unselected package libpipeline1:amd64. Preparing to unpack .../04-libpipeline1_1.5.4-1_amd64.deb ... Unpacking libpipeline1:amd64 (1.5.4-1) ... Selecting previously unselected package man-db. Preparing to unpack .../05-man-db_2.9.4-2build1_amd64.deb ... Unpacking man-db (2.9.4-2build1) ... Selecting previously unselected package libpython3.10-minimal:amd64. Preparing to unpack .../06-libpython3.10-minimal_3.10.1-1_amd64.deb ... Unpacking libpython3.10-minimal:amd64 (3.10.1-1) ... Selecting previously unselected package python3.10-minimal. Preparing to unpack .../07-python3.10-minimal_3.10.1-1_amd64.deb ... Unpacking python3.10-minimal (3.10.1-1) ... Selecting previously unselected package libmd0:amd64. Preparing to unpack .../08-libmd0_1.0.4-1_amd64.deb ... Unpacking libmd0:amd64 (1.0.4-1) ... Selecting previously unselected package libbsd0:amd64. Preparing to unpack .../09-libbsd0_0.11.3-1ubuntu3_amd64.deb ... Unpacking libbsd0:amd64 (0.11.3-1ubuntu3) ... Selecting previously unselected package libelf1:amd64. Preparing to unpack .../10-libelf1_0.186-1_amd64.deb ... Unpacking libelf1:amd64 (0.186-1) ... Selecting previously unselected package libicu67:amd64. Preparing to unpack .../11-libicu67_67.1-7ubuntu1_amd64.deb ... Unpacking libicu67:amd64 (67.1-7ubuntu1) ... Selecting previously unselected package libxml2:amd64. Preparing to unpack .../12-libxml2_2.9.12+dfsg-5_amd64.deb ... Unpacking libxml2:amd64 (2.9.12+dfsg-5) ... Selecting previously unselected package python3-pkg-resources. Preparing to unpack .../13-python3-pkg-resources_59.4.0-1_all.deb ... Unpacking python3-pkg-resources (59.4.0-1) ... Selecting previously unselected package libmagic-mgc. Preparing to unpack .../14-libmagic-mgc_1%3a5.41-2_amd64.deb ... Unpacking libmagic-mgc (1:5.41-2) ... Selecting previously unselected package libmagic1:amd64. Preparing to unpack .../15-libmagic1_1%3a5.41-2_amd64.deb ... Unpacking libmagic1:amd64 (1:5.41-2) ... Selecting previously unselected package file. Preparing to unpack .../16-file_1%3a5.41-2_amd64.deb ... Unpacking file (1:5.41-2) ... Selecting previously unselected package gettext-base. Preparing to unpack .../17-gettext-base_0.21-4ubuntu3_amd64.deb ... Unpacking gettext-base (0.21-4ubuntu3) ... Selecting previously unselected package libedit2:amd64. Preparing to unpack .../18-libedit2_3.1-20210910-1_amd64.deb ... Unpacking libedit2:amd64 (3.1-20210910-1) ... Selecting previously unselected package libsigsegv2:amd64. Preparing to unpack .../19-libsigsegv2_2.13-1ubuntu2_amd64.deb ... Unpacking libsigsegv2:amd64 (2.13-1ubuntu2) ... Selecting previously unselected package m4. Preparing to unpack .../20-m4_1.4.18-5ubuntu1_amd64.deb ... Unpacking m4 (1.4.18-5ubuntu1) ... Selecting previously unselected package autoconf. Preparing to unpack .../21-autoconf_2.71-2_all.deb ... Unpacking autoconf (2.71-2) ... Selecting previously unselected package autotools-dev. Preparing to unpack .../22-autotools-dev_20180224.1+nmu1_all.deb ... Unpacking autotools-dev (20180224.1+nmu1) ... Selecting previously unselected package automake. Preparing to unpack .../23-automake_1%3a1.16.5-1.1_all.deb ... Unpacking automake (1:1.16.5-1.1) ... Selecting previously unselected package autopoint. Preparing to unpack .../24-autopoint_0.21-4ubuntu3_all.deb ... Unpacking autopoint (0.21-4ubuntu3) ... Selecting previously unselected package libdebhelper-perl. Preparing to unpack .../25-libdebhelper-perl_13.5.2ubuntu1_all.deb ... Unpacking libdebhelper-perl (13.5.2ubuntu1) ... Selecting previously unselected package libtool. Preparing to unpack .../26-libtool_2.4.6-15build1_all.deb ... Unpacking libtool (2.4.6-15build1) ... Selecting previously unselected package dh-autoreconf. Preparing to unpack .../27-dh-autoreconf_20_all.deb ... Unpacking dh-autoreconf (20) ... Selecting previously unselected package libarchive-zip-perl. Preparing to unpack .../28-libarchive-zip-perl_1.68-1_all.deb ... Unpacking libarchive-zip-perl (1.68-1) ... Selecting previously unselected package libsub-override-perl. Preparing to unpack .../29-libsub-override-perl_0.09-2_all.deb ... Unpacking libsub-override-perl (0.09-2) ... Selecting previously unselected package libfile-stripnondeterminism-perl. Preparing to unpack .../30-libfile-stripnondeterminism-perl_1.12.1-1_all.deb ... Unpacking libfile-stripnondeterminism-perl (1.12.1-1) ... Selecting previously unselected package dh-strip-nondeterminism. Preparing to unpack .../31-dh-strip-nondeterminism_1.12.1-1_all.deb ... Unpacking dh-strip-nondeterminism (1.12.1-1) ... Selecting previously unselected package libdw1:amd64. Preparing to unpack .../32-libdw1_0.186-1_amd64.deb ... Unpacking libdw1:amd64 (0.186-1) ... Selecting previously unselected package debugedit. Preparing to unpack .../33-debugedit_1%3a5.0-3_amd64.deb ... Unpacking debugedit (1:5.0-3) ... Selecting previously unselected package dwz. Preparing to unpack .../34-dwz_0.14-1build1_amd64.deb ... Unpacking dwz (0.14-1build1) ... Selecting previously unselected package gettext. Preparing to unpack .../35-gettext_0.21-4ubuntu3_amd64.deb ... Unpacking gettext (0.21-4ubuntu3) ... Selecting previously unselected package intltool-debian. Preparing to unpack .../36-intltool-debian_0.35.0+20060710.5_all.deb ... Unpacking intltool-debian (0.35.0+20060710.5) ... Selecting previously unselected package po-debconf. Preparing to unpack .../37-po-debconf_1.0.21+nmu1_all.deb ... Unpacking po-debconf (1.0.21+nmu1) ... Selecting previously unselected package debhelper. Preparing to unpack .../38-debhelper_13.5.2ubuntu1_all.deb ... Unpacking debhelper (13.5.2ubuntu1) ... Selecting previously unselected package python3-lib2to3. Preparing to unpack .../39-python3-lib2to3_3.9.9-3_all.deb ... Unpacking python3-lib2to3 (3.9.9-3) ... Selecting previously unselected package python3-distutils. Preparing to unpack .../40-python3-distutils_3.9.9-3_all.deb ... Unpacking python3-distutils (3.9.9-3) ... Selecting previously unselected package dh-python. Preparing to unpack .../41-dh-python_5.20211114_all.deb ... Unpacking dh-python (5.20211114) ... Selecting previously unselected package libpython3.10-stdlib:amd64. Preparing to unpack .../42-libpython3.10-stdlib_3.10.1-1_amd64.deb ... Unpacking libpython3.10-stdlib:amd64 (3.10.1-1) ... Selecting previously unselected package python3.10. Preparing to unpack .../43-python3.10_3.10.1-1_amd64.deb ... Unpacking python3.10 (3.10.1-1) ... Selecting previously unselected package python3-all. Preparing to unpack .../44-python3-all_3.9.7-4_amd64.deb ... Unpacking python3-all (3.9.7-4) ... Selecting previously unselected package python3-idna. Preparing to unpack .../45-python3-idna_2.10-1_all.deb ... Unpacking python3-idna (2.10-1) ... Selecting previously unselected package python3-sniffio. Preparing to unpack .../46-python3-sniffio_1.2.0-1_all.deb ... Unpacking python3-sniffio (1.2.0-1) ... Selecting previously unselected package python3-anyio. Preparing to unpack .../47-python3-anyio_2.0.2-2_all.deb ... Unpacking python3-anyio (2.0.2-2) ... Selecting previously unselected package python3-attr. Preparing to unpack .../48-python3-attr_20.3.0-1ubuntu1_all.deb ... Unpacking python3-attr (20.3.0-1ubuntu1) ... Selecting previously unselected package python3-certifi. Preparing to unpack .../49-python3-certifi_2020.6.20-1_all.deb ... Unpacking python3-certifi (2020.6.20-1) ... Selecting previously unselected package python3-chardet. Preparing to unpack .../50-python3-chardet_4.0.0-1_all.deb ... Unpacking python3-chardet (4.0.0-1) ... Selecting previously unselected package python3-colorama. Preparing to unpack .../51-python3-colorama_0.4.4-1_all.deb ... Unpacking python3-colorama (0.4.4-1) ... Selecting previously unselected package python3-click. Preparing to unpack .../52-python3-click_8.0.2-1_all.deb ... Unpacking python3-click (8.0.2-1) ... Selecting previously unselected package python3-typing-extensions. Preparing to unpack .../53-python3-typing-extensions_3.10.0.2-1_all.deb ... Unpacking python3-typing-extensions (3.10.0.2-1) ... Selecting previously unselected package python3-pydantic. Preparing to unpack .../54-python3-pydantic_1.8.2-1_all.deb ... Unpacking python3-pydantic (1.8.2-1) ... Selecting previously unselected package python3-starlette. Preparing to unpack .../55-python3-starlette_0.16.0-1_all.deb ... Unpacking python3-starlette (0.16.0-1) ... Selecting previously unselected package python3-h11. Preparing to unpack .../56-python3-h11_0.12.0-2_all.deb ... Unpacking python3-h11 (0.12.0-2) ... Selecting previously unselected package python3-wsproto. Preparing to unpack .../57-python3-wsproto_1.0.0-1_all.deb ... Unpacking python3-wsproto (1.0.0-1) ... Selecting previously unselected package python3-uvicorn. Preparing to unpack .../58-python3-uvicorn_0.13.3-1_all.deb ... Unpacking python3-uvicorn (0.13.3-1) ... Selecting previously unselected package python3-fastapi. Preparing to unpack .../59-python3-fastapi_0.63.0-2_all.deb ... Unpacking python3-fastapi (0.63.0-2) ... Selecting previously unselected package python3-more-itertools. Preparing to unpack .../60-python3-more-itertools_8.10.0-2_all.deb ... Unpacking python3-more-itertools (8.10.0-2) ... Selecting previously unselected package python3-zipp. Preparing to unpack .../61-python3-zipp_1.0.0-3_all.deb ... Unpacking python3-zipp (1.0.0-3) ... Selecting previously unselected package python3-importlib-metadata. Preparing to unpack .../62-python3-importlib-metadata_4.6.4-1_all.deb ... Unpacking python3-importlib-metadata (4.6.4-1) ... Selecting previously unselected package python3-iniconfig. Preparing to unpack .../63-python3-iniconfig_1.1.1-1_all.deb ... Unpacking python3-iniconfig (1.1.1-1) ... Selecting previously unselected package python3-pyparsing. Preparing to unpack .../64-python3-pyparsing_2.4.7-1_all.deb ... Unpacking python3-pyparsing (2.4.7-1) ... Selecting previously unselected package python3-packaging. Preparing to unpack .../65-python3-packaging_21.3-1_all.deb ... Unpacking python3-packaging (21.3-1) ... Selecting previously unselected package python3-pluggy. Preparing to unpack .../66-python3-pluggy_0.13.0-7.1_all.deb ... Unpacking python3-pluggy (0.13.0-7.1) ... Selecting previously unselected package python3-py. Preparing to unpack .../67-python3-py_1.10.0-1_all.deb ... Unpacking python3-py (1.10.0-1) ... Selecting previously unselected package python3-toml. Preparing to unpack .../68-python3-toml_0.10.2-1_all.deb ... Unpacking python3-toml (0.10.2-1) ... Selecting previously unselected package python3-pytest. Preparing to unpack .../69-python3-pytest_6.2.5-1ubuntu1_all.deb ... Unpacking python3-pytest (6.2.5-1ubuntu1) ... Selecting previously unselected package python3-six. Preparing to unpack .../70-python3-six_1.16.0-2_all.deb ... Unpacking python3-six (1.16.0-2) ... Selecting previously unselected package python3-urllib3. Preparing to unpack .../71-python3-urllib3_1.26.5-1~exp1_all.deb ... Unpacking python3-urllib3 (1.26.5-1~exp1) ... Selecting previously unselected package python3-requests. Preparing to unpack .../72-python3-requests_2.25.1+dfsg-2_all.deb ... Unpacking python3-requests (2.25.1+dfsg-2) ... Selecting previously unselected package python3-greenlet. Preparing to unpack .../73-python3-greenlet_1.1.2-3_amd64.deb ... Unpacking python3-greenlet (1.1.2-3) ... Selecting previously unselected package python3-sqlalchemy. Preparing to unpack .../74-python3-sqlalchemy_1.4.23+ds1-5_all.deb ... Unpacking python3-sqlalchemy (1.4.23+ds1-5) ... Selecting previously unselected package sbuild-build-depends-sqlmodel-dummy. Preparing to unpack .../75-sbuild-build-depends-sqlmodel-dummy_0.invalid.0_amd64.deb ... Unpacking sbuild-build-depends-sqlmodel-dummy (0.invalid.0) ... Setting up media-types (4.0.0) ... Setting up libpipeline1:amd64 (1.5.4-1) ... Setting up bsdextrautils (2.37.2-4ubuntu1) ... update-alternatives: using /usr/bin/write.ul to provide /usr/bin/write (write) in auto mode Setting up libicu67:amd64 (67.1-7ubuntu1) ... Setting up libmagic-mgc (1:5.41-2) ... Setting up libarchive-zip-perl (1.68-1) ... Setting up libdebhelper-perl (13.5.2ubuntu1) ... Setting up libmagic1:amd64 (1:5.41-2) ... Setting up gettext-base (0.21-4ubuntu3) ... Setting up file (1:5.41-2) ... Setting up autotools-dev (20180224.1+nmu1) ... Setting up libsigsegv2:amd64 (2.13-1ubuntu2) ... Setting up libpython3.10-minimal:amd64 (3.10.1-1) ... Setting up autopoint (0.21-4ubuntu3) ... Setting up libmd0:amd64 (1.0.4-1) ... Setting up libuchardet0:amd64 (0.0.7-1build1) ... Setting up libmpdec3:amd64 (2.5.1-2build1) ... Setting up libsub-override-perl (0.09-2) ... Setting up libbsd0:amd64 (0.11.3-1ubuntu3) ... Setting up libelf1:amd64 (0.186-1) ... Setting up libxml2:amd64 (2.9.12+dfsg-5) ... Setting up libpython3.9-stdlib:amd64 (3.9.9-1build1) ... Setting up libpython3-stdlib:amd64 (3.9.7-4) ... Setting up libfile-stripnondeterminism-perl (1.12.1-1) ... Setting up libdw1:amd64 (0.186-1) ... Setting up gettext (0.21-4ubuntu3) ... Setting up libtool (2.4.6-15build1) ... Setting up libedit2:amd64 (3.1-20210910-1) ... Setting up m4 (1.4.18-5ubuntu1) ... Setting up python3.10-minimal (3.10.1-1) ... Setting up intltool-debian (0.35.0+20060710.5) ... Setting up libpython3.10-stdlib:amd64 (3.10.1-1) ... Setting up autoconf (2.71-2) ... Setting up dh-strip-nondeterminism (1.12.1-1) ... Setting up dwz (0.14-1build1) ... Setting up groff-base (1.22.4-7) ... Setting up debugedit (1:5.0-3) ... Setting up python3.9 (3.9.9-1build1) ... Setting up automake (1:1.16.5-1.1) ... update-alternatives: using /usr/bin/automake-1.16 to provide /usr/bin/automake (automake) in auto mode Setting up python3.10 (3.10.1-1) ... Setting up po-debconf (1.0.21+nmu1) ... Setting up python3 (3.9.7-4) ... Setting up man-db (2.9.4-2build1) ... Not building database; man-db/auto-update is not 'true'. Created symlink /etc/systemd/system/timers.target.wants/man-db.timer → /lib/systemd/system/man-db.timer. Setting up python3-six (1.16.0-2) ... Setting up dh-autoreconf (20) ... Setting up python3-pyparsing (2.4.7-1) ... Setting up python3-certifi (2020.6.20-1) ... Setting up python3-greenlet (1.1.2-3) ... Setting up python3-idna (2.10-1) ... Setting up python3-h11 (0.12.0-2) ... Setting up python3-typing-extensions (3.10.0.2-1) ... Setting up python3-toml (0.10.2-1) ... Setting up python3-urllib3 (1.26.5-1~exp1) ... Setting up python3-lib2to3 (3.9.9-3) ... Setting up python3-pkg-resources (59.4.0-1) ... Setting up python3-distutils (3.9.9-3) ... Setting up dh-python (5.20211114) ... Setting up python3-more-itertools (8.10.0-2) ... Setting up python3-iniconfig (1.1.1-1) ... Setting up python3-sniffio (1.2.0-1) ... Setting up python3-attr (20.3.0-1ubuntu1) ... Setting up python3-wsproto (1.0.0-1) ... Setting up python3-py (1.10.0-1) ... Setting up python3-anyio (2.0.2-2) ... Setting up python3-colorama (0.4.4-1) ... Setting up python3-all (3.9.7-4) ... Setting up debhelper (13.5.2ubuntu1) ... Setting up python3-starlette (0.16.0-1) ... Setting up python3-zipp (1.0.0-3) ... Setting up python3-click (8.0.2-1) ... Setting up python3-sqlalchemy (1.4.23+ds1-5) ... Setting up python3-packaging (21.3-1) ... Setting up python3-chardet (4.0.0-1) ... Setting up python3-pydantic (1.8.2-1) ... Setting up python3-requests (2.25.1+dfsg-2) ... Setting up python3-importlib-metadata (4.6.4-1) ... Setting up python3-uvicorn (0.13.3-1) ... Setting up python3-pluggy (0.13.0-7.1) ... Setting up python3-fastapi (0.63.0-2) ... Setting up python3-pytest (6.2.5-1ubuntu1) ... Setting up sbuild-build-depends-sqlmodel-dummy (0.invalid.0) ... Processing triggers for libc-bin (2.34-0ubuntu3) ... +------------------------------------------------------------------------------+ | Build environment | +------------------------------------------------------------------------------+ Kernel: Linux 4.15.0-163-generic amd64 (x86_64) Toolchain package versions: binutils_2.37-10ubuntu1 dpkg-dev_1.20.9ubuntu3 g++-11_11.2.0-12ubuntu1 gcc-11_11.2.0-12ubuntu1 libc6-dev_2.34-0ubuntu3 libstdc++-11-dev_11.2.0-12ubuntu1 libstdc++6_11.2.0-12ubuntu1 linux-libc-dev_5.15.0-13.13 Package versions: adduser_3.118ubuntu5 advancecomp_2.1-2.1ubuntu1 apt_2.3.13 autoconf_2.71-2 automake_1:1.16.5-1.1 autopoint_0.21-4ubuntu3 autotools-dev_20180224.1+nmu1 base-files_12ubuntu2 base-passwd_3.5.52 bash_5.1-5ubuntu1 binutils_2.37-10ubuntu1 binutils-common_2.37-10ubuntu1 binutils-x86-64-linux-gnu_2.37-10ubuntu1 bsdextrautils_2.37.2-4ubuntu1 bsdutils_1:2.37.2-4ubuntu1 build-essential_12.9ubuntu2 bzip2_1.0.8-5 ca-certificates_20211016 coreutils_8.32-4ubuntu3 cpp_4:11.2.0-1ubuntu1 cpp-11_11.2.0-12ubuntu1 dash_0.5.11+git20210903+057cd650a4ed-3 debconf_1.5.79 debhelper_13.5.2ubuntu1 debianutils_5.5-1ubuntu1 debugedit_1:5.0-3 dh-autoreconf_20 dh-python_5.20211114 dh-strip-nondeterminism_1.12.1-1 diffutils_1:3.8-0ubuntu1 dpkg_1.20.9ubuntu3 dpkg-dev_1.20.9ubuntu3 dwz_0.14-1build1 e2fsprogs_1.46.4-1ubuntu1 fakeroot_1.25.3-1.1ubuntu3 file_1:5.41-2 findutils_4.8.0-1ubuntu2 g++_4:11.2.0-1ubuntu1 g++-11_11.2.0-12ubuntu1 gcc_4:11.2.0-1ubuntu1 gcc-11_11.2.0-12ubuntu1 gcc-11-base_11.2.0-12ubuntu1 gettext_0.21-4ubuntu3 gettext-base_0.21-4ubuntu3 gpg_2.2.27-2ubuntu1 gpg-agent_2.2.27-2ubuntu1 gpgconf_2.2.27-2ubuntu1 gpgv_2.2.27-2ubuntu1 grep_3.7-1 groff-base_1.22.4-7 gzip_1.10-4ubuntu2 hostname_3.23ubuntu1 init_1.61 init-system-helpers_1.61 intltool-debian_0.35.0+20060710.5 libacl1_2.2.53-10ubuntu2 libapparmor1_3.0.3-0ubuntu5 libapt-pkg6.0_2.3.13 libarchive-zip-perl_1.68-1 libargon2-1_0~20171227-0.2build22 libasan6_11.2.0-12ubuntu1 libassuan0_2.5.5-1 libatomic1_11.2.0-12ubuntu1 libattr1_1:2.5.1-1 libaudit-common_1:3.0-2ubuntu3 libaudit1_1:3.0-2ubuntu3 libbinutils_2.37-10ubuntu1 libblkid1_2.37.2-4ubuntu1 libbsd0_0.11.3-1ubuntu3 libbz2-1.0_1.0.8-5 libc-bin_2.34-0ubuntu3 libc-dev-bin_2.34-0ubuntu3 libc6_2.34-0ubuntu3 libc6-dev_2.34-0ubuntu3 libcap-ng0_0.7.9-2.2build2 libcap2_1:2.44-1build2 libcc1-0_11.2.0-12ubuntu1 libcom-err2_1.46.4-1ubuntu1 libcrypt-dev_1:4.4.26-1 libcrypt1_1:4.4.26-1 libcryptsetup12_2:2.4.2-1ubuntu4 libctf-nobfd0_2.37-10ubuntu1 libctf0_2.37-10ubuntu1 libdb5.3_5.3.28+dfsg1-0.8ubuntu2 libdebconfclient0_0.256ubuntu4 libdebhelper-perl_13.5.2ubuntu1 libdevmapper1.02.1_2:1.02.175-2.1ubuntu3 libdpkg-perl_1.20.9ubuntu3 libdw1_0.186-1 libedit2_3.1-20210910-1 libelf1_0.186-1 libexpat1_2.4.1-3 libext2fs2_1.46.4-1ubuntu1 libfakeroot_1.25.3-1.1ubuntu3 libffi8_3.4.2-1ubuntu5 libfile-stripnondeterminism-perl_1.12.1-1 libgcc-11-dev_11.2.0-12ubuntu1 libgcc-s1_11.2.0-12ubuntu1 libgcrypt20_1.9.4-3ubuntu2 libgdbm-compat4_1.22-1 libgdbm6_1.22-1 libgmp10_2:6.2.1+dfsg-1ubuntu3 libgnutls30_3.7.2-2ubuntu1 libgomp1_11.2.0-12ubuntu1 libgpg-error0_1.42-3 libgssapi-krb5-2_1.19.2-0ubuntu1 libhogweed6_3.7.3-1build1 libicu67_67.1-7ubuntu1 libidn2-0_2.3.2-2 libip4tc2_1.8.7-1ubuntu4 libisl23_0.24-2 libitm1_11.2.0-12ubuntu1 libjson-c5_0.15-2build3 libk5crypto3_1.19.2-0ubuntu1 libkeyutils1_1.6.1-2ubuntu2 libkmod2_28-1ubuntu5 libkrb5-3_1.19.2-0ubuntu1 libkrb5support0_1.19.2-0ubuntu1 liblockfile-bin_1.17-1build1 liblockfile1_1.17-1build1 liblsan0_11.2.0-12ubuntu1 liblz4-1_1.9.3-2build1 liblzma5_5.2.5-2build1 libmagic-mgc_1:5.41-2 libmagic1_1:5.41-2 libmd0_1.0.4-1 libmount1_2.37.2-4ubuntu1 libmpc3_1.2.1-1 libmpdec3_2.5.1-2build1 libmpfr6_4.1.0-3build2 libncurses6_6.3-1 libncursesw6_6.3-1 libnettle8_3.7.3-1build1 libnpth0_1.6-3build1 libnsl-dev_1.3.0-2build1 libnsl2_1.3.0-2build1 libp11-kit0_0.24.0-6 libpam-modules_1.4.0-10ubuntu2 libpam-modules-bin_1.4.0-10ubuntu2 libpam-runtime_1.4.0-10ubuntu2 libpam0g_1.4.0-10ubuntu2 libpcre2-8-0_10.39-3 libpcre3_2:8.39-13build4 libperl5.32_5.32.1-3ubuntu3 libpipeline1_1.5.4-1 libpng16-16_1.6.37-3build4 libprocps8_2:3.3.17-5ubuntu3 libpython3-stdlib_3.9.7-4 libpython3.10-minimal_3.10.1-1 libpython3.10-stdlib_3.10.1-1 libpython3.9-minimal_3.9.9-1build1 libpython3.9-stdlib_3.9.9-1build1 libquadmath0_11.2.0-12ubuntu1 libreadline8_8.1-2build1 libseccomp2_2.5.2-2ubuntu2 libselinux1_3.3-1build1 libsemanage-common_3.3-1build1 libsemanage2_3.3-1build1 libsepol1_3.1-1ubuntu2 libsepol2_3.3-1 libsigsegv2_2.13-1ubuntu2 libsmartcols1_2.37.2-4ubuntu1 libsqlite3-0_3.36.0-2 libss2_1.46.4-1ubuntu1 libssl1.1_1.1.1l-1ubuntu1 libssl3_3.0.0-1ubuntu2 libstdc++-11-dev_11.2.0-12ubuntu1 libstdc++6_11.2.0-12ubuntu1 libsub-override-perl_0.09-2 libsystemd0_249.5-2ubuntu2 libtasn1-6_4.18.0-4 libtinfo6_6.3-1 libtirpc-common_1.3.2-2 libtirpc-dev_1.3.2-2 libtirpc3_1.3.2-2 libtool_2.4.6-15build1 libtsan0_11.2.0-12ubuntu1 libubsan1_11.2.0-12ubuntu1 libuchardet0_0.0.7-1build1 libudev1_249.5-2ubuntu2 libunistring2_0.9.10-6 libuuid1_2.37.2-4ubuntu1 libxml2_2.9.12+dfsg-5 libxxhash0_0.8.0-2build1 libzstd1_1.4.8+dfsg-3 linux-libc-dev_5.15.0-13.13 lockfile-progs_0.1.19 login_1:4.8.1-2ubuntu1 logsave_1.46.4-1ubuntu1 lsb-base_11.1.0ubuntu3 lto-disabled-list_17 m4_1.4.18-5ubuntu1 make_4.3-4ubuntu2 man-db_2.9.4-2build1 mawk_1.3.4.20200120-2build1 media-types_4.0.0 mount_2.37.2-4ubuntu1 ncurses-base_6.3-1 ncurses-bin_6.3-1 openssl_3.0.0-1ubuntu2 optipng_0.7.7-2 passwd_1:4.8.1-2ubuntu1 patch_2.7.6-7build1 perl_5.32.1-3ubuntu3 perl-base_5.32.1-3ubuntu3 perl-modules-5.32_5.32.1-3ubuntu3 pinentry-curses_1.1.1-1build1 pkgbinarymangler_149 po-debconf_1.0.21+nmu1 policyrcd-script-zg2_0.1-3 procps_2:3.3.17-5ubuntu3 python3_3.9.7-4 python3-all_3.9.7-4 python3-anyio_2.0.2-2 python3-attr_20.3.0-1ubuntu1 python3-certifi_2020.6.20-1 python3-chardet_4.0.0-1 python3-click_8.0.2-1 python3-colorama_0.4.4-1 python3-distutils_3.9.9-3 python3-fastapi_0.63.0-2 python3-greenlet_1.1.2-3 python3-h11_0.12.0-2 python3-idna_2.10-1 python3-importlib-metadata_4.6.4-1 python3-iniconfig_1.1.1-1 python3-lib2to3_3.9.9-3 python3-minimal_3.9.7-4 python3-more-itertools_8.10.0-2 python3-packaging_21.3-1 python3-pkg-resources_59.4.0-1 python3-pluggy_0.13.0-7.1 python3-py_1.10.0-1 python3-pydantic_1.8.2-1 python3-pyparsing_2.4.7-1 python3-pytest_6.2.5-1ubuntu1 python3-requests_2.25.1+dfsg-2 python3-six_1.16.0-2 python3-sniffio_1.2.0-1 python3-sqlalchemy_1.4.23+ds1-5 python3-starlette_0.16.0-1 python3-toml_0.10.2-1 python3-typing-extensions_3.10.0.2-1 python3-urllib3_1.26.5-1~exp1 python3-uvicorn_0.13.3-1 python3-wsproto_1.0.0-1 python3-zipp_1.0.0-3 python3.10_3.10.1-1 python3.10-minimal_3.10.1-1 python3.9_3.9.9-1build1 python3.9-minimal_3.9.9-1build1 readline-common_8.1-2build1 rpcsvc-proto_1.4.2-0ubuntu5 sbuild-build-depends-core-dummy_0.invalid.0 sbuild-build-depends-sqlmodel-dummy_0.invalid.0 sed_4.8-1 sensible-utils_0.0.17 systemd_249.5-2ubuntu2 systemd-sysv_249.5-2ubuntu2 systemd-timesyncd_249.5-2ubuntu2 sysvinit-utils_2.96-7ubuntu2 tar_1.34+dfsg-1build2 tzdata_2021e-1ubuntu1 ubuntu-keyring_2021.03.26 usrmerge_25ubuntu2 util-linux_2.37.2-4ubuntu1 xz-utils_5.2.5-2build1 zlib1g_1:1.2.11.dfsg-2ubuntu7 +------------------------------------------------------------------------------+ | Build | +------------------------------------------------------------------------------+ Unpack source ------------- gpgv: Signature made Mon Dec 6 05:14:07 2021 UTC gpgv: using RSA key B9FAD3192AF3E4A5309D9D39879F3C993801A94F gpgv: Can't check signature: No public key dpkg-source: warning: failed to verify signature on ./sqlmodel_0.0.4-2.dsc dpkg-source: info: extracting sqlmodel in /<> dpkg-source: info: unpacking sqlmodel_0.0.4.orig.tar.gz dpkg-source: info: unpacking sqlmodel_0.0.4-2.debian.tar.xz Check disk space ---------------- Sufficient free space for build User Environment ---------------- APT_CONFIG=/var/lib/sbuild/apt.conf DEB_BUILD_OPTIONS=parallel=4 HOME=/sbuild-nonexistent LANG=C.UTF-8 LC_ALL=C.UTF-8 LOGNAME=buildd PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games SCHROOT_ALIAS_NAME=build-PACKAGEBUILD-22594287 SCHROOT_CHROOT_NAME=build-PACKAGEBUILD-22594287 SCHROOT_COMMAND=env SCHROOT_GID=2501 SCHROOT_GROUP=buildd SCHROOT_SESSION_ID=build-PACKAGEBUILD-22594287 SCHROOT_UID=2001 SCHROOT_USER=buildd SHELL=/bin/sh TERM=unknown USER=buildd V=1 dpkg-buildpackage ----------------- dpkg-buildpackage: info: source package sqlmodel dpkg-buildpackage: info: source version 0.0.4-2 dpkg-buildpackage: info: source distribution unstable dpkg-source --before-build . dpkg-buildpackage: info: host architecture amd64 dpkg-source: info: using options from sqlmodel-0.0.4/debian/source/options: --extend-diff-ignore=^[^/]+.egg-info/ fakeroot debian/rules clean dh clean --with python3 --buildsystem=pybuild debian/rules override_dh_auto_clean make[1]: Entering directory '/<>' PYBUILD_SYSTEM=custom PYBUILD_CLEAN_ARGS="{interpreter} debian/setup.py clean" dh_auto_clean install -d /<>/debian/.debhelper/generated/_source/home pybuild --clean -i python{version} -p "3.10 3.9" I: pybuild base:237: python3.10 debian/setup.py clean /<>/debian/setup.py:10: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives from distutils.core import setup /usr/lib/python3.10/distutils/dist.py:274: UserWarning: Unknown distribution option: 'python_requires' warnings.warn(msg) /usr/lib/python3.10/distutils/dist.py:274: UserWarning: Unknown distribution option: 'project_urls' warnings.warn(msg) /usr/lib/python3.10/distutils/dist.py:274: UserWarning: Unknown distribution option: 'install_requires' warnings.warn(msg) /usr/lib/python3.10/distutils/dist.py:274: UserWarning: Unknown distribution option: 'extras_require' warnings.warn(msg) running clean I: pybuild base:237: python3.9 debian/setup.py clean /usr/lib/python3.9/distutils/dist.py:274: UserWarning: Unknown distribution option: 'python_requires' warnings.warn(msg) /usr/lib/python3.9/distutils/dist.py:274: UserWarning: Unknown distribution option: 'project_urls' warnings.warn(msg) /usr/lib/python3.9/distutils/dist.py:274: UserWarning: Unknown distribution option: 'install_requires' warnings.warn(msg) /usr/lib/python3.9/distutils/dist.py:274: UserWarning: Unknown distribution option: 'extras_require' warnings.warn(msg) running clean rm -rf .pybuild/ find . -name \*.pyc -exec rm {} \; make[1]: Leaving directory '/<>' dh_autoreconf_clean -O--buildsystem=pybuild dh_clean -O--buildsystem=pybuild rm -f debian/debhelper-build-stamp rm -rf debian/.debhelper/ rm -f -- debian/python3-sqlmodel.substvars debian/files rm -fr -- debian/python3-sqlmodel/ debian/tmp/ find . \( \( \ \( -path .\*/.git -o -path .\*/.svn -o -path .\*/.bzr -o -path .\*/.hg -o -path .\*/CVS -o -path .\*/.pc -o -path .\*/_darcs \) -prune -o -type f -a \ \( -name '#*#' -o -name '.*~' -o -name '*~' -o -name DEADJOE \ -o -name '*.orig' -o -name '*.rej' -o -name '*.bak' \ -o -name '.*.orig' -o -name .*.rej -o -name '.SUMS' \ -o -name TAGS -o \( -path '*/.deps/*' -a -name '*.P' \) \ \) -exec rm -f {} + \) -o \ \( -type d -a -name autom4te.cache -prune -exec rm -rf {} + \) \) debian/rules build dh build --with python3 --buildsystem=pybuild dh_update_autotools_config -O--buildsystem=pybuild dh_autoreconf -O--buildsystem=pybuild debian/rules override_dh_auto_configure make[1]: Entering directory '/<>' echo "pass" pass make[1]: Leaving directory '/<>' debian/rules override_dh_auto_build make[1]: Entering directory '/<>' PYBUILD_SYSTEM=custom PYBUILD_BUILD_ARGS="{interpreter} debian/setup.py build" dh_auto_build install -d /<>/debian/.debhelper/generated/_source/home pybuild --build -i python{version} -p "3.10 3.9" I: pybuild base:237: python3.10 debian/setup.py build /<>/debian/setup.py:10: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives from distutils.core import setup /usr/lib/python3.10/distutils/dist.py:274: UserWarning: Unknown distribution option: 'python_requires' warnings.warn(msg) /usr/lib/python3.10/distutils/dist.py:274: UserWarning: Unknown distribution option: 'project_urls' warnings.warn(msg) /usr/lib/python3.10/distutils/dist.py:274: UserWarning: Unknown distribution option: 'install_requires' warnings.warn(msg) /usr/lib/python3.10/distutils/dist.py:274: UserWarning: Unknown distribution option: 'extras_require' warnings.warn(msg) running build running build_py creating build creating build/lib creating build/lib/sqlmodel copying ./sqlmodel/__init__.py -> build/lib/sqlmodel copying ./sqlmodel/default.py -> build/lib/sqlmodel copying ./sqlmodel/main.py -> build/lib/sqlmodel creating build/lib/sqlmodel/engine copying ./sqlmodel/engine/__init__.py -> build/lib/sqlmodel/engine copying ./sqlmodel/engine/result.py -> build/lib/sqlmodel/engine copying ./sqlmodel/engine/create.py -> build/lib/sqlmodel/engine creating build/lib/sqlmodel/ext copying ./sqlmodel/ext/__init__.py -> build/lib/sqlmodel/ext creating build/lib/sqlmodel/ext/asyncio copying ./sqlmodel/ext/asyncio/__init__.py -> build/lib/sqlmodel/ext/asyncio copying ./sqlmodel/ext/asyncio/session.py -> build/lib/sqlmodel/ext/asyncio creating build/lib/sqlmodel/orm copying ./sqlmodel/orm/__init__.py -> build/lib/sqlmodel/orm copying ./sqlmodel/orm/session.py -> build/lib/sqlmodel/orm creating build/lib/sqlmodel/pool copying ./sqlmodel/pool/__init__.py -> build/lib/sqlmodel/pool creating build/lib/sqlmodel/sql copying ./sqlmodel/sql/__init__.py -> build/lib/sqlmodel/sql copying ./sqlmodel/sql/sqltypes.py -> build/lib/sqlmodel/sql copying ./sqlmodel/sql/expression.py -> build/lib/sqlmodel/sql copying ./sqlmodel/sql/base.py -> build/lib/sqlmodel/sql copying ./sqlmodel/py.typed -> build/lib/sqlmodel copying ./sqlmodel/sql/expression.py.jinja2 -> build/lib/sqlmodel/sql I: pybuild base:237: python3.9 debian/setup.py build /usr/lib/python3.9/distutils/dist.py:274: UserWarning: Unknown distribution option: 'python_requires' warnings.warn(msg) /usr/lib/python3.9/distutils/dist.py:274: UserWarning: Unknown distribution option: 'project_urls' warnings.warn(msg) /usr/lib/python3.9/distutils/dist.py:274: UserWarning: Unknown distribution option: 'install_requires' warnings.warn(msg) /usr/lib/python3.9/distutils/dist.py:274: UserWarning: Unknown distribution option: 'extras_require' warnings.warn(msg) running build running build_py make[1]: Leaving directory '/<>' rm -f debian/python3-sqlmodel.debhelper.log debian/rules override_dh_auto_test make[1]: Entering directory '/<>' # test_create_db_and_table: converage cant find docs_src so this test fails PYBUILD_SYSTEM=custom PYBUILD_TEST_ARGS="PYTHONPATH=/<> {interpreter} -m pytest -k 'not test_create_db_and_table' " dh_auto_test pybuild --test --test-pytest -i python{version} -p "3.10 3.9" I: pybuild base:237: PYTHONPATH=/<> python3.10 -m pytest -k 'not test_create_db_and_table' ============================= test session starts ============================== platform linux -- Python 3.10.1, pytest-6.2.5, py-1.10.0, pluggy-0.13.0 rootdir: /<> plugins: anyio-0.0.0 collected 111 items / 3 deselected / 108 selected docs_src/tutorial/fastapi/app_testing/tutorial001/test_main.py FFFFFFF [ 6%] docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_001.py F [ 7%] docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_002.py F [ 8%] docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_003.py F [ 9%] docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_004.py F [ 10%] docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_005.py F [ 11%] docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_006.py F [ 12%] tests/test_default.py .... [ 15%] tests/test_instance_no_args.py . [ 16%] tests/test_query.py . [ 17%] tests/test_tutorial/test_automatic_id_none_refresh/test_tutorial001_tutorial002.py . [ 18%] . [ 19%] tests/test_tutorial/test_code_structure/test_tutorial001.py . [ 20%] tests/test_tutorial/test_code_structure/test_tutorial002.py . [ 21%] tests/test_tutorial/test_connect/test_create_connected_tables/test_tutorial001.py . [ 22%] [ 22%] tests/test_tutorial/test_connect/test_delete/test_tutorial001.py . [ 23%] tests/test_tutorial/test_connect/test_insert/test_tutorial001.py . [ 24%] tests/test_tutorial/test_connect/test_select/test_tutorial001_tutorial002.py . [ 25%] . [ 25%] tests/test_tutorial/test_connect/test_select/test_tutorial003.py . [ 26%] tests/test_tutorial/test_connect/test_select/test_tutorial004.py . [ 27%] tests/test_tutorial/test_connect/test_select/test_tutorial005.py . [ 28%] tests/test_tutorial/test_connect/test_update/test_tutorial001.py . [ 29%] tests/test_tutorial/test_delete/test_tutorial001_tutorial002.py .. [ 31%] tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests001.py F [ 32%] [ 32%] tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests002.py F [ 33%] [ 33%] tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests003.py F [ 34%] [ 34%] tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests004.py F [ 35%] [ 35%] tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests005.py F [ 36%] [ 36%] tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests006.py F [ 37%] [ 37%] tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests_main.py F [ 37%] FFFFFF..FFF [ 48%] tests/test_tutorial/test_fastapi/test_delete/test_tutorial001.py F [ 49%] tests/test_tutorial/test_fastapi/test_limit_and_offset/test_tutorial001.py F [ 50%] [ 50%] tests/test_tutorial/test_fastapi/test_multiple_models/test_tutorial001.py F [ 50%] [ 50%] tests/test_tutorial/test_fastapi/test_multiple_models/test_tutorial002.py F [ 51%] [ 51%] tests/test_tutorial/test_fastapi/test_read_one/test_tutorial001.py F [ 52%] tests/test_tutorial/test_fastapi/test_relationships/test_tutorial001.py F [ 53%] [ 53%] tests/test_tutorial/test_fastapi/test_response_model/test_tutorial001.py F [ 54%] [ 54%] tests/test_tutorial/test_fastapi/test_session_with_dependency/test_tutorial001.py F [ 55%] [ 55%] tests/test_tutorial/test_fastapi/test_simple_hero_api/test_tutorial001.py F [ 56%] [ 56%] tests/test_tutorial/test_fastapi/test_teams/test_tutorial001.py F [ 57%] tests/test_tutorial/test_fastapi/test_update/test_tutorial001.py F [ 58%] tests/test_tutorial/test_insert/test_tutorial001.py . [ 59%] tests/test_tutorial/test_insert/test_tutorial002.py . [ 60%] tests/test_tutorial/test_insert/test_tutorial003.py . [ 61%] tests/test_tutorial/test_limit_and_offset/test_tutorial001.py . [ 62%] tests/test_tutorial/test_limit_and_offset/test_tutorial002.py . [ 62%] tests/test_tutorial/test_limit_and_offset/test_tutorial003.py . [ 63%] tests/test_tutorial/test_limit_and_offset/test_tutorial004.py . [ 64%] tests/test_tutorial/test_many_to_many/test_tutorial001.py . [ 65%] tests/test_tutorial/test_many_to_many/test_tutorial002.py . [ 66%] tests/test_tutorial/test_many_to_many/test_tutorial003.py . [ 67%] tests/test_tutorial/test_one/test_tutorial001.py . [ 68%] tests/test_tutorial/test_one/test_tutorial002.py . [ 69%] tests/test_tutorial/test_one/test_tutorial003.py . [ 70%] tests/test_tutorial/test_one/test_tutorial004.py . [ 71%] tests/test_tutorial/test_one/test_tutorial005.py . [ 72%] tests/test_tutorial/test_one/test_tutorial006.py . [ 73%] tests/test_tutorial/test_one/test_tutorial007.py . [ 74%] tests/test_tutorial/test_one/test_tutorial008.py . [ 75%] tests/test_tutorial/test_one/test_tutorial009.py . [ 75%] tests/test_tutorial/test_relationship_attributes/test_back_populates/test_tutorial001.py . [ 76%] [ 76%] tests/test_tutorial/test_relationship_attributes/test_back_populates/test_tutorial002.py . [ 77%] [ 77%] tests/test_tutorial/test_relationship_attributes/test_back_populates/test_tutorial003.py . [ 78%] [ 78%] tests/test_tutorial/test_relationship_attributes/test_create_and_update_relationships/test_tutorial001.py . [ 79%] [ 79%] tests/test_tutorial/test_relationship_attributes/test_define_relationship_attributes/test_tutorial001.py . [ 80%] [ 80%] tests/test_tutorial/test_relationship_attributes/test_read_relationships/test_tutorial001.py . [ 81%] [ 81%] tests/test_tutorial/test_relationship_attributes/test_read_relationships/test_tutorial002.py . [ 82%] [ 82%] tests/test_tutorial/test_select/test_tutorial001_tutorial002.py .. [ 84%] tests/test_tutorial/test_select/test_tutorial003_tutorial004.py .. [ 86%] tests/test_tutorial/test_update/test_tutorial001_tutorial002.py .. [ 87%] tests/test_tutorial/test_update/test_tutorial003_tutorial004.py .. [ 89%] tests/test_tutorial/test_where/test_tutorial001.py . [ 90%] tests/test_tutorial/test_where/test_tutorial002.py . [ 91%] tests/test_tutorial/test_where/test_tutorial003.py . [ 92%] tests/test_tutorial/test_where/test_tutorial004.py . [ 93%] tests/test_tutorial/test_where/test_tutorial005.py . [ 94%] tests/test_tutorial/test_where/test_tutorial006.py . [ 95%] tests/test_tutorial/test_where/test_tutorial007.py . [ 96%] tests/test_tutorial/test_where/test_tutorial008.py . [ 97%] tests/test_tutorial/test_where/test_tutorial009.py . [ 98%] tests/test_tutorial/test_where/test_tutorial010.py . [ 99%] tests/test_tutorial/test_where/test_tutorial011.py . [100%] =================================== FAILURES =================================== _______________________________ test_create_hero _______________________________ client = def test_create_hero(client: TestClient): > response = client.post( "/heroes/", json={"name": "Deadpond", "secret_name": "Dive Wilson"} ) docs_src/tutorial/fastapi/app_testing/tutorial001/test_main.py:31: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3/dist-packages/requests/sessions.py:590: in post return self.request('POST', url, data=data, json=json, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:468: in request return super().request( /usr/lib/python3/dist-packages/requests/sessions.py:542: in request resp = self.send(prep, **send_kwargs) /usr/lib/python3/dist-packages/requests/sessions.py:655: in send r = adapter.send(request, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:266: in send raise exc _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , args = () kwargs = {'cert': None, 'proxies': OrderedDict([('no', 'localhost'), ('https', 'https://127.0.0.1:9/'), ('http', 'http://127.0.0.1:9/')]), 'stream': False, 'timeout': None, ...} scheme = 'http', netloc = 'testserver', path = '/heroes/', query = '' fragment = '', default_port = 80, host = 'testserver', port = 80 headers = [(b'host', b'testserver'), (b'user-agent', b'testclient'), (b'accept-encoding', b'gzip, deflate'), (b'accept', b'*/*'), (b'connection', b'keep-alive'), (b'content-length', b'50'), ...] def send( self, request: requests.PreparedRequest, *args: typing.Any, **kwargs: typing.Any ) -> requests.Response: scheme, netloc, path, query, fragment = ( str(item) for item in urlsplit(request.url) ) default_port = {"http": 80, "ws": 80, "https": 443, "wss": 443}[scheme] if ":" in netloc: host, port_string = netloc.split(":", 1) port = int(port_string) else: host = netloc port = default_port # Include the 'host' header. if "host" in request.headers: headers: typing.List[typing.Tuple[bytes, bytes]] = [] elif port == default_port: headers = [(b"host", host.encode())] else: headers = [(b"host", (f"{host}:{port}").encode())] # Include other request headers. headers += [ (key.lower().encode(), value.encode()) for key, value in request.headers.items() ] if scheme in {"ws", "wss"}: subprotocol = request.headers.get("sec-websocket-protocol", None) if subprotocol is None: subprotocols: typing.Sequence[str] = [] else: subprotocols = [value.strip() for value in subprotocol.split(",")] scope = { "type": "websocket", "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "subprotocols": subprotocols, } session = WebSocketTestSession(self.app, scope, self.portal_factory) raise _Upgrade(session) scope = { "type": "http", "http_version": "1.1", "method": request.method, "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "extensions": {"http.response.template": {}}, } request_complete = False response_started = False response_complete: anyio.Event raw_kwargs: typing.Dict[str, typing.Any] = {"body": io.BytesIO()} template = None context = None async def receive() -> Message: nonlocal request_complete if request_complete: if not response_complete.is_set(): await response_complete.wait() return {"type": "http.disconnect"} body = request.body if isinstance(body, str): body_bytes: bytes = body.encode("utf-8") elif body is None: body_bytes = b"" elif isinstance(body, types.GeneratorType): try: chunk = body.send(None) if isinstance(chunk, str): chunk = chunk.encode("utf-8") return {"type": "http.request", "body": chunk, "more_body": True} except StopIteration: request_complete = True return {"type": "http.request", "body": b""} else: body_bytes = body request_complete = True return {"type": "http.request", "body": body_bytes} async def send(message: Message) -> None: nonlocal raw_kwargs, response_started, template, context if message["type"] == "http.response.start": assert ( not response_started ), 'Received multiple "http.response.start" messages.' raw_kwargs["version"] = 11 raw_kwargs["status"] = message["status"] raw_kwargs["reason"] = _get_reason_phrase(message["status"]) raw_kwargs["headers"] = [ (key.decode(), value.decode()) for key, value in message.get("headers", []) ] raw_kwargs["preload_content"] = False raw_kwargs["original_response"] = _MockOriginalResponse( raw_kwargs["headers"] ) response_started = True elif message["type"] == "http.response.body": assert ( response_started ), 'Received "http.response.body" without "http.response.start".' assert ( not response_complete.is_set() ), 'Received "http.response.body" after response completed.' body = message.get("body", b"") more_body = message.get("more_body", False) if request.method != "HEAD": raw_kwargs["body"].write(body) if not more_body: raw_kwargs["body"].seek(0) response_complete.set() elif message["type"] == "http.response.template": template = message["template"] context = message["context"] try: with self.portal_factory() as portal: > response_complete = portal.call(anyio.Event) E AttributeError: module 'anyio' has no attribute 'Event' /usr/lib/python3/dist-packages/starlette/testclient.py:262: AttributeError _________________________ test_create_hero_incomplete __________________________ client = def test_create_hero_incomplete(client: TestClient): # No secret_name > response = client.post("/heroes/", json={"name": "Deadpond"}) docs_src/tutorial/fastapi/app_testing/tutorial001/test_main.py:45: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3/dist-packages/requests/sessions.py:590: in post return self.request('POST', url, data=data, json=json, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:468: in request return super().request( /usr/lib/python3/dist-packages/requests/sessions.py:542: in request resp = self.send(prep, **send_kwargs) /usr/lib/python3/dist-packages/requests/sessions.py:655: in send r = adapter.send(request, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:266: in send raise exc _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , args = () kwargs = {'cert': None, 'proxies': OrderedDict([('no', 'localhost'), ('https', 'https://127.0.0.1:9/'), ('http', 'http://127.0.0.1:9/')]), 'stream': False, 'timeout': None, ...} scheme = 'http', netloc = 'testserver', path = '/heroes/', query = '' fragment = '', default_port = 80, host = 'testserver', port = 80 headers = [(b'host', b'testserver'), (b'user-agent', b'testclient'), (b'accept-encoding', b'gzip, deflate'), (b'accept', b'*/*'), (b'connection', b'keep-alive'), (b'content-length', b'20'), ...] def send( self, request: requests.PreparedRequest, *args: typing.Any, **kwargs: typing.Any ) -> requests.Response: scheme, netloc, path, query, fragment = ( str(item) for item in urlsplit(request.url) ) default_port = {"http": 80, "ws": 80, "https": 443, "wss": 443}[scheme] if ":" in netloc: host, port_string = netloc.split(":", 1) port = int(port_string) else: host = netloc port = default_port # Include the 'host' header. if "host" in request.headers: headers: typing.List[typing.Tuple[bytes, bytes]] = [] elif port == default_port: headers = [(b"host", host.encode())] else: headers = [(b"host", (f"{host}:{port}").encode())] # Include other request headers. headers += [ (key.lower().encode(), value.encode()) for key, value in request.headers.items() ] if scheme in {"ws", "wss"}: subprotocol = request.headers.get("sec-websocket-protocol", None) if subprotocol is None: subprotocols: typing.Sequence[str] = [] else: subprotocols = [value.strip() for value in subprotocol.split(",")] scope = { "type": "websocket", "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "subprotocols": subprotocols, } session = WebSocketTestSession(self.app, scope, self.portal_factory) raise _Upgrade(session) scope = { "type": "http", "http_version": "1.1", "method": request.method, "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "extensions": {"http.response.template": {}}, } request_complete = False response_started = False response_complete: anyio.Event raw_kwargs: typing.Dict[str, typing.Any] = {"body": io.BytesIO()} template = None context = None async def receive() -> Message: nonlocal request_complete if request_complete: if not response_complete.is_set(): await response_complete.wait() return {"type": "http.disconnect"} body = request.body if isinstance(body, str): body_bytes: bytes = body.encode("utf-8") elif body is None: body_bytes = b"" elif isinstance(body, types.GeneratorType): try: chunk = body.send(None) if isinstance(chunk, str): chunk = chunk.encode("utf-8") return {"type": "http.request", "body": chunk, "more_body": True} except StopIteration: request_complete = True return {"type": "http.request", "body": b""} else: body_bytes = body request_complete = True return {"type": "http.request", "body": body_bytes} async def send(message: Message) -> None: nonlocal raw_kwargs, response_started, template, context if message["type"] == "http.response.start": assert ( not response_started ), 'Received multiple "http.response.start" messages.' raw_kwargs["version"] = 11 raw_kwargs["status"] = message["status"] raw_kwargs["reason"] = _get_reason_phrase(message["status"]) raw_kwargs["headers"] = [ (key.decode(), value.decode()) for key, value in message.get("headers", []) ] raw_kwargs["preload_content"] = False raw_kwargs["original_response"] = _MockOriginalResponse( raw_kwargs["headers"] ) response_started = True elif message["type"] == "http.response.body": assert ( response_started ), 'Received "http.response.body" without "http.response.start".' assert ( not response_complete.is_set() ), 'Received "http.response.body" after response completed.' body = message.get("body", b"") more_body = message.get("more_body", False) if request.method != "HEAD": raw_kwargs["body"].write(body) if not more_body: raw_kwargs["body"].seek(0) response_complete.set() elif message["type"] == "http.response.template": template = message["template"] context = message["context"] try: with self.portal_factory() as portal: > response_complete = portal.call(anyio.Event) E AttributeError: module 'anyio' has no attribute 'Event' /usr/lib/python3/dist-packages/starlette/testclient.py:262: AttributeError ___________________________ test_create_hero_invalid ___________________________ client = def test_create_hero_invalid(client: TestClient): # secret_name has an invalid type > response = client.post( "/heroes/", json={ "name": "Deadpond", "secret_name": {"message": "Do you wanna know my secret identity?"}, }, ) docs_src/tutorial/fastapi/app_testing/tutorial001/test_main.py:51: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3/dist-packages/requests/sessions.py:590: in post return self.request('POST', url, data=data, json=json, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:468: in request return super().request( /usr/lib/python3/dist-packages/requests/sessions.py:542: in request resp = self.send(prep, **send_kwargs) /usr/lib/python3/dist-packages/requests/sessions.py:655: in send r = adapter.send(request, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:266: in send raise exc _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , args = () kwargs = {'cert': None, 'proxies': OrderedDict([('no', 'localhost'), ('https', 'https://127.0.0.1:9/'), ('http', 'http://127.0.0.1:9/')]), 'stream': False, 'timeout': None, ...} scheme = 'http', netloc = 'testserver', path = '/heroes/', query = '' fragment = '', default_port = 80, host = 'testserver', port = 80 headers = [(b'host', b'testserver'), (b'user-agent', b'testclient'), (b'accept-encoding', b'gzip, deflate'), (b'accept', b'*/*'), (b'connection', b'keep-alive'), (b'content-length', b'89'), ...] def send( self, request: requests.PreparedRequest, *args: typing.Any, **kwargs: typing.Any ) -> requests.Response: scheme, netloc, path, query, fragment = ( str(item) for item in urlsplit(request.url) ) default_port = {"http": 80, "ws": 80, "https": 443, "wss": 443}[scheme] if ":" in netloc: host, port_string = netloc.split(":", 1) port = int(port_string) else: host = netloc port = default_port # Include the 'host' header. if "host" in request.headers: headers: typing.List[typing.Tuple[bytes, bytes]] = [] elif port == default_port: headers = [(b"host", host.encode())] else: headers = [(b"host", (f"{host}:{port}").encode())] # Include other request headers. headers += [ (key.lower().encode(), value.encode()) for key, value in request.headers.items() ] if scheme in {"ws", "wss"}: subprotocol = request.headers.get("sec-websocket-protocol", None) if subprotocol is None: subprotocols: typing.Sequence[str] = [] else: subprotocols = [value.strip() for value in subprotocol.split(",")] scope = { "type": "websocket", "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "subprotocols": subprotocols, } session = WebSocketTestSession(self.app, scope, self.portal_factory) raise _Upgrade(session) scope = { "type": "http", "http_version": "1.1", "method": request.method, "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "extensions": {"http.response.template": {}}, } request_complete = False response_started = False response_complete: anyio.Event raw_kwargs: typing.Dict[str, typing.Any] = {"body": io.BytesIO()} template = None context = None async def receive() -> Message: nonlocal request_complete if request_complete: if not response_complete.is_set(): await response_complete.wait() return {"type": "http.disconnect"} body = request.body if isinstance(body, str): body_bytes: bytes = body.encode("utf-8") elif body is None: body_bytes = b"" elif isinstance(body, types.GeneratorType): try: chunk = body.send(None) if isinstance(chunk, str): chunk = chunk.encode("utf-8") return {"type": "http.request", "body": chunk, "more_body": True} except StopIteration: request_complete = True return {"type": "http.request", "body": b""} else: body_bytes = body request_complete = True return {"type": "http.request", "body": body_bytes} async def send(message: Message) -> None: nonlocal raw_kwargs, response_started, template, context if message["type"] == "http.response.start": assert ( not response_started ), 'Received multiple "http.response.start" messages.' raw_kwargs["version"] = 11 raw_kwargs["status"] = message["status"] raw_kwargs["reason"] = _get_reason_phrase(message["status"]) raw_kwargs["headers"] = [ (key.decode(), value.decode()) for key, value in message.get("headers", []) ] raw_kwargs["preload_content"] = False raw_kwargs["original_response"] = _MockOriginalResponse( raw_kwargs["headers"] ) response_started = True elif message["type"] == "http.response.body": assert ( response_started ), 'Received "http.response.body" without "http.response.start".' assert ( not response_complete.is_set() ), 'Received "http.response.body" after response completed.' body = message.get("body", b"") more_body = message.get("more_body", False) if request.method != "HEAD": raw_kwargs["body"].write(body) if not more_body: raw_kwargs["body"].seek(0) response_complete.set() elif message["type"] == "http.response.template": template = message["template"] context = message["context"] try: with self.portal_factory() as portal: > response_complete = portal.call(anyio.Event) E AttributeError: module 'anyio' has no attribute 'Event' /usr/lib/python3/dist-packages/starlette/testclient.py:262: AttributeError _______________________________ test_read_heroes _______________________________ session = client = def test_read_heroes(session: Session, client: TestClient): hero_1 = Hero(name="Deadpond", secret_name="Dive Wilson") hero_2 = Hero(name="Rusty-Man", secret_name="Tommy Sharp", age=48) session.add(hero_1) session.add(hero_2) session.commit() > response = client.get("/heroes/") docs_src/tutorial/fastapi/app_testing/tutorial001/test_main.py:68: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3/dist-packages/requests/sessions.py:555: in get return self.request('GET', url, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:468: in request return super().request( /usr/lib/python3/dist-packages/requests/sessions.py:542: in request resp = self.send(prep, **send_kwargs) /usr/lib/python3/dist-packages/requests/sessions.py:655: in send r = adapter.send(request, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:266: in send raise exc _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , args = () kwargs = {'cert': None, 'proxies': OrderedDict([('no', 'localhost'), ('https', 'https://127.0.0.1:9/'), ('http', 'http://127.0.0.1:9/')]), 'stream': False, 'timeout': None, ...} scheme = 'http', netloc = 'testserver', path = '/heroes/', query = '' fragment = '', default_port = 80, host = 'testserver', port = 80 headers = [(b'host', b'testserver'), (b'user-agent', b'testclient'), (b'accept-encoding', b'gzip, deflate'), (b'accept', b'*/*'), (b'connection', b'keep-alive')] def send( self, request: requests.PreparedRequest, *args: typing.Any, **kwargs: typing.Any ) -> requests.Response: scheme, netloc, path, query, fragment = ( str(item) for item in urlsplit(request.url) ) default_port = {"http": 80, "ws": 80, "https": 443, "wss": 443}[scheme] if ":" in netloc: host, port_string = netloc.split(":", 1) port = int(port_string) else: host = netloc port = default_port # Include the 'host' header. if "host" in request.headers: headers: typing.List[typing.Tuple[bytes, bytes]] = [] elif port == default_port: headers = [(b"host", host.encode())] else: headers = [(b"host", (f"{host}:{port}").encode())] # Include other request headers. headers += [ (key.lower().encode(), value.encode()) for key, value in request.headers.items() ] if scheme in {"ws", "wss"}: subprotocol = request.headers.get("sec-websocket-protocol", None) if subprotocol is None: subprotocols: typing.Sequence[str] = [] else: subprotocols = [value.strip() for value in subprotocol.split(",")] scope = { "type": "websocket", "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "subprotocols": subprotocols, } session = WebSocketTestSession(self.app, scope, self.portal_factory) raise _Upgrade(session) scope = { "type": "http", "http_version": "1.1", "method": request.method, "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "extensions": {"http.response.template": {}}, } request_complete = False response_started = False response_complete: anyio.Event raw_kwargs: typing.Dict[str, typing.Any] = {"body": io.BytesIO()} template = None context = None async def receive() -> Message: nonlocal request_complete if request_complete: if not response_complete.is_set(): await response_complete.wait() return {"type": "http.disconnect"} body = request.body if isinstance(body, str): body_bytes: bytes = body.encode("utf-8") elif body is None: body_bytes = b"" elif isinstance(body, types.GeneratorType): try: chunk = body.send(None) if isinstance(chunk, str): chunk = chunk.encode("utf-8") return {"type": "http.request", "body": chunk, "more_body": True} except StopIteration: request_complete = True return {"type": "http.request", "body": b""} else: body_bytes = body request_complete = True return {"type": "http.request", "body": body_bytes} async def send(message: Message) -> None: nonlocal raw_kwargs, response_started, template, context if message["type"] == "http.response.start": assert ( not response_started ), 'Received multiple "http.response.start" messages.' raw_kwargs["version"] = 11 raw_kwargs["status"] = message["status"] raw_kwargs["reason"] = _get_reason_phrase(message["status"]) raw_kwargs["headers"] = [ (key.decode(), value.decode()) for key, value in message.get("headers", []) ] raw_kwargs["preload_content"] = False raw_kwargs["original_response"] = _MockOriginalResponse( raw_kwargs["headers"] ) response_started = True elif message["type"] == "http.response.body": assert ( response_started ), 'Received "http.response.body" without "http.response.start".' assert ( not response_complete.is_set() ), 'Received "http.response.body" after response completed.' body = message.get("body", b"") more_body = message.get("more_body", False) if request.method != "HEAD": raw_kwargs["body"].write(body) if not more_body: raw_kwargs["body"].seek(0) response_complete.set() elif message["type"] == "http.response.template": template = message["template"] context = message["context"] try: with self.portal_factory() as portal: > response_complete = portal.call(anyio.Event) E AttributeError: module 'anyio' has no attribute 'Event' /usr/lib/python3/dist-packages/starlette/testclient.py:262: AttributeError ________________________________ test_read_hero ________________________________ session = client = def test_read_hero(session: Session, client: TestClient): hero_1 = Hero(name="Deadpond", secret_name="Dive Wilson") session.add(hero_1) session.commit() > response = client.get(f"/heroes/{hero_1.id}") docs_src/tutorial/fastapi/app_testing/tutorial001/test_main.py:89: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3/dist-packages/requests/sessions.py:555: in get return self.request('GET', url, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:468: in request return super().request( /usr/lib/python3/dist-packages/requests/sessions.py:542: in request resp = self.send(prep, **send_kwargs) /usr/lib/python3/dist-packages/requests/sessions.py:655: in send r = adapter.send(request, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:266: in send raise exc _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , args = () kwargs = {'cert': None, 'proxies': OrderedDict([('no', 'localhost'), ('https', 'https://127.0.0.1:9/'), ('http', 'http://127.0.0.1:9/')]), 'stream': False, 'timeout': None, ...} scheme = 'http', netloc = 'testserver', path = '/heroes/1', query = '' fragment = '', default_port = 80, host = 'testserver', port = 80 headers = [(b'host', b'testserver'), (b'user-agent', b'testclient'), (b'accept-encoding', b'gzip, deflate'), (b'accept', b'*/*'), (b'connection', b'keep-alive')] def send( self, request: requests.PreparedRequest, *args: typing.Any, **kwargs: typing.Any ) -> requests.Response: scheme, netloc, path, query, fragment = ( str(item) for item in urlsplit(request.url) ) default_port = {"http": 80, "ws": 80, "https": 443, "wss": 443}[scheme] if ":" in netloc: host, port_string = netloc.split(":", 1) port = int(port_string) else: host = netloc port = default_port # Include the 'host' header. if "host" in request.headers: headers: typing.List[typing.Tuple[bytes, bytes]] = [] elif port == default_port: headers = [(b"host", host.encode())] else: headers = [(b"host", (f"{host}:{port}").encode())] # Include other request headers. headers += [ (key.lower().encode(), value.encode()) for key, value in request.headers.items() ] if scheme in {"ws", "wss"}: subprotocol = request.headers.get("sec-websocket-protocol", None) if subprotocol is None: subprotocols: typing.Sequence[str] = [] else: subprotocols = [value.strip() for value in subprotocol.split(",")] scope = { "type": "websocket", "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "subprotocols": subprotocols, } session = WebSocketTestSession(self.app, scope, self.portal_factory) raise _Upgrade(session) scope = { "type": "http", "http_version": "1.1", "method": request.method, "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "extensions": {"http.response.template": {}}, } request_complete = False response_started = False response_complete: anyio.Event raw_kwargs: typing.Dict[str, typing.Any] = {"body": io.BytesIO()} template = None context = None async def receive() -> Message: nonlocal request_complete if request_complete: if not response_complete.is_set(): await response_complete.wait() return {"type": "http.disconnect"} body = request.body if isinstance(body, str): body_bytes: bytes = body.encode("utf-8") elif body is None: body_bytes = b"" elif isinstance(body, types.GeneratorType): try: chunk = body.send(None) if isinstance(chunk, str): chunk = chunk.encode("utf-8") return {"type": "http.request", "body": chunk, "more_body": True} except StopIteration: request_complete = True return {"type": "http.request", "body": b""} else: body_bytes = body request_complete = True return {"type": "http.request", "body": body_bytes} async def send(message: Message) -> None: nonlocal raw_kwargs, response_started, template, context if message["type"] == "http.response.start": assert ( not response_started ), 'Received multiple "http.response.start" messages.' raw_kwargs["version"] = 11 raw_kwargs["status"] = message["status"] raw_kwargs["reason"] = _get_reason_phrase(message["status"]) raw_kwargs["headers"] = [ (key.decode(), value.decode()) for key, value in message.get("headers", []) ] raw_kwargs["preload_content"] = False raw_kwargs["original_response"] = _MockOriginalResponse( raw_kwargs["headers"] ) response_started = True elif message["type"] == "http.response.body": assert ( response_started ), 'Received "http.response.body" without "http.response.start".' assert ( not response_complete.is_set() ), 'Received "http.response.body" after response completed.' body = message.get("body", b"") more_body = message.get("more_body", False) if request.method != "HEAD": raw_kwargs["body"].write(body) if not more_body: raw_kwargs["body"].seek(0) response_complete.set() elif message["type"] == "http.response.template": template = message["template"] context = message["context"] try: with self.portal_factory() as portal: > response_complete = portal.call(anyio.Event) E AttributeError: module 'anyio' has no attribute 'Event' /usr/lib/python3/dist-packages/starlette/testclient.py:262: AttributeError _______________________________ test_update_hero _______________________________ session = client = def test_update_hero(session: Session, client: TestClient): hero_1 = Hero(name="Deadpond", secret_name="Dive Wilson") session.add(hero_1) session.commit() > response = client.patch(f"/heroes/{hero_1.id}", json={"name": "Deadpuddle"}) docs_src/tutorial/fastapi/app_testing/tutorial001/test_main.py:104: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3/dist-packages/requests/sessions.py:614: in patch return self.request('PATCH', url, data=data, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:468: in request return super().request( /usr/lib/python3/dist-packages/requests/sessions.py:542: in request resp = self.send(prep, **send_kwargs) /usr/lib/python3/dist-packages/requests/sessions.py:655: in send r = adapter.send(request, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:266: in send raise exc _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , args = () kwargs = {'cert': None, 'proxies': OrderedDict([('no', 'localhost'), ('https', 'https://127.0.0.1:9/'), ('http', 'http://127.0.0.1:9/')]), 'stream': False, 'timeout': None, ...} scheme = 'http', netloc = 'testserver', path = '/heroes/1', query = '' fragment = '', default_port = 80, host = 'testserver', port = 80 headers = [(b'host', b'testserver'), (b'user-agent', b'testclient'), (b'accept-encoding', b'gzip, deflate'), (b'accept', b'*/*'), (b'connection', b'keep-alive'), (b'content-length', b'22'), ...] def send( self, request: requests.PreparedRequest, *args: typing.Any, **kwargs: typing.Any ) -> requests.Response: scheme, netloc, path, query, fragment = ( str(item) for item in urlsplit(request.url) ) default_port = {"http": 80, "ws": 80, "https": 443, "wss": 443}[scheme] if ":" in netloc: host, port_string = netloc.split(":", 1) port = int(port_string) else: host = netloc port = default_port # Include the 'host' header. if "host" in request.headers: headers: typing.List[typing.Tuple[bytes, bytes]] = [] elif port == default_port: headers = [(b"host", host.encode())] else: headers = [(b"host", (f"{host}:{port}").encode())] # Include other request headers. headers += [ (key.lower().encode(), value.encode()) for key, value in request.headers.items() ] if scheme in {"ws", "wss"}: subprotocol = request.headers.get("sec-websocket-protocol", None) if subprotocol is None: subprotocols: typing.Sequence[str] = [] else: subprotocols = [value.strip() for value in subprotocol.split(",")] scope = { "type": "websocket", "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "subprotocols": subprotocols, } session = WebSocketTestSession(self.app, scope, self.portal_factory) raise _Upgrade(session) scope = { "type": "http", "http_version": "1.1", "method": request.method, "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "extensions": {"http.response.template": {}}, } request_complete = False response_started = False response_complete: anyio.Event raw_kwargs: typing.Dict[str, typing.Any] = {"body": io.BytesIO()} template = None context = None async def receive() -> Message: nonlocal request_complete if request_complete: if not response_complete.is_set(): await response_complete.wait() return {"type": "http.disconnect"} body = request.body if isinstance(body, str): body_bytes: bytes = body.encode("utf-8") elif body is None: body_bytes = b"" elif isinstance(body, types.GeneratorType): try: chunk = body.send(None) if isinstance(chunk, str): chunk = chunk.encode("utf-8") return {"type": "http.request", "body": chunk, "more_body": True} except StopIteration: request_complete = True return {"type": "http.request", "body": b""} else: body_bytes = body request_complete = True return {"type": "http.request", "body": body_bytes} async def send(message: Message) -> None: nonlocal raw_kwargs, response_started, template, context if message["type"] == "http.response.start": assert ( not response_started ), 'Received multiple "http.response.start" messages.' raw_kwargs["version"] = 11 raw_kwargs["status"] = message["status"] raw_kwargs["reason"] = _get_reason_phrase(message["status"]) raw_kwargs["headers"] = [ (key.decode(), value.decode()) for key, value in message.get("headers", []) ] raw_kwargs["preload_content"] = False raw_kwargs["original_response"] = _MockOriginalResponse( raw_kwargs["headers"] ) response_started = True elif message["type"] == "http.response.body": assert ( response_started ), 'Received "http.response.body" without "http.response.start".' assert ( not response_complete.is_set() ), 'Received "http.response.body" after response completed.' body = message.get("body", b"") more_body = message.get("more_body", False) if request.method != "HEAD": raw_kwargs["body"].write(body) if not more_body: raw_kwargs["body"].seek(0) response_complete.set() elif message["type"] == "http.response.template": template = message["template"] context = message["context"] try: with self.portal_factory() as portal: > response_complete = portal.call(anyio.Event) E AttributeError: module 'anyio' has no attribute 'Event' /usr/lib/python3/dist-packages/starlette/testclient.py:262: AttributeError _______________________________ test_delete_hero _______________________________ session = client = def test_delete_hero(session: Session, client: TestClient): hero_1 = Hero(name="Deadpond", secret_name="Dive Wilson") session.add(hero_1) session.commit() > response = client.delete(f"/heroes/{hero_1.id}") docs_src/tutorial/fastapi/app_testing/tutorial001/test_main.py:119: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3/dist-packages/requests/sessions.py:624: in delete return self.request('DELETE', url, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:468: in request return super().request( /usr/lib/python3/dist-packages/requests/sessions.py:542: in request resp = self.send(prep, **send_kwargs) /usr/lib/python3/dist-packages/requests/sessions.py:655: in send r = adapter.send(request, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:266: in send raise exc _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , args = () kwargs = {'cert': None, 'proxies': OrderedDict([('no', 'localhost'), ('https', 'https://127.0.0.1:9/'), ('http', 'http://127.0.0.1:9/')]), 'stream': False, 'timeout': None, ...} scheme = 'http', netloc = 'testserver', path = '/heroes/1', query = '' fragment = '', default_port = 80, host = 'testserver', port = 80 headers = [(b'host', b'testserver'), (b'user-agent', b'testclient'), (b'accept-encoding', b'gzip, deflate'), (b'accept', b'*/*'), (b'connection', b'keep-alive'), (b'content-length', b'0')] def send( self, request: requests.PreparedRequest, *args: typing.Any, **kwargs: typing.Any ) -> requests.Response: scheme, netloc, path, query, fragment = ( str(item) for item in urlsplit(request.url) ) default_port = {"http": 80, "ws": 80, "https": 443, "wss": 443}[scheme] if ":" in netloc: host, port_string = netloc.split(":", 1) port = int(port_string) else: host = netloc port = default_port # Include the 'host' header. if "host" in request.headers: headers: typing.List[typing.Tuple[bytes, bytes]] = [] elif port == default_port: headers = [(b"host", host.encode())] else: headers = [(b"host", (f"{host}:{port}").encode())] # Include other request headers. headers += [ (key.lower().encode(), value.encode()) for key, value in request.headers.items() ] if scheme in {"ws", "wss"}: subprotocol = request.headers.get("sec-websocket-protocol", None) if subprotocol is None: subprotocols: typing.Sequence[str] = [] else: subprotocols = [value.strip() for value in subprotocol.split(",")] scope = { "type": "websocket", "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "subprotocols": subprotocols, } session = WebSocketTestSession(self.app, scope, self.portal_factory) raise _Upgrade(session) scope = { "type": "http", "http_version": "1.1", "method": request.method, "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "extensions": {"http.response.template": {}}, } request_complete = False response_started = False response_complete: anyio.Event raw_kwargs: typing.Dict[str, typing.Any] = {"body": io.BytesIO()} template = None context = None async def receive() -> Message: nonlocal request_complete if request_complete: if not response_complete.is_set(): await response_complete.wait() return {"type": "http.disconnect"} body = request.body if isinstance(body, str): body_bytes: bytes = body.encode("utf-8") elif body is None: body_bytes = b"" elif isinstance(body, types.GeneratorType): try: chunk = body.send(None) if isinstance(chunk, str): chunk = chunk.encode("utf-8") return {"type": "http.request", "body": chunk, "more_body": True} except StopIteration: request_complete = True return {"type": "http.request", "body": b""} else: body_bytes = body request_complete = True return {"type": "http.request", "body": body_bytes} async def send(message: Message) -> None: nonlocal raw_kwargs, response_started, template, context if message["type"] == "http.response.start": assert ( not response_started ), 'Received multiple "http.response.start" messages.' raw_kwargs["version"] = 11 raw_kwargs["status"] = message["status"] raw_kwargs["reason"] = _get_reason_phrase(message["status"]) raw_kwargs["headers"] = [ (key.decode(), value.decode()) for key, value in message.get("headers", []) ] raw_kwargs["preload_content"] = False raw_kwargs["original_response"] = _MockOriginalResponse( raw_kwargs["headers"] ) response_started = True elif message["type"] == "http.response.body": assert ( response_started ), 'Received "http.response.body" without "http.response.start".' assert ( not response_complete.is_set() ), 'Received "http.response.body" after response completed.' body = message.get("body", b"") more_body = message.get("more_body", False) if request.method != "HEAD": raw_kwargs["body"].write(body) if not more_body: raw_kwargs["body"].seek(0) response_complete.set() elif message["type"] == "http.response.template": template = message["template"] context = message["context"] try: with self.portal_factory() as portal: > response_complete = portal.call(anyio.Event) E AttributeError: module 'anyio' has no attribute 'Event' /usr/lib/python3/dist-packages/starlette/testclient.py:262: AttributeError _______________________________ test_create_hero _______________________________ def test_create_hero(): engine = create_engine( "sqlite:///testing.db", connect_args={"check_same_thread": False} ) SQLModel.metadata.create_all(engine) with Session(engine) as session: def get_session_override(): return session app.dependency_overrides[get_session] = get_session_override client = TestClient(app) # (2) > response = client.post( # (3) "/heroes/", json={"name": "Deadpond", "secret_name": "Dive Wilson"} ) docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_001.py:22: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3/dist-packages/requests/sessions.py:590: in post return self.request('POST', url, data=data, json=json, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:468: in request return super().request( /usr/lib/python3/dist-packages/requests/sessions.py:542: in request resp = self.send(prep, **send_kwargs) /usr/lib/python3/dist-packages/requests/sessions.py:655: in send r = adapter.send(request, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:266: in send raise exc _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , args = () kwargs = {'cert': None, 'proxies': OrderedDict([('no', 'localhost'), ('https', 'https://127.0.0.1:9/'), ('http', 'http://127.0.0.1:9/')]), 'stream': False, 'timeout': None, ...} scheme = 'http', netloc = 'testserver', path = '/heroes/', query = '' fragment = '', default_port = 80, host = 'testserver', port = 80 headers = [(b'host', b'testserver'), (b'user-agent', b'testclient'), (b'accept-encoding', b'gzip, deflate'), (b'accept', b'*/*'), (b'connection', b'keep-alive'), (b'content-length', b'50'), ...] def send( self, request: requests.PreparedRequest, *args: typing.Any, **kwargs: typing.Any ) -> requests.Response: scheme, netloc, path, query, fragment = ( str(item) for item in urlsplit(request.url) ) default_port = {"http": 80, "ws": 80, "https": 443, "wss": 443}[scheme] if ":" in netloc: host, port_string = netloc.split(":", 1) port = int(port_string) else: host = netloc port = default_port # Include the 'host' header. if "host" in request.headers: headers: typing.List[typing.Tuple[bytes, bytes]] = [] elif port == default_port: headers = [(b"host", host.encode())] else: headers = [(b"host", (f"{host}:{port}").encode())] # Include other request headers. headers += [ (key.lower().encode(), value.encode()) for key, value in request.headers.items() ] if scheme in {"ws", "wss"}: subprotocol = request.headers.get("sec-websocket-protocol", None) if subprotocol is None: subprotocols: typing.Sequence[str] = [] else: subprotocols = [value.strip() for value in subprotocol.split(",")] scope = { "type": "websocket", "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "subprotocols": subprotocols, } session = WebSocketTestSession(self.app, scope, self.portal_factory) raise _Upgrade(session) scope = { "type": "http", "http_version": "1.1", "method": request.method, "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "extensions": {"http.response.template": {}}, } request_complete = False response_started = False response_complete: anyio.Event raw_kwargs: typing.Dict[str, typing.Any] = {"body": io.BytesIO()} template = None context = None async def receive() -> Message: nonlocal request_complete if request_complete: if not response_complete.is_set(): await response_complete.wait() return {"type": "http.disconnect"} body = request.body if isinstance(body, str): body_bytes: bytes = body.encode("utf-8") elif body is None: body_bytes = b"" elif isinstance(body, types.GeneratorType): try: chunk = body.send(None) if isinstance(chunk, str): chunk = chunk.encode("utf-8") return {"type": "http.request", "body": chunk, "more_body": True} except StopIteration: request_complete = True return {"type": "http.request", "body": b""} else: body_bytes = body request_complete = True return {"type": "http.request", "body": body_bytes} async def send(message: Message) -> None: nonlocal raw_kwargs, response_started, template, context if message["type"] == "http.response.start": assert ( not response_started ), 'Received multiple "http.response.start" messages.' raw_kwargs["version"] = 11 raw_kwargs["status"] = message["status"] raw_kwargs["reason"] = _get_reason_phrase(message["status"]) raw_kwargs["headers"] = [ (key.decode(), value.decode()) for key, value in message.get("headers", []) ] raw_kwargs["preload_content"] = False raw_kwargs["original_response"] = _MockOriginalResponse( raw_kwargs["headers"] ) response_started = True elif message["type"] == "http.response.body": assert ( response_started ), 'Received "http.response.body" without "http.response.start".' assert ( not response_complete.is_set() ), 'Received "http.response.body" after response completed.' body = message.get("body", b"") more_body = message.get("more_body", False) if request.method != "HEAD": raw_kwargs["body"].write(body) if not more_body: raw_kwargs["body"].seek(0) response_complete.set() elif message["type"] == "http.response.template": template = message["template"] context = message["context"] try: with self.portal_factory() as portal: > response_complete = portal.call(anyio.Event) E AttributeError: module 'anyio' has no attribute 'Event' /usr/lib/python3/dist-packages/starlette/testclient.py:262: AttributeError _______________________________ test_create_hero _______________________________ def test_create_hero(): engine = create_engine( "sqlite:///testing.db", connect_args={"check_same_thread": False} ) SQLModel.metadata.create_all(engine) with Session(engine) as session: def get_session_override(): # (2) return session # (3) app.dependency_overrides[get_session] = get_session_override # (4) client = TestClient(app) > response = client.post( "/heroes/", json={"name": "Deadpond", "secret_name": "Dive Wilson"} ) docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_002.py:22: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3/dist-packages/requests/sessions.py:590: in post return self.request('POST', url, data=data, json=json, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:468: in request return super().request( /usr/lib/python3/dist-packages/requests/sessions.py:542: in request resp = self.send(prep, **send_kwargs) /usr/lib/python3/dist-packages/requests/sessions.py:655: in send r = adapter.send(request, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:266: in send raise exc _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , args = () kwargs = {'cert': None, 'proxies': OrderedDict([('no', 'localhost'), ('https', 'https://127.0.0.1:9/'), ('http', 'http://127.0.0.1:9/')]), 'stream': False, 'timeout': None, ...} scheme = 'http', netloc = 'testserver', path = '/heroes/', query = '' fragment = '', default_port = 80, host = 'testserver', port = 80 headers = [(b'host', b'testserver'), (b'user-agent', b'testclient'), (b'accept-encoding', b'gzip, deflate'), (b'accept', b'*/*'), (b'connection', b'keep-alive'), (b'content-length', b'50'), ...] def send( self, request: requests.PreparedRequest, *args: typing.Any, **kwargs: typing.Any ) -> requests.Response: scheme, netloc, path, query, fragment = ( str(item) for item in urlsplit(request.url) ) default_port = {"http": 80, "ws": 80, "https": 443, "wss": 443}[scheme] if ":" in netloc: host, port_string = netloc.split(":", 1) port = int(port_string) else: host = netloc port = default_port # Include the 'host' header. if "host" in request.headers: headers: typing.List[typing.Tuple[bytes, bytes]] = [] elif port == default_port: headers = [(b"host", host.encode())] else: headers = [(b"host", (f"{host}:{port}").encode())] # Include other request headers. headers += [ (key.lower().encode(), value.encode()) for key, value in request.headers.items() ] if scheme in {"ws", "wss"}: subprotocol = request.headers.get("sec-websocket-protocol", None) if subprotocol is None: subprotocols: typing.Sequence[str] = [] else: subprotocols = [value.strip() for value in subprotocol.split(",")] scope = { "type": "websocket", "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "subprotocols": subprotocols, } session = WebSocketTestSession(self.app, scope, self.portal_factory) raise _Upgrade(session) scope = { "type": "http", "http_version": "1.1", "method": request.method, "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "extensions": {"http.response.template": {}}, } request_complete = False response_started = False response_complete: anyio.Event raw_kwargs: typing.Dict[str, typing.Any] = {"body": io.BytesIO()} template = None context = None async def receive() -> Message: nonlocal request_complete if request_complete: if not response_complete.is_set(): await response_complete.wait() return {"type": "http.disconnect"} body = request.body if isinstance(body, str): body_bytes: bytes = body.encode("utf-8") elif body is None: body_bytes = b"" elif isinstance(body, types.GeneratorType): try: chunk = body.send(None) if isinstance(chunk, str): chunk = chunk.encode("utf-8") return {"type": "http.request", "body": chunk, "more_body": True} except StopIteration: request_complete = True return {"type": "http.request", "body": b""} else: body_bytes = body request_complete = True return {"type": "http.request", "body": body_bytes} async def send(message: Message) -> None: nonlocal raw_kwargs, response_started, template, context if message["type"] == "http.response.start": assert ( not response_started ), 'Received multiple "http.response.start" messages.' raw_kwargs["version"] = 11 raw_kwargs["status"] = message["status"] raw_kwargs["reason"] = _get_reason_phrase(message["status"]) raw_kwargs["headers"] = [ (key.decode(), value.decode()) for key, value in message.get("headers", []) ] raw_kwargs["preload_content"] = False raw_kwargs["original_response"] = _MockOriginalResponse( raw_kwargs["headers"] ) response_started = True elif message["type"] == "http.response.body": assert ( response_started ), 'Received "http.response.body" without "http.response.start".' assert ( not response_complete.is_set() ), 'Received "http.response.body" after response completed.' body = message.get("body", b"") more_body = message.get("more_body", False) if request.method != "HEAD": raw_kwargs["body"].write(body) if not more_body: raw_kwargs["body"].seek(0) response_complete.set() elif message["type"] == "http.response.template": template = message["template"] context = message["context"] try: with self.portal_factory() as portal: > response_complete = portal.call(anyio.Event) E AttributeError: module 'anyio' has no attribute 'Event' /usr/lib/python3/dist-packages/starlette/testclient.py:262: AttributeError _______________________________ test_create_hero _______________________________ def test_create_hero(): engine = create_engine( # (2) "sqlite:///testing.db", connect_args={"check_same_thread": False} ) SQLModel.metadata.create_all(engine) # (3) with Session(engine) as session: # (4) def get_session_override(): return session # (5) app.dependency_overrides[get_session] = get_session_override # (4) client = TestClient(app) > response = client.post( "/heroes/", json={"name": "Deadpond", "secret_name": "Dive Wilson"} ) docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_003.py:22: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3/dist-packages/requests/sessions.py:590: in post return self.request('POST', url, data=data, json=json, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:468: in request return super().request( /usr/lib/python3/dist-packages/requests/sessions.py:542: in request resp = self.send(prep, **send_kwargs) /usr/lib/python3/dist-packages/requests/sessions.py:655: in send r = adapter.send(request, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:266: in send raise exc _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , args = () kwargs = {'cert': None, 'proxies': OrderedDict([('no', 'localhost'), ('https', 'https://127.0.0.1:9/'), ('http', 'http://127.0.0.1:9/')]), 'stream': False, 'timeout': None, ...} scheme = 'http', netloc = 'testserver', path = '/heroes/', query = '' fragment = '', default_port = 80, host = 'testserver', port = 80 headers = [(b'host', b'testserver'), (b'user-agent', b'testclient'), (b'accept-encoding', b'gzip, deflate'), (b'accept', b'*/*'), (b'connection', b'keep-alive'), (b'content-length', b'50'), ...] def send( self, request: requests.PreparedRequest, *args: typing.Any, **kwargs: typing.Any ) -> requests.Response: scheme, netloc, path, query, fragment = ( str(item) for item in urlsplit(request.url) ) default_port = {"http": 80, "ws": 80, "https": 443, "wss": 443}[scheme] if ":" in netloc: host, port_string = netloc.split(":", 1) port = int(port_string) else: host = netloc port = default_port # Include the 'host' header. if "host" in request.headers: headers: typing.List[typing.Tuple[bytes, bytes]] = [] elif port == default_port: headers = [(b"host", host.encode())] else: headers = [(b"host", (f"{host}:{port}").encode())] # Include other request headers. headers += [ (key.lower().encode(), value.encode()) for key, value in request.headers.items() ] if scheme in {"ws", "wss"}: subprotocol = request.headers.get("sec-websocket-protocol", None) if subprotocol is None: subprotocols: typing.Sequence[str] = [] else: subprotocols = [value.strip() for value in subprotocol.split(",")] scope = { "type": "websocket", "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "subprotocols": subprotocols, } session = WebSocketTestSession(self.app, scope, self.portal_factory) raise _Upgrade(session) scope = { "type": "http", "http_version": "1.1", "method": request.method, "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "extensions": {"http.response.template": {}}, } request_complete = False response_started = False response_complete: anyio.Event raw_kwargs: typing.Dict[str, typing.Any] = {"body": io.BytesIO()} template = None context = None async def receive() -> Message: nonlocal request_complete if request_complete: if not response_complete.is_set(): await response_complete.wait() return {"type": "http.disconnect"} body = request.body if isinstance(body, str): body_bytes: bytes = body.encode("utf-8") elif body is None: body_bytes = b"" elif isinstance(body, types.GeneratorType): try: chunk = body.send(None) if isinstance(chunk, str): chunk = chunk.encode("utf-8") return {"type": "http.request", "body": chunk, "more_body": True} except StopIteration: request_complete = True return {"type": "http.request", "body": b""} else: body_bytes = body request_complete = True return {"type": "http.request", "body": body_bytes} async def send(message: Message) -> None: nonlocal raw_kwargs, response_started, template, context if message["type"] == "http.response.start": assert ( not response_started ), 'Received multiple "http.response.start" messages.' raw_kwargs["version"] = 11 raw_kwargs["status"] = message["status"] raw_kwargs["reason"] = _get_reason_phrase(message["status"]) raw_kwargs["headers"] = [ (key.decode(), value.decode()) for key, value in message.get("headers", []) ] raw_kwargs["preload_content"] = False raw_kwargs["original_response"] = _MockOriginalResponse( raw_kwargs["headers"] ) response_started = True elif message["type"] == "http.response.body": assert ( response_started ), 'Received "http.response.body" without "http.response.start".' assert ( not response_complete.is_set() ), 'Received "http.response.body" after response completed.' body = message.get("body", b"") more_body = message.get("more_body", False) if request.method != "HEAD": raw_kwargs["body"].write(body) if not more_body: raw_kwargs["body"].seek(0) response_complete.set() elif message["type"] == "http.response.template": template = message["template"] context = message["context"] try: with self.portal_factory() as portal: > response_complete = portal.call(anyio.Event) E AttributeError: module 'anyio' has no attribute 'Event' /usr/lib/python3/dist-packages/starlette/testclient.py:262: AttributeError _______________________________ test_create_hero _______________________________ def test_create_hero(): engine = create_engine( "sqlite://", # (2) connect_args={"check_same_thread": False}, poolclass=StaticPool, # (3) ) SQLModel.metadata.create_all(engine) with Session(engine) as session: def get_session_override(): return session app.dependency_overrides[get_session] = get_session_override client = TestClient(app) > response = client.post( "/heroes/", json={"name": "Deadpond", "secret_name": "Dive Wilson"} ) docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_004.py:25: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3/dist-packages/requests/sessions.py:590: in post return self.request('POST', url, data=data, json=json, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:468: in request return super().request( /usr/lib/python3/dist-packages/requests/sessions.py:542: in request resp = self.send(prep, **send_kwargs) /usr/lib/python3/dist-packages/requests/sessions.py:655: in send r = adapter.send(request, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:266: in send raise exc _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , args = () kwargs = {'cert': None, 'proxies': OrderedDict([('no', 'localhost'), ('https', 'https://127.0.0.1:9/'), ('http', 'http://127.0.0.1:9/')]), 'stream': False, 'timeout': None, ...} scheme = 'http', netloc = 'testserver', path = '/heroes/', query = '' fragment = '', default_port = 80, host = 'testserver', port = 80 headers = [(b'host', b'testserver'), (b'user-agent', b'testclient'), (b'accept-encoding', b'gzip, deflate'), (b'accept', b'*/*'), (b'connection', b'keep-alive'), (b'content-length', b'50'), ...] def send( self, request: requests.PreparedRequest, *args: typing.Any, **kwargs: typing.Any ) -> requests.Response: scheme, netloc, path, query, fragment = ( str(item) for item in urlsplit(request.url) ) default_port = {"http": 80, "ws": 80, "https": 443, "wss": 443}[scheme] if ":" in netloc: host, port_string = netloc.split(":", 1) port = int(port_string) else: host = netloc port = default_port # Include the 'host' header. if "host" in request.headers: headers: typing.List[typing.Tuple[bytes, bytes]] = [] elif port == default_port: headers = [(b"host", host.encode())] else: headers = [(b"host", (f"{host}:{port}").encode())] # Include other request headers. headers += [ (key.lower().encode(), value.encode()) for key, value in request.headers.items() ] if scheme in {"ws", "wss"}: subprotocol = request.headers.get("sec-websocket-protocol", None) if subprotocol is None: subprotocols: typing.Sequence[str] = [] else: subprotocols = [value.strip() for value in subprotocol.split(",")] scope = { "type": "websocket", "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "subprotocols": subprotocols, } session = WebSocketTestSession(self.app, scope, self.portal_factory) raise _Upgrade(session) scope = { "type": "http", "http_version": "1.1", "method": request.method, "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "extensions": {"http.response.template": {}}, } request_complete = False response_started = False response_complete: anyio.Event raw_kwargs: typing.Dict[str, typing.Any] = {"body": io.BytesIO()} template = None context = None async def receive() -> Message: nonlocal request_complete if request_complete: if not response_complete.is_set(): await response_complete.wait() return {"type": "http.disconnect"} body = request.body if isinstance(body, str): body_bytes: bytes = body.encode("utf-8") elif body is None: body_bytes = b"" elif isinstance(body, types.GeneratorType): try: chunk = body.send(None) if isinstance(chunk, str): chunk = chunk.encode("utf-8") return {"type": "http.request", "body": chunk, "more_body": True} except StopIteration: request_complete = True return {"type": "http.request", "body": b""} else: body_bytes = body request_complete = True return {"type": "http.request", "body": body_bytes} async def send(message: Message) -> None: nonlocal raw_kwargs, response_started, template, context if message["type"] == "http.response.start": assert ( not response_started ), 'Received multiple "http.response.start" messages.' raw_kwargs["version"] = 11 raw_kwargs["status"] = message["status"] raw_kwargs["reason"] = _get_reason_phrase(message["status"]) raw_kwargs["headers"] = [ (key.decode(), value.decode()) for key, value in message.get("headers", []) ] raw_kwargs["preload_content"] = False raw_kwargs["original_response"] = _MockOriginalResponse( raw_kwargs["headers"] ) response_started = True elif message["type"] == "http.response.body": assert ( response_started ), 'Received "http.response.body" without "http.response.start".' assert ( not response_complete.is_set() ), 'Received "http.response.body" after response completed.' body = message.get("body", b"") more_body = message.get("more_body", False) if request.method != "HEAD": raw_kwargs["body"].write(body) if not more_body: raw_kwargs["body"].seek(0) response_complete.set() elif message["type"] == "http.response.template": template = message["template"] context = message["context"] try: with self.portal_factory() as portal: > response_complete = portal.call(anyio.Event) E AttributeError: module 'anyio' has no attribute 'Event' /usr/lib/python3/dist-packages/starlette/testclient.py:262: AttributeError _______________________________ test_create_hero _______________________________ session = def test_create_hero(session: Session): # (5) def get_session_override(): return session # (6) app.dependency_overrides[get_session] = get_session_override client = TestClient(app) > response = client.post( "/heroes/", json={"name": "Deadpond", "secret_name": "Dive Wilson"} ) docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_005.py:27: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3/dist-packages/requests/sessions.py:590: in post return self.request('POST', url, data=data, json=json, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:468: in request return super().request( /usr/lib/python3/dist-packages/requests/sessions.py:542: in request resp = self.send(prep, **send_kwargs) /usr/lib/python3/dist-packages/requests/sessions.py:655: in send r = adapter.send(request, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:266: in send raise exc _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , args = () kwargs = {'cert': None, 'proxies': OrderedDict([('no', 'localhost'), ('https', 'https://127.0.0.1:9/'), ('http', 'http://127.0.0.1:9/')]), 'stream': False, 'timeout': None, ...} scheme = 'http', netloc = 'testserver', path = '/heroes/', query = '' fragment = '', default_port = 80, host = 'testserver', port = 80 headers = [(b'host', b'testserver'), (b'user-agent', b'testclient'), (b'accept-encoding', b'gzip, deflate'), (b'accept', b'*/*'), (b'connection', b'keep-alive'), (b'content-length', b'50'), ...] def send( self, request: requests.PreparedRequest, *args: typing.Any, **kwargs: typing.Any ) -> requests.Response: scheme, netloc, path, query, fragment = ( str(item) for item in urlsplit(request.url) ) default_port = {"http": 80, "ws": 80, "https": 443, "wss": 443}[scheme] if ":" in netloc: host, port_string = netloc.split(":", 1) port = int(port_string) else: host = netloc port = default_port # Include the 'host' header. if "host" in request.headers: headers: typing.List[typing.Tuple[bytes, bytes]] = [] elif port == default_port: headers = [(b"host", host.encode())] else: headers = [(b"host", (f"{host}:{port}").encode())] # Include other request headers. headers += [ (key.lower().encode(), value.encode()) for key, value in request.headers.items() ] if scheme in {"ws", "wss"}: subprotocol = request.headers.get("sec-websocket-protocol", None) if subprotocol is None: subprotocols: typing.Sequence[str] = [] else: subprotocols = [value.strip() for value in subprotocol.split(",")] scope = { "type": "websocket", "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "subprotocols": subprotocols, } session = WebSocketTestSession(self.app, scope, self.portal_factory) raise _Upgrade(session) scope = { "type": "http", "http_version": "1.1", "method": request.method, "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "extensions": {"http.response.template": {}}, } request_complete = False response_started = False response_complete: anyio.Event raw_kwargs: typing.Dict[str, typing.Any] = {"body": io.BytesIO()} template = None context = None async def receive() -> Message: nonlocal request_complete if request_complete: if not response_complete.is_set(): await response_complete.wait() return {"type": "http.disconnect"} body = request.body if isinstance(body, str): body_bytes: bytes = body.encode("utf-8") elif body is None: body_bytes = b"" elif isinstance(body, types.GeneratorType): try: chunk = body.send(None) if isinstance(chunk, str): chunk = chunk.encode("utf-8") return {"type": "http.request", "body": chunk, "more_body": True} except StopIteration: request_complete = True return {"type": "http.request", "body": b""} else: body_bytes = body request_complete = True return {"type": "http.request", "body": body_bytes} async def send(message: Message) -> None: nonlocal raw_kwargs, response_started, template, context if message["type"] == "http.response.start": assert ( not response_started ), 'Received multiple "http.response.start" messages.' raw_kwargs["version"] = 11 raw_kwargs["status"] = message["status"] raw_kwargs["reason"] = _get_reason_phrase(message["status"]) raw_kwargs["headers"] = [ (key.decode(), value.decode()) for key, value in message.get("headers", []) ] raw_kwargs["preload_content"] = False raw_kwargs["original_response"] = _MockOriginalResponse( raw_kwargs["headers"] ) response_started = True elif message["type"] == "http.response.body": assert ( response_started ), 'Received "http.response.body" without "http.response.start".' assert ( not response_complete.is_set() ), 'Received "http.response.body" after response completed.' body = message.get("body", b"") more_body = message.get("more_body", False) if request.method != "HEAD": raw_kwargs["body"].write(body) if not more_body: raw_kwargs["body"].seek(0) response_complete.set() elif message["type"] == "http.response.template": template = message["template"] context = message["context"] try: with self.portal_factory() as portal: > response_complete = portal.call(anyio.Event) E AttributeError: module 'anyio' has no attribute 'Event' /usr/lib/python3/dist-packages/starlette/testclient.py:262: AttributeError _______________________________ test_create_hero _______________________________ client = def test_create_hero(client: TestClient): # (8) > response = client.post( "/heroes/", json={"name": "Deadpond", "secret_name": "Dive Wilson"} ) docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_006.py:32: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3/dist-packages/requests/sessions.py:590: in post return self.request('POST', url, data=data, json=json, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:468: in request return super().request( /usr/lib/python3/dist-packages/requests/sessions.py:542: in request resp = self.send(prep, **send_kwargs) /usr/lib/python3/dist-packages/requests/sessions.py:655: in send r = adapter.send(request, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:266: in send raise exc _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , args = () kwargs = {'cert': None, 'proxies': OrderedDict([('no', 'localhost'), ('https', 'https://127.0.0.1:9/'), ('http', 'http://127.0.0.1:9/')]), 'stream': False, 'timeout': None, ...} scheme = 'http', netloc = 'testserver', path = '/heroes/', query = '' fragment = '', default_port = 80, host = 'testserver', port = 80 headers = [(b'host', b'testserver'), (b'user-agent', b'testclient'), (b'accept-encoding', b'gzip, deflate'), (b'accept', b'*/*'), (b'connection', b'keep-alive'), (b'content-length', b'50'), ...] def send( self, request: requests.PreparedRequest, *args: typing.Any, **kwargs: typing.Any ) -> requests.Response: scheme, netloc, path, query, fragment = ( str(item) for item in urlsplit(request.url) ) default_port = {"http": 80, "ws": 80, "https": 443, "wss": 443}[scheme] if ":" in netloc: host, port_string = netloc.split(":", 1) port = int(port_string) else: host = netloc port = default_port # Include the 'host' header. if "host" in request.headers: headers: typing.List[typing.Tuple[bytes, bytes]] = [] elif port == default_port: headers = [(b"host", host.encode())] else: headers = [(b"host", (f"{host}:{port}").encode())] # Include other request headers. headers += [ (key.lower().encode(), value.encode()) for key, value in request.headers.items() ] if scheme in {"ws", "wss"}: subprotocol = request.headers.get("sec-websocket-protocol", None) if subprotocol is None: subprotocols: typing.Sequence[str] = [] else: subprotocols = [value.strip() for value in subprotocol.split(",")] scope = { "type": "websocket", "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "subprotocols": subprotocols, } session = WebSocketTestSession(self.app, scope, self.portal_factory) raise _Upgrade(session) scope = { "type": "http", "http_version": "1.1", "method": request.method, "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "extensions": {"http.response.template": {}}, } request_complete = False response_started = False response_complete: anyio.Event raw_kwargs: typing.Dict[str, typing.Any] = {"body": io.BytesIO()} template = None context = None async def receive() -> Message: nonlocal request_complete if request_complete: if not response_complete.is_set(): await response_complete.wait() return {"type": "http.disconnect"} body = request.body if isinstance(body, str): body_bytes: bytes = body.encode("utf-8") elif body is None: body_bytes = b"" elif isinstance(body, types.GeneratorType): try: chunk = body.send(None) if isinstance(chunk, str): chunk = chunk.encode("utf-8") return {"type": "http.request", "body": chunk, "more_body": True} except StopIteration: request_complete = True return {"type": "http.request", "body": b""} else: body_bytes = body request_complete = True return {"type": "http.request", "body": body_bytes} async def send(message: Message) -> None: nonlocal raw_kwargs, response_started, template, context if message["type"] == "http.response.start": assert ( not response_started ), 'Received multiple "http.response.start" messages.' raw_kwargs["version"] = 11 raw_kwargs["status"] = message["status"] raw_kwargs["reason"] = _get_reason_phrase(message["status"]) raw_kwargs["headers"] = [ (key.decode(), value.decode()) for key, value in message.get("headers", []) ] raw_kwargs["preload_content"] = False raw_kwargs["original_response"] = _MockOriginalResponse( raw_kwargs["headers"] ) response_started = True elif message["type"] == "http.response.body": assert ( response_started ), 'Received "http.response.body" without "http.response.start".' assert ( not response_complete.is_set() ), 'Received "http.response.body" after response completed.' body = message.get("body", b"") more_body = message.get("more_body", False) if request.method != "HEAD": raw_kwargs["body"].write(body) if not more_body: raw_kwargs["body"].seek(0) response_complete.set() elif message["type"] == "http.response.template": template = message["template"] context = message["context"] try: with self.portal_factory() as portal: > response_complete = portal.call(anyio.Event) E AttributeError: module 'anyio' has no attribute 'Event' /usr/lib/python3/dist-packages/starlette/testclient.py:262: AttributeError ________________________________ test_tutorial _________________________________ def test_tutorial(): > test_mod.test_create_hero() tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests001.py:18: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_001.py:22: in test_create_hero response = client.post( # (3) /usr/lib/python3/dist-packages/requests/sessions.py:590: in post return self.request('POST', url, data=data, json=json, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:468: in request return super().request( /usr/lib/python3/dist-packages/requests/sessions.py:542: in request resp = self.send(prep, **send_kwargs) /usr/lib/python3/dist-packages/requests/sessions.py:655: in send r = adapter.send(request, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:266: in send raise exc _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , args = () kwargs = {'cert': None, 'proxies': OrderedDict([('no', 'localhost'), ('https', 'https://127.0.0.1:9/'), ('http', 'http://127.0.0.1:9/')]), 'stream': False, 'timeout': None, ...} scheme = 'http', netloc = 'testserver', path = '/heroes/', query = '' fragment = '', default_port = 80, host = 'testserver', port = 80 headers = [(b'host', b'testserver'), (b'user-agent', b'testclient'), (b'accept-encoding', b'gzip, deflate'), (b'accept', b'*/*'), (b'connection', b'keep-alive'), (b'content-length', b'50'), ...] def send( self, request: requests.PreparedRequest, *args: typing.Any, **kwargs: typing.Any ) -> requests.Response: scheme, netloc, path, query, fragment = ( str(item) for item in urlsplit(request.url) ) default_port = {"http": 80, "ws": 80, "https": 443, "wss": 443}[scheme] if ":" in netloc: host, port_string = netloc.split(":", 1) port = int(port_string) else: host = netloc port = default_port # Include the 'host' header. if "host" in request.headers: headers: typing.List[typing.Tuple[bytes, bytes]] = [] elif port == default_port: headers = [(b"host", host.encode())] else: headers = [(b"host", (f"{host}:{port}").encode())] # Include other request headers. headers += [ (key.lower().encode(), value.encode()) for key, value in request.headers.items() ] if scheme in {"ws", "wss"}: subprotocol = request.headers.get("sec-websocket-protocol", None) if subprotocol is None: subprotocols: typing.Sequence[str] = [] else: subprotocols = [value.strip() for value in subprotocol.split(",")] scope = { "type": "websocket", "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "subprotocols": subprotocols, } session = WebSocketTestSession(self.app, scope, self.portal_factory) raise _Upgrade(session) scope = { "type": "http", "http_version": "1.1", "method": request.method, "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "extensions": {"http.response.template": {}}, } request_complete = False response_started = False response_complete: anyio.Event raw_kwargs: typing.Dict[str, typing.Any] = {"body": io.BytesIO()} template = None context = None async def receive() -> Message: nonlocal request_complete if request_complete: if not response_complete.is_set(): await response_complete.wait() return {"type": "http.disconnect"} body = request.body if isinstance(body, str): body_bytes: bytes = body.encode("utf-8") elif body is None: body_bytes = b"" elif isinstance(body, types.GeneratorType): try: chunk = body.send(None) if isinstance(chunk, str): chunk = chunk.encode("utf-8") return {"type": "http.request", "body": chunk, "more_body": True} except StopIteration: request_complete = True return {"type": "http.request", "body": b""} else: body_bytes = body request_complete = True return {"type": "http.request", "body": body_bytes} async def send(message: Message) -> None: nonlocal raw_kwargs, response_started, template, context if message["type"] == "http.response.start": assert ( not response_started ), 'Received multiple "http.response.start" messages.' raw_kwargs["version"] = 11 raw_kwargs["status"] = message["status"] raw_kwargs["reason"] = _get_reason_phrase(message["status"]) raw_kwargs["headers"] = [ (key.decode(), value.decode()) for key, value in message.get("headers", []) ] raw_kwargs["preload_content"] = False raw_kwargs["original_response"] = _MockOriginalResponse( raw_kwargs["headers"] ) response_started = True elif message["type"] == "http.response.body": assert ( response_started ), 'Received "http.response.body" without "http.response.start".' assert ( not response_complete.is_set() ), 'Received "http.response.body" after response completed.' body = message.get("body", b"") more_body = message.get("more_body", False) if request.method != "HEAD": raw_kwargs["body"].write(body) if not more_body: raw_kwargs["body"].seek(0) response_complete.set() elif message["type"] == "http.response.template": template = message["template"] context = message["context"] try: with self.portal_factory() as portal: > response_complete = portal.call(anyio.Event) E AttributeError: module 'anyio' has no attribute 'Event' /usr/lib/python3/dist-packages/starlette/testclient.py:262: AttributeError ________________________________ test_tutorial _________________________________ def test_tutorial(): > test_mod.test_create_hero() tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests002.py:18: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_002.py:22: in test_create_hero response = client.post( /usr/lib/python3/dist-packages/requests/sessions.py:590: in post return self.request('POST', url, data=data, json=json, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:468: in request return super().request( /usr/lib/python3/dist-packages/requests/sessions.py:542: in request resp = self.send(prep, **send_kwargs) /usr/lib/python3/dist-packages/requests/sessions.py:655: in send r = adapter.send(request, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:266: in send raise exc _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , args = () kwargs = {'cert': None, 'proxies': OrderedDict([('no', 'localhost'), ('https', 'https://127.0.0.1:9/'), ('http', 'http://127.0.0.1:9/')]), 'stream': False, 'timeout': None, ...} scheme = 'http', netloc = 'testserver', path = '/heroes/', query = '' fragment = '', default_port = 80, host = 'testserver', port = 80 headers = [(b'host', b'testserver'), (b'user-agent', b'testclient'), (b'accept-encoding', b'gzip, deflate'), (b'accept', b'*/*'), (b'connection', b'keep-alive'), (b'content-length', b'50'), ...] def send( self, request: requests.PreparedRequest, *args: typing.Any, **kwargs: typing.Any ) -> requests.Response: scheme, netloc, path, query, fragment = ( str(item) for item in urlsplit(request.url) ) default_port = {"http": 80, "ws": 80, "https": 443, "wss": 443}[scheme] if ":" in netloc: host, port_string = netloc.split(":", 1) port = int(port_string) else: host = netloc port = default_port # Include the 'host' header. if "host" in request.headers: headers: typing.List[typing.Tuple[bytes, bytes]] = [] elif port == default_port: headers = [(b"host", host.encode())] else: headers = [(b"host", (f"{host}:{port}").encode())] # Include other request headers. headers += [ (key.lower().encode(), value.encode()) for key, value in request.headers.items() ] if scheme in {"ws", "wss"}: subprotocol = request.headers.get("sec-websocket-protocol", None) if subprotocol is None: subprotocols: typing.Sequence[str] = [] else: subprotocols = [value.strip() for value in subprotocol.split(",")] scope = { "type": "websocket", "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "subprotocols": subprotocols, } session = WebSocketTestSession(self.app, scope, self.portal_factory) raise _Upgrade(session) scope = { "type": "http", "http_version": "1.1", "method": request.method, "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "extensions": {"http.response.template": {}}, } request_complete = False response_started = False response_complete: anyio.Event raw_kwargs: typing.Dict[str, typing.Any] = {"body": io.BytesIO()} template = None context = None async def receive() -> Message: nonlocal request_complete if request_complete: if not response_complete.is_set(): await response_complete.wait() return {"type": "http.disconnect"} body = request.body if isinstance(body, str): body_bytes: bytes = body.encode("utf-8") elif body is None: body_bytes = b"" elif isinstance(body, types.GeneratorType): try: chunk = body.send(None) if isinstance(chunk, str): chunk = chunk.encode("utf-8") return {"type": "http.request", "body": chunk, "more_body": True} except StopIteration: request_complete = True return {"type": "http.request", "body": b""} else: body_bytes = body request_complete = True return {"type": "http.request", "body": body_bytes} async def send(message: Message) -> None: nonlocal raw_kwargs, response_started, template, context if message["type"] == "http.response.start": assert ( not response_started ), 'Received multiple "http.response.start" messages.' raw_kwargs["version"] = 11 raw_kwargs["status"] = message["status"] raw_kwargs["reason"] = _get_reason_phrase(message["status"]) raw_kwargs["headers"] = [ (key.decode(), value.decode()) for key, value in message.get("headers", []) ] raw_kwargs["preload_content"] = False raw_kwargs["original_response"] = _MockOriginalResponse( raw_kwargs["headers"] ) response_started = True elif message["type"] == "http.response.body": assert ( response_started ), 'Received "http.response.body" without "http.response.start".' assert ( not response_complete.is_set() ), 'Received "http.response.body" after response completed.' body = message.get("body", b"") more_body = message.get("more_body", False) if request.method != "HEAD": raw_kwargs["body"].write(body) if not more_body: raw_kwargs["body"].seek(0) response_complete.set() elif message["type"] == "http.response.template": template = message["template"] context = message["context"] try: with self.portal_factory() as portal: > response_complete = portal.call(anyio.Event) E AttributeError: module 'anyio' has no attribute 'Event' /usr/lib/python3/dist-packages/starlette/testclient.py:262: AttributeError ________________________________ test_tutorial _________________________________ def test_tutorial(): > test_mod.test_create_hero() tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests003.py:18: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_003.py:22: in test_create_hero response = client.post( /usr/lib/python3/dist-packages/requests/sessions.py:590: in post return self.request('POST', url, data=data, json=json, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:468: in request return super().request( /usr/lib/python3/dist-packages/requests/sessions.py:542: in request resp = self.send(prep, **send_kwargs) /usr/lib/python3/dist-packages/requests/sessions.py:655: in send r = adapter.send(request, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:266: in send raise exc _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , args = () kwargs = {'cert': None, 'proxies': OrderedDict([('no', 'localhost'), ('https', 'https://127.0.0.1:9/'), ('http', 'http://127.0.0.1:9/')]), 'stream': False, 'timeout': None, ...} scheme = 'http', netloc = 'testserver', path = '/heroes/', query = '' fragment = '', default_port = 80, host = 'testserver', port = 80 headers = [(b'host', b'testserver'), (b'user-agent', b'testclient'), (b'accept-encoding', b'gzip, deflate'), (b'accept', b'*/*'), (b'connection', b'keep-alive'), (b'content-length', b'50'), ...] def send( self, request: requests.PreparedRequest, *args: typing.Any, **kwargs: typing.Any ) -> requests.Response: scheme, netloc, path, query, fragment = ( str(item) for item in urlsplit(request.url) ) default_port = {"http": 80, "ws": 80, "https": 443, "wss": 443}[scheme] if ":" in netloc: host, port_string = netloc.split(":", 1) port = int(port_string) else: host = netloc port = default_port # Include the 'host' header. if "host" in request.headers: headers: typing.List[typing.Tuple[bytes, bytes]] = [] elif port == default_port: headers = [(b"host", host.encode())] else: headers = [(b"host", (f"{host}:{port}").encode())] # Include other request headers. headers += [ (key.lower().encode(), value.encode()) for key, value in request.headers.items() ] if scheme in {"ws", "wss"}: subprotocol = request.headers.get("sec-websocket-protocol", None) if subprotocol is None: subprotocols: typing.Sequence[str] = [] else: subprotocols = [value.strip() for value in subprotocol.split(",")] scope = { "type": "websocket", "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "subprotocols": subprotocols, } session = WebSocketTestSession(self.app, scope, self.portal_factory) raise _Upgrade(session) scope = { "type": "http", "http_version": "1.1", "method": request.method, "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "extensions": {"http.response.template": {}}, } request_complete = False response_started = False response_complete: anyio.Event raw_kwargs: typing.Dict[str, typing.Any] = {"body": io.BytesIO()} template = None context = None async def receive() -> Message: nonlocal request_complete if request_complete: if not response_complete.is_set(): await response_complete.wait() return {"type": "http.disconnect"} body = request.body if isinstance(body, str): body_bytes: bytes = body.encode("utf-8") elif body is None: body_bytes = b"" elif isinstance(body, types.GeneratorType): try: chunk = body.send(None) if isinstance(chunk, str): chunk = chunk.encode("utf-8") return {"type": "http.request", "body": chunk, "more_body": True} except StopIteration: request_complete = True return {"type": "http.request", "body": b""} else: body_bytes = body request_complete = True return {"type": "http.request", "body": body_bytes} async def send(message: Message) -> None: nonlocal raw_kwargs, response_started, template, context if message["type"] == "http.response.start": assert ( not response_started ), 'Received multiple "http.response.start" messages.' raw_kwargs["version"] = 11 raw_kwargs["status"] = message["status"] raw_kwargs["reason"] = _get_reason_phrase(message["status"]) raw_kwargs["headers"] = [ (key.decode(), value.decode()) for key, value in message.get("headers", []) ] raw_kwargs["preload_content"] = False raw_kwargs["original_response"] = _MockOriginalResponse( raw_kwargs["headers"] ) response_started = True elif message["type"] == "http.response.body": assert ( response_started ), 'Received "http.response.body" without "http.response.start".' assert ( not response_complete.is_set() ), 'Received "http.response.body" after response completed.' body = message.get("body", b"") more_body = message.get("more_body", False) if request.method != "HEAD": raw_kwargs["body"].write(body) if not more_body: raw_kwargs["body"].seek(0) response_complete.set() elif message["type"] == "http.response.template": template = message["template"] context = message["context"] try: with self.portal_factory() as portal: > response_complete = portal.call(anyio.Event) E AttributeError: module 'anyio' has no attribute 'Event' /usr/lib/python3/dist-packages/starlette/testclient.py:262: AttributeError ________________________________ test_tutorial _________________________________ def test_tutorial(): > test_mod.test_create_hero() tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests004.py:18: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_004.py:25: in test_create_hero response = client.post( /usr/lib/python3/dist-packages/requests/sessions.py:590: in post return self.request('POST', url, data=data, json=json, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:468: in request return super().request( /usr/lib/python3/dist-packages/requests/sessions.py:542: in request resp = self.send(prep, **send_kwargs) /usr/lib/python3/dist-packages/requests/sessions.py:655: in send r = adapter.send(request, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:266: in send raise exc _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , args = () kwargs = {'cert': None, 'proxies': OrderedDict([('no', 'localhost'), ('https', 'https://127.0.0.1:9/'), ('http', 'http://127.0.0.1:9/')]), 'stream': False, 'timeout': None, ...} scheme = 'http', netloc = 'testserver', path = '/heroes/', query = '' fragment = '', default_port = 80, host = 'testserver', port = 80 headers = [(b'host', b'testserver'), (b'user-agent', b'testclient'), (b'accept-encoding', b'gzip, deflate'), (b'accept', b'*/*'), (b'connection', b'keep-alive'), (b'content-length', b'50'), ...] def send( self, request: requests.PreparedRequest, *args: typing.Any, **kwargs: typing.Any ) -> requests.Response: scheme, netloc, path, query, fragment = ( str(item) for item in urlsplit(request.url) ) default_port = {"http": 80, "ws": 80, "https": 443, "wss": 443}[scheme] if ":" in netloc: host, port_string = netloc.split(":", 1) port = int(port_string) else: host = netloc port = default_port # Include the 'host' header. if "host" in request.headers: headers: typing.List[typing.Tuple[bytes, bytes]] = [] elif port == default_port: headers = [(b"host", host.encode())] else: headers = [(b"host", (f"{host}:{port}").encode())] # Include other request headers. headers += [ (key.lower().encode(), value.encode()) for key, value in request.headers.items() ] if scheme in {"ws", "wss"}: subprotocol = request.headers.get("sec-websocket-protocol", None) if subprotocol is None: subprotocols: typing.Sequence[str] = [] else: subprotocols = [value.strip() for value in subprotocol.split(",")] scope = { "type": "websocket", "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "subprotocols": subprotocols, } session = WebSocketTestSession(self.app, scope, self.portal_factory) raise _Upgrade(session) scope = { "type": "http", "http_version": "1.1", "method": request.method, "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "extensions": {"http.response.template": {}}, } request_complete = False response_started = False response_complete: anyio.Event raw_kwargs: typing.Dict[str, typing.Any] = {"body": io.BytesIO()} template = None context = None async def receive() -> Message: nonlocal request_complete if request_complete: if not response_complete.is_set(): await response_complete.wait() return {"type": "http.disconnect"} body = request.body if isinstance(body, str): body_bytes: bytes = body.encode("utf-8") elif body is None: body_bytes = b"" elif isinstance(body, types.GeneratorType): try: chunk = body.send(None) if isinstance(chunk, str): chunk = chunk.encode("utf-8") return {"type": "http.request", "body": chunk, "more_body": True} except StopIteration: request_complete = True return {"type": "http.request", "body": b""} else: body_bytes = body request_complete = True return {"type": "http.request", "body": body_bytes} async def send(message: Message) -> None: nonlocal raw_kwargs, response_started, template, context if message["type"] == "http.response.start": assert ( not response_started ), 'Received multiple "http.response.start" messages.' raw_kwargs["version"] = 11 raw_kwargs["status"] = message["status"] raw_kwargs["reason"] = _get_reason_phrase(message["status"]) raw_kwargs["headers"] = [ (key.decode(), value.decode()) for key, value in message.get("headers", []) ] raw_kwargs["preload_content"] = False raw_kwargs["original_response"] = _MockOriginalResponse( raw_kwargs["headers"] ) response_started = True elif message["type"] == "http.response.body": assert ( response_started ), 'Received "http.response.body" without "http.response.start".' assert ( not response_complete.is_set() ), 'Received "http.response.body" after response completed.' body = message.get("body", b"") more_body = message.get("more_body", False) if request.method != "HEAD": raw_kwargs["body"].write(body) if not more_body: raw_kwargs["body"].seek(0) response_complete.set() elif message["type"] == "http.response.template": template = message["template"] context = message["context"] try: with self.portal_factory() as portal: > response_complete = portal.call(anyio.Event) E AttributeError: module 'anyio' has no attribute 'Event' /usr/lib/python3/dist-packages/starlette/testclient.py:262: AttributeError ________________________________ test_tutorial _________________________________ prepare = None session = def test_tutorial(prepare, session: Session): > test_mod.test_create_hero(session) tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests005.py:24: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_005.py:27: in test_create_hero response = client.post( /usr/lib/python3/dist-packages/requests/sessions.py:590: in post return self.request('POST', url, data=data, json=json, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:468: in request return super().request( /usr/lib/python3/dist-packages/requests/sessions.py:542: in request resp = self.send(prep, **send_kwargs) /usr/lib/python3/dist-packages/requests/sessions.py:655: in send r = adapter.send(request, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:266: in send raise exc _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , args = () kwargs = {'cert': None, 'proxies': OrderedDict([('no', 'localhost'), ('https', 'https://127.0.0.1:9/'), ('http', 'http://127.0.0.1:9/')]), 'stream': False, 'timeout': None, ...} scheme = 'http', netloc = 'testserver', path = '/heroes/', query = '' fragment = '', default_port = 80, host = 'testserver', port = 80 headers = [(b'host', b'testserver'), (b'user-agent', b'testclient'), (b'accept-encoding', b'gzip, deflate'), (b'accept', b'*/*'), (b'connection', b'keep-alive'), (b'content-length', b'50'), ...] def send( self, request: requests.PreparedRequest, *args: typing.Any, **kwargs: typing.Any ) -> requests.Response: scheme, netloc, path, query, fragment = ( str(item) for item in urlsplit(request.url) ) default_port = {"http": 80, "ws": 80, "https": 443, "wss": 443}[scheme] if ":" in netloc: host, port_string = netloc.split(":", 1) port = int(port_string) else: host = netloc port = default_port # Include the 'host' header. if "host" in request.headers: headers: typing.List[typing.Tuple[bytes, bytes]] = [] elif port == default_port: headers = [(b"host", host.encode())] else: headers = [(b"host", (f"{host}:{port}").encode())] # Include other request headers. headers += [ (key.lower().encode(), value.encode()) for key, value in request.headers.items() ] if scheme in {"ws", "wss"}: subprotocol = request.headers.get("sec-websocket-protocol", None) if subprotocol is None: subprotocols: typing.Sequence[str] = [] else: subprotocols = [value.strip() for value in subprotocol.split(",")] scope = { "type": "websocket", "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "subprotocols": subprotocols, } session = WebSocketTestSession(self.app, scope, self.portal_factory) raise _Upgrade(session) scope = { "type": "http", "http_version": "1.1", "method": request.method, "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "extensions": {"http.response.template": {}}, } request_complete = False response_started = False response_complete: anyio.Event raw_kwargs: typing.Dict[str, typing.Any] = {"body": io.BytesIO()} template = None context = None async def receive() -> Message: nonlocal request_complete if request_complete: if not response_complete.is_set(): await response_complete.wait() return {"type": "http.disconnect"} body = request.body if isinstance(body, str): body_bytes: bytes = body.encode("utf-8") elif body is None: body_bytes = b"" elif isinstance(body, types.GeneratorType): try: chunk = body.send(None) if isinstance(chunk, str): chunk = chunk.encode("utf-8") return {"type": "http.request", "body": chunk, "more_body": True} except StopIteration: request_complete = True return {"type": "http.request", "body": b""} else: body_bytes = body request_complete = True return {"type": "http.request", "body": body_bytes} async def send(message: Message) -> None: nonlocal raw_kwargs, response_started, template, context if message["type"] == "http.response.start": assert ( not response_started ), 'Received multiple "http.response.start" messages.' raw_kwargs["version"] = 11 raw_kwargs["status"] = message["status"] raw_kwargs["reason"] = _get_reason_phrase(message["status"]) raw_kwargs["headers"] = [ (key.decode(), value.decode()) for key, value in message.get("headers", []) ] raw_kwargs["preload_content"] = False raw_kwargs["original_response"] = _MockOriginalResponse( raw_kwargs["headers"] ) response_started = True elif message["type"] == "http.response.body": assert ( response_started ), 'Received "http.response.body" without "http.response.start".' assert ( not response_complete.is_set() ), 'Received "http.response.body" after response completed.' body = message.get("body", b"") more_body = message.get("more_body", False) if request.method != "HEAD": raw_kwargs["body"].write(body) if not more_body: raw_kwargs["body"].seek(0) response_complete.set() elif message["type"] == "http.response.template": template = message["template"] context = message["context"] try: with self.portal_factory() as portal: > response_complete = portal.call(anyio.Event) E AttributeError: module 'anyio' has no attribute 'Event' /usr/lib/python3/dist-packages/starlette/testclient.py:262: AttributeError ________________________________ test_tutorial _________________________________ prepare = None session = client = def test_tutorial(prepare, session: Session, client: TestClient): > test_mod.test_create_hero(client) tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests006.py:27: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_006.py:32: in test_create_hero response = client.post( /usr/lib/python3/dist-packages/requests/sessions.py:590: in post return self.request('POST', url, data=data, json=json, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:468: in request return super().request( /usr/lib/python3/dist-packages/requests/sessions.py:542: in request resp = self.send(prep, **send_kwargs) /usr/lib/python3/dist-packages/requests/sessions.py:655: in send r = adapter.send(request, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:266: in send raise exc _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , args = () kwargs = {'cert': None, 'proxies': OrderedDict([('no', 'localhost'), ('https', 'https://127.0.0.1:9/'), ('http', 'http://127.0.0.1:9/')]), 'stream': False, 'timeout': None, ...} scheme = 'http', netloc = 'testserver', path = '/heroes/', query = '' fragment = '', default_port = 80, host = 'testserver', port = 80 headers = [(b'host', b'testserver'), (b'user-agent', b'testclient'), (b'accept-encoding', b'gzip, deflate'), (b'accept', b'*/*'), (b'connection', b'keep-alive'), (b'content-length', b'50'), ...] def send( self, request: requests.PreparedRequest, *args: typing.Any, **kwargs: typing.Any ) -> requests.Response: scheme, netloc, path, query, fragment = ( str(item) for item in urlsplit(request.url) ) default_port = {"http": 80, "ws": 80, "https": 443, "wss": 443}[scheme] if ":" in netloc: host, port_string = netloc.split(":", 1) port = int(port_string) else: host = netloc port = default_port # Include the 'host' header. if "host" in request.headers: headers: typing.List[typing.Tuple[bytes, bytes]] = [] elif port == default_port: headers = [(b"host", host.encode())] else: headers = [(b"host", (f"{host}:{port}").encode())] # Include other request headers. headers += [ (key.lower().encode(), value.encode()) for key, value in request.headers.items() ] if scheme in {"ws", "wss"}: subprotocol = request.headers.get("sec-websocket-protocol", None) if subprotocol is None: subprotocols: typing.Sequence[str] = [] else: subprotocols = [value.strip() for value in subprotocol.split(",")] scope = { "type": "websocket", "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "subprotocols": subprotocols, } session = WebSocketTestSession(self.app, scope, self.portal_factory) raise _Upgrade(session) scope = { "type": "http", "http_version": "1.1", "method": request.method, "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "extensions": {"http.response.template": {}}, } request_complete = False response_started = False response_complete: anyio.Event raw_kwargs: typing.Dict[str, typing.Any] = {"body": io.BytesIO()} template = None context = None async def receive() -> Message: nonlocal request_complete if request_complete: if not response_complete.is_set(): await response_complete.wait() return {"type": "http.disconnect"} body = request.body if isinstance(body, str): body_bytes: bytes = body.encode("utf-8") elif body is None: body_bytes = b"" elif isinstance(body, types.GeneratorType): try: chunk = body.send(None) if isinstance(chunk, str): chunk = chunk.encode("utf-8") return {"type": "http.request", "body": chunk, "more_body": True} except StopIteration: request_complete = True return {"type": "http.request", "body": b""} else: body_bytes = body request_complete = True return {"type": "http.request", "body": body_bytes} async def send(message: Message) -> None: nonlocal raw_kwargs, response_started, template, context if message["type"] == "http.response.start": assert ( not response_started ), 'Received multiple "http.response.start" messages.' raw_kwargs["version"] = 11 raw_kwargs["status"] = message["status"] raw_kwargs["reason"] = _get_reason_phrase(message["status"]) raw_kwargs["headers"] = [ (key.decode(), value.decode()) for key, value in message.get("headers", []) ] raw_kwargs["preload_content"] = False raw_kwargs["original_response"] = _MockOriginalResponse( raw_kwargs["headers"] ) response_started = True elif message["type"] == "http.response.body": assert ( response_started ), 'Received "http.response.body" without "http.response.start".' assert ( not response_complete.is_set() ), 'Received "http.response.body" after response completed.' body = message.get("body", b"") more_body = message.get("more_body", False) if request.method != "HEAD": raw_kwargs["body"].write(body) if not more_body: raw_kwargs["body"].seek(0) response_complete.set() elif message["type"] == "http.response.template": template = message["template"] context = message["context"] try: with self.portal_factory() as portal: > response_complete = portal.call(anyio.Event) E AttributeError: module 'anyio' has no attribute 'Event' /usr/lib/python3/dist-packages/starlette/testclient.py:262: AttributeError _______________________________ test_create_hero _______________________________ session = client = def test_create_hero(session: Session, client: TestClient): > test_mod.test_create_hero(client) tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests_main.py:30: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ docs_src/tutorial/fastapi/app_testing/tutorial001/test_main.py:31: in test_create_hero response = client.post( /usr/lib/python3/dist-packages/requests/sessions.py:590: in post return self.request('POST', url, data=data, json=json, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:468: in request return super().request( /usr/lib/python3/dist-packages/requests/sessions.py:542: in request resp = self.send(prep, **send_kwargs) /usr/lib/python3/dist-packages/requests/sessions.py:655: in send r = adapter.send(request, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:266: in send raise exc _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , args = () kwargs = {'cert': None, 'proxies': OrderedDict([('no', 'localhost'), ('https', 'https://127.0.0.1:9/'), ('http', 'http://127.0.0.1:9/')]), 'stream': False, 'timeout': None, ...} scheme = 'http', netloc = 'testserver', path = '/heroes/', query = '' fragment = '', default_port = 80, host = 'testserver', port = 80 headers = [(b'host', b'testserver'), (b'user-agent', b'testclient'), (b'accept-encoding', b'gzip, deflate'), (b'accept', b'*/*'), (b'connection', b'keep-alive'), (b'content-length', b'50'), ...] def send( self, request: requests.PreparedRequest, *args: typing.Any, **kwargs: typing.Any ) -> requests.Response: scheme, netloc, path, query, fragment = ( str(item) for item in urlsplit(request.url) ) default_port = {"http": 80, "ws": 80, "https": 443, "wss": 443}[scheme] if ":" in netloc: host, port_string = netloc.split(":", 1) port = int(port_string) else: host = netloc port = default_port # Include the 'host' header. if "host" in request.headers: headers: typing.List[typing.Tuple[bytes, bytes]] = [] elif port == default_port: headers = [(b"host", host.encode())] else: headers = [(b"host", (f"{host}:{port}").encode())] # Include other request headers. headers += [ (key.lower().encode(), value.encode()) for key, value in request.headers.items() ] if scheme in {"ws", "wss"}: subprotocol = request.headers.get("sec-websocket-protocol", None) if subprotocol is None: subprotocols: typing.Sequence[str] = [] else: subprotocols = [value.strip() for value in subprotocol.split(",")] scope = { "type": "websocket", "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "subprotocols": subprotocols, } session = WebSocketTestSession(self.app, scope, self.portal_factory) raise _Upgrade(session) scope = { "type": "http", "http_version": "1.1", "method": request.method, "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "extensions": {"http.response.template": {}}, } request_complete = False response_started = False response_complete: anyio.Event raw_kwargs: typing.Dict[str, typing.Any] = {"body": io.BytesIO()} template = None context = None async def receive() -> Message: nonlocal request_complete if request_complete: if not response_complete.is_set(): await response_complete.wait() return {"type": "http.disconnect"} body = request.body if isinstance(body, str): body_bytes: bytes = body.encode("utf-8") elif body is None: body_bytes = b"" elif isinstance(body, types.GeneratorType): try: chunk = body.send(None) if isinstance(chunk, str): chunk = chunk.encode("utf-8") return {"type": "http.request", "body": chunk, "more_body": True} except StopIteration: request_complete = True return {"type": "http.request", "body": b""} else: body_bytes = body request_complete = True return {"type": "http.request", "body": body_bytes} async def send(message: Message) -> None: nonlocal raw_kwargs, response_started, template, context if message["type"] == "http.response.start": assert ( not response_started ), 'Received multiple "http.response.start" messages.' raw_kwargs["version"] = 11 raw_kwargs["status"] = message["status"] raw_kwargs["reason"] = _get_reason_phrase(message["status"]) raw_kwargs["headers"] = [ (key.decode(), value.decode()) for key, value in message.get("headers", []) ] raw_kwargs["preload_content"] = False raw_kwargs["original_response"] = _MockOriginalResponse( raw_kwargs["headers"] ) response_started = True elif message["type"] == "http.response.body": assert ( response_started ), 'Received "http.response.body" without "http.response.start".' assert ( not response_complete.is_set() ), 'Received "http.response.body" after response completed.' body = message.get("body", b"") more_body = message.get("more_body", False) if request.method != "HEAD": raw_kwargs["body"].write(body) if not more_body: raw_kwargs["body"].seek(0) response_complete.set() elif message["type"] == "http.response.template": template = message["template"] context = message["context"] try: with self.portal_factory() as portal: > response_complete = portal.call(anyio.Event) E AttributeError: module 'anyio' has no attribute 'Event' /usr/lib/python3/dist-packages/starlette/testclient.py:262: AttributeError _________________________ test_create_hero_incomplete __________________________ session = client = def test_create_hero_incomplete(session: Session, client: TestClient): > test_mod.test_create_hero_incomplete(client) tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests_main.py:34: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ docs_src/tutorial/fastapi/app_testing/tutorial001/test_main.py:45: in test_create_hero_incomplete response = client.post("/heroes/", json={"name": "Deadpond"}) /usr/lib/python3/dist-packages/requests/sessions.py:590: in post return self.request('POST', url, data=data, json=json, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:468: in request return super().request( /usr/lib/python3/dist-packages/requests/sessions.py:542: in request resp = self.send(prep, **send_kwargs) /usr/lib/python3/dist-packages/requests/sessions.py:655: in send r = adapter.send(request, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:266: in send raise exc _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , args = () kwargs = {'cert': None, 'proxies': OrderedDict([('no', 'localhost'), ('https', 'https://127.0.0.1:9/'), ('http', 'http://127.0.0.1:9/')]), 'stream': False, 'timeout': None, ...} scheme = 'http', netloc = 'testserver', path = '/heroes/', query = '' fragment = '', default_port = 80, host = 'testserver', port = 80 headers = [(b'host', b'testserver'), (b'user-agent', b'testclient'), (b'accept-encoding', b'gzip, deflate'), (b'accept', b'*/*'), (b'connection', b'keep-alive'), (b'content-length', b'20'), ...] def send( self, request: requests.PreparedRequest, *args: typing.Any, **kwargs: typing.Any ) -> requests.Response: scheme, netloc, path, query, fragment = ( str(item) for item in urlsplit(request.url) ) default_port = {"http": 80, "ws": 80, "https": 443, "wss": 443}[scheme] if ":" in netloc: host, port_string = netloc.split(":", 1) port = int(port_string) else: host = netloc port = default_port # Include the 'host' header. if "host" in request.headers: headers: typing.List[typing.Tuple[bytes, bytes]] = [] elif port == default_port: headers = [(b"host", host.encode())] else: headers = [(b"host", (f"{host}:{port}").encode())] # Include other request headers. headers += [ (key.lower().encode(), value.encode()) for key, value in request.headers.items() ] if scheme in {"ws", "wss"}: subprotocol = request.headers.get("sec-websocket-protocol", None) if subprotocol is None: subprotocols: typing.Sequence[str] = [] else: subprotocols = [value.strip() for value in subprotocol.split(",")] scope = { "type": "websocket", "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "subprotocols": subprotocols, } session = WebSocketTestSession(self.app, scope, self.portal_factory) raise _Upgrade(session) scope = { "type": "http", "http_version": "1.1", "method": request.method, "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "extensions": {"http.response.template": {}}, } request_complete = False response_started = False response_complete: anyio.Event raw_kwargs: typing.Dict[str, typing.Any] = {"body": io.BytesIO()} template = None context = None async def receive() -> Message: nonlocal request_complete if request_complete: if not response_complete.is_set(): await response_complete.wait() return {"type": "http.disconnect"} body = request.body if isinstance(body, str): body_bytes: bytes = body.encode("utf-8") elif body is None: body_bytes = b"" elif isinstance(body, types.GeneratorType): try: chunk = body.send(None) if isinstance(chunk, str): chunk = chunk.encode("utf-8") return {"type": "http.request", "body": chunk, "more_body": True} except StopIteration: request_complete = True return {"type": "http.request", "body": b""} else: body_bytes = body request_complete = True return {"type": "http.request", "body": body_bytes} async def send(message: Message) -> None: nonlocal raw_kwargs, response_started, template, context if message["type"] == "http.response.start": assert ( not response_started ), 'Received multiple "http.response.start" messages.' raw_kwargs["version"] = 11 raw_kwargs["status"] = message["status"] raw_kwargs["reason"] = _get_reason_phrase(message["status"]) raw_kwargs["headers"] = [ (key.decode(), value.decode()) for key, value in message.get("headers", []) ] raw_kwargs["preload_content"] = False raw_kwargs["original_response"] = _MockOriginalResponse( raw_kwargs["headers"] ) response_started = True elif message["type"] == "http.response.body": assert ( response_started ), 'Received "http.response.body" without "http.response.start".' assert ( not response_complete.is_set() ), 'Received "http.response.body" after response completed.' body = message.get("body", b"") more_body = message.get("more_body", False) if request.method != "HEAD": raw_kwargs["body"].write(body) if not more_body: raw_kwargs["body"].seek(0) response_complete.set() elif message["type"] == "http.response.template": template = message["template"] context = message["context"] try: with self.portal_factory() as portal: > response_complete = portal.call(anyio.Event) E AttributeError: module 'anyio' has no attribute 'Event' /usr/lib/python3/dist-packages/starlette/testclient.py:262: AttributeError ___________________________ test_create_hero_invalid ___________________________ session = client = def test_create_hero_invalid(session: Session, client: TestClient): > test_mod.test_create_hero_invalid(client) tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests_main.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ docs_src/tutorial/fastapi/app_testing/tutorial001/test_main.py:51: in test_create_hero_invalid response = client.post( /usr/lib/python3/dist-packages/requests/sessions.py:590: in post return self.request('POST', url, data=data, json=json, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:468: in request return super().request( /usr/lib/python3/dist-packages/requests/sessions.py:542: in request resp = self.send(prep, **send_kwargs) /usr/lib/python3/dist-packages/requests/sessions.py:655: in send r = adapter.send(request, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:266: in send raise exc _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , args = () kwargs = {'cert': None, 'proxies': OrderedDict([('no', 'localhost'), ('https', 'https://127.0.0.1:9/'), ('http', 'http://127.0.0.1:9/')]), 'stream': False, 'timeout': None, ...} scheme = 'http', netloc = 'testserver', path = '/heroes/', query = '' fragment = '', default_port = 80, host = 'testserver', port = 80 headers = [(b'host', b'testserver'), (b'user-agent', b'testclient'), (b'accept-encoding', b'gzip, deflate'), (b'accept', b'*/*'), (b'connection', b'keep-alive'), (b'content-length', b'89'), ...] def send( self, request: requests.PreparedRequest, *args: typing.Any, **kwargs: typing.Any ) -> requests.Response: scheme, netloc, path, query, fragment = ( str(item) for item in urlsplit(request.url) ) default_port = {"http": 80, "ws": 80, "https": 443, "wss": 443}[scheme] if ":" in netloc: host, port_string = netloc.split(":", 1) port = int(port_string) else: host = netloc port = default_port # Include the 'host' header. if "host" in request.headers: headers: typing.List[typing.Tuple[bytes, bytes]] = [] elif port == default_port: headers = [(b"host", host.encode())] else: headers = [(b"host", (f"{host}:{port}").encode())] # Include other request headers. headers += [ (key.lower().encode(), value.encode()) for key, value in request.headers.items() ] if scheme in {"ws", "wss"}: subprotocol = request.headers.get("sec-websocket-protocol", None) if subprotocol is None: subprotocols: typing.Sequence[str] = [] else: subprotocols = [value.strip() for value in subprotocol.split(",")] scope = { "type": "websocket", "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "subprotocols": subprotocols, } session = WebSocketTestSession(self.app, scope, self.portal_factory) raise _Upgrade(session) scope = { "type": "http", "http_version": "1.1", "method": request.method, "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "extensions": {"http.response.template": {}}, } request_complete = False response_started = False response_complete: anyio.Event raw_kwargs: typing.Dict[str, typing.Any] = {"body": io.BytesIO()} template = None context = None async def receive() -> Message: nonlocal request_complete if request_complete: if not response_complete.is_set(): await response_complete.wait() return {"type": "http.disconnect"} body = request.body if isinstance(body, str): body_bytes: bytes = body.encode("utf-8") elif body is None: body_bytes = b"" elif isinstance(body, types.GeneratorType): try: chunk = body.send(None) if isinstance(chunk, str): chunk = chunk.encode("utf-8") return {"type": "http.request", "body": chunk, "more_body": True} except StopIteration: request_complete = True return {"type": "http.request", "body": b""} else: body_bytes = body request_complete = True return {"type": "http.request", "body": body_bytes} async def send(message: Message) -> None: nonlocal raw_kwargs, response_started, template, context if message["type"] == "http.response.start": assert ( not response_started ), 'Received multiple "http.response.start" messages.' raw_kwargs["version"] = 11 raw_kwargs["status"] = message["status"] raw_kwargs["reason"] = _get_reason_phrase(message["status"]) raw_kwargs["headers"] = [ (key.decode(), value.decode()) for key, value in message.get("headers", []) ] raw_kwargs["preload_content"] = False raw_kwargs["original_response"] = _MockOriginalResponse( raw_kwargs["headers"] ) response_started = True elif message["type"] == "http.response.body": assert ( response_started ), 'Received "http.response.body" without "http.response.start".' assert ( not response_complete.is_set() ), 'Received "http.response.body" after response completed.' body = message.get("body", b"") more_body = message.get("more_body", False) if request.method != "HEAD": raw_kwargs["body"].write(body) if not more_body: raw_kwargs["body"].seek(0) response_complete.set() elif message["type"] == "http.response.template": template = message["template"] context = message["context"] try: with self.portal_factory() as portal: > response_complete = portal.call(anyio.Event) E AttributeError: module 'anyio' has no attribute 'Event' /usr/lib/python3/dist-packages/starlette/testclient.py:262: AttributeError _______________________________ test_read_heroes _______________________________ session = client = def test_read_heroes(session: Session, client: TestClient): > test_mod.test_read_heroes(session=session, client=client) tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests_main.py:42: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ docs_src/tutorial/fastapi/app_testing/tutorial001/test_main.py:68: in test_read_heroes response = client.get("/heroes/") /usr/lib/python3/dist-packages/requests/sessions.py:555: in get return self.request('GET', url, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:468: in request return super().request( /usr/lib/python3/dist-packages/requests/sessions.py:542: in request resp = self.send(prep, **send_kwargs) /usr/lib/python3/dist-packages/requests/sessions.py:655: in send r = adapter.send(request, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:266: in send raise exc _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , args = () kwargs = {'cert': None, 'proxies': OrderedDict([('no', 'localhost'), ('https', 'https://127.0.0.1:9/'), ('http', 'http://127.0.0.1:9/')]), 'stream': False, 'timeout': None, ...} scheme = 'http', netloc = 'testserver', path = '/heroes/', query = '' fragment = '', default_port = 80, host = 'testserver', port = 80 headers = [(b'host', b'testserver'), (b'user-agent', b'testclient'), (b'accept-encoding', b'gzip, deflate'), (b'accept', b'*/*'), (b'connection', b'keep-alive')] def send( self, request: requests.PreparedRequest, *args: typing.Any, **kwargs: typing.Any ) -> requests.Response: scheme, netloc, path, query, fragment = ( str(item) for item in urlsplit(request.url) ) default_port = {"http": 80, "ws": 80, "https": 443, "wss": 443}[scheme] if ":" in netloc: host, port_string = netloc.split(":", 1) port = int(port_string) else: host = netloc port = default_port # Include the 'host' header. if "host" in request.headers: headers: typing.List[typing.Tuple[bytes, bytes]] = [] elif port == default_port: headers = [(b"host", host.encode())] else: headers = [(b"host", (f"{host}:{port}").encode())] # Include other request headers. headers += [ (key.lower().encode(), value.encode()) for key, value in request.headers.items() ] if scheme in {"ws", "wss"}: subprotocol = request.headers.get("sec-websocket-protocol", None) if subprotocol is None: subprotocols: typing.Sequence[str] = [] else: subprotocols = [value.strip() for value in subprotocol.split(",")] scope = { "type": "websocket", "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "subprotocols": subprotocols, } session = WebSocketTestSession(self.app, scope, self.portal_factory) raise _Upgrade(session) scope = { "type": "http", "http_version": "1.1", "method": request.method, "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "extensions": {"http.response.template": {}}, } request_complete = False response_started = False response_complete: anyio.Event raw_kwargs: typing.Dict[str, typing.Any] = {"body": io.BytesIO()} template = None context = None async def receive() -> Message: nonlocal request_complete if request_complete: if not response_complete.is_set(): await response_complete.wait() return {"type": "http.disconnect"} body = request.body if isinstance(body, str): body_bytes: bytes = body.encode("utf-8") elif body is None: body_bytes = b"" elif isinstance(body, types.GeneratorType): try: chunk = body.send(None) if isinstance(chunk, str): chunk = chunk.encode("utf-8") return {"type": "http.request", "body": chunk, "more_body": True} except StopIteration: request_complete = True return {"type": "http.request", "body": b""} else: body_bytes = body request_complete = True return {"type": "http.request", "body": body_bytes} async def send(message: Message) -> None: nonlocal raw_kwargs, response_started, template, context if message["type"] == "http.response.start": assert ( not response_started ), 'Received multiple "http.response.start" messages.' raw_kwargs["version"] = 11 raw_kwargs["status"] = message["status"] raw_kwargs["reason"] = _get_reason_phrase(message["status"]) raw_kwargs["headers"] = [ (key.decode(), value.decode()) for key, value in message.get("headers", []) ] raw_kwargs["preload_content"] = False raw_kwargs["original_response"] = _MockOriginalResponse( raw_kwargs["headers"] ) response_started = True elif message["type"] == "http.response.body": assert ( response_started ), 'Received "http.response.body" without "http.response.start".' assert ( not response_complete.is_set() ), 'Received "http.response.body" after response completed.' body = message.get("body", b"") more_body = message.get("more_body", False) if request.method != "HEAD": raw_kwargs["body"].write(body) if not more_body: raw_kwargs["body"].seek(0) response_complete.set() elif message["type"] == "http.response.template": template = message["template"] context = message["context"] try: with self.portal_factory() as portal: > response_complete = portal.call(anyio.Event) E AttributeError: module 'anyio' has no attribute 'Event' /usr/lib/python3/dist-packages/starlette/testclient.py:262: AttributeError ________________________________ test_read_hero ________________________________ session = client = def test_read_hero(session: Session, client: TestClient): > test_mod.test_read_hero(session=session, client=client) tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests_main.py:46: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ docs_src/tutorial/fastapi/app_testing/tutorial001/test_main.py:89: in test_read_hero response = client.get(f"/heroes/{hero_1.id}") /usr/lib/python3/dist-packages/requests/sessions.py:555: in get return self.request('GET', url, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:468: in request return super().request( /usr/lib/python3/dist-packages/requests/sessions.py:542: in request resp = self.send(prep, **send_kwargs) /usr/lib/python3/dist-packages/requests/sessions.py:655: in send r = adapter.send(request, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:266: in send raise exc _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , args = () kwargs = {'cert': None, 'proxies': OrderedDict([('no', 'localhost'), ('https', 'https://127.0.0.1:9/'), ('http', 'http://127.0.0.1:9/')]), 'stream': False, 'timeout': None, ...} scheme = 'http', netloc = 'testserver', path = '/heroes/1', query = '' fragment = '', default_port = 80, host = 'testserver', port = 80 headers = [(b'host', b'testserver'), (b'user-agent', b'testclient'), (b'accept-encoding', b'gzip, deflate'), (b'accept', b'*/*'), (b'connection', b'keep-alive')] def send( self, request: requests.PreparedRequest, *args: typing.Any, **kwargs: typing.Any ) -> requests.Response: scheme, netloc, path, query, fragment = ( str(item) for item in urlsplit(request.url) ) default_port = {"http": 80, "ws": 80, "https": 443, "wss": 443}[scheme] if ":" in netloc: host, port_string = netloc.split(":", 1) port = int(port_string) else: host = netloc port = default_port # Include the 'host' header. if "host" in request.headers: headers: typing.List[typing.Tuple[bytes, bytes]] = [] elif port == default_port: headers = [(b"host", host.encode())] else: headers = [(b"host", (f"{host}:{port}").encode())] # Include other request headers. headers += [ (key.lower().encode(), value.encode()) for key, value in request.headers.items() ] if scheme in {"ws", "wss"}: subprotocol = request.headers.get("sec-websocket-protocol", None) if subprotocol is None: subprotocols: typing.Sequence[str] = [] else: subprotocols = [value.strip() for value in subprotocol.split(",")] scope = { "type": "websocket", "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "subprotocols": subprotocols, } session = WebSocketTestSession(self.app, scope, self.portal_factory) raise _Upgrade(session) scope = { "type": "http", "http_version": "1.1", "method": request.method, "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "extensions": {"http.response.template": {}}, } request_complete = False response_started = False response_complete: anyio.Event raw_kwargs: typing.Dict[str, typing.Any] = {"body": io.BytesIO()} template = None context = None async def receive() -> Message: nonlocal request_complete if request_complete: if not response_complete.is_set(): await response_complete.wait() return {"type": "http.disconnect"} body = request.body if isinstance(body, str): body_bytes: bytes = body.encode("utf-8") elif body is None: body_bytes = b"" elif isinstance(body, types.GeneratorType): try: chunk = body.send(None) if isinstance(chunk, str): chunk = chunk.encode("utf-8") return {"type": "http.request", "body": chunk, "more_body": True} except StopIteration: request_complete = True return {"type": "http.request", "body": b""} else: body_bytes = body request_complete = True return {"type": "http.request", "body": body_bytes} async def send(message: Message) -> None: nonlocal raw_kwargs, response_started, template, context if message["type"] == "http.response.start": assert ( not response_started ), 'Received multiple "http.response.start" messages.' raw_kwargs["version"] = 11 raw_kwargs["status"] = message["status"] raw_kwargs["reason"] = _get_reason_phrase(message["status"]) raw_kwargs["headers"] = [ (key.decode(), value.decode()) for key, value in message.get("headers", []) ] raw_kwargs["preload_content"] = False raw_kwargs["original_response"] = _MockOriginalResponse( raw_kwargs["headers"] ) response_started = True elif message["type"] == "http.response.body": assert ( response_started ), 'Received "http.response.body" without "http.response.start".' assert ( not response_complete.is_set() ), 'Received "http.response.body" after response completed.' body = message.get("body", b"") more_body = message.get("more_body", False) if request.method != "HEAD": raw_kwargs["body"].write(body) if not more_body: raw_kwargs["body"].seek(0) response_complete.set() elif message["type"] == "http.response.template": template = message["template"] context = message["context"] try: with self.portal_factory() as portal: > response_complete = portal.call(anyio.Event) E AttributeError: module 'anyio' has no attribute 'Event' /usr/lib/python3/dist-packages/starlette/testclient.py:262: AttributeError _______________________________ test_update_hero _______________________________ session = client = def test_update_hero(session: Session, client: TestClient): > test_mod.test_update_hero(session=session, client=client) tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests_main.py:50: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ docs_src/tutorial/fastapi/app_testing/tutorial001/test_main.py:104: in test_update_hero response = client.patch(f"/heroes/{hero_1.id}", json={"name": "Deadpuddle"}) /usr/lib/python3/dist-packages/requests/sessions.py:614: in patch return self.request('PATCH', url, data=data, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:468: in request return super().request( /usr/lib/python3/dist-packages/requests/sessions.py:542: in request resp = self.send(prep, **send_kwargs) /usr/lib/python3/dist-packages/requests/sessions.py:655: in send r = adapter.send(request, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:266: in send raise exc _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , args = () kwargs = {'cert': None, 'proxies': OrderedDict([('no', 'localhost'), ('https', 'https://127.0.0.1:9/'), ('http', 'http://127.0.0.1:9/')]), 'stream': False, 'timeout': None, ...} scheme = 'http', netloc = 'testserver', path = '/heroes/1', query = '' fragment = '', default_port = 80, host = 'testserver', port = 80 headers = [(b'host', b'testserver'), (b'user-agent', b'testclient'), (b'accept-encoding', b'gzip, deflate'), (b'accept', b'*/*'), (b'connection', b'keep-alive'), (b'content-length', b'22'), ...] def send( self, request: requests.PreparedRequest, *args: typing.Any, **kwargs: typing.Any ) -> requests.Response: scheme, netloc, path, query, fragment = ( str(item) for item in urlsplit(request.url) ) default_port = {"http": 80, "ws": 80, "https": 443, "wss": 443}[scheme] if ":" in netloc: host, port_string = netloc.split(":", 1) port = int(port_string) else: host = netloc port = default_port # Include the 'host' header. if "host" in request.headers: headers: typing.List[typing.Tuple[bytes, bytes]] = [] elif port == default_port: headers = [(b"host", host.encode())] else: headers = [(b"host", (f"{host}:{port}").encode())] # Include other request headers. headers += [ (key.lower().encode(), value.encode()) for key, value in request.headers.items() ] if scheme in {"ws", "wss"}: subprotocol = request.headers.get("sec-websocket-protocol", None) if subprotocol is None: subprotocols: typing.Sequence[str] = [] else: subprotocols = [value.strip() for value in subprotocol.split(",")] scope = { "type": "websocket", "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "subprotocols": subprotocols, } session = WebSocketTestSession(self.app, scope, self.portal_factory) raise _Upgrade(session) scope = { "type": "http", "http_version": "1.1", "method": request.method, "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "extensions": {"http.response.template": {}}, } request_complete = False response_started = False response_complete: anyio.Event raw_kwargs: typing.Dict[str, typing.Any] = {"body": io.BytesIO()} template = None context = None async def receive() -> Message: nonlocal request_complete if request_complete: if not response_complete.is_set(): await response_complete.wait() return {"type": "http.disconnect"} body = request.body if isinstance(body, str): body_bytes: bytes = body.encode("utf-8") elif body is None: body_bytes = b"" elif isinstance(body, types.GeneratorType): try: chunk = body.send(None) if isinstance(chunk, str): chunk = chunk.encode("utf-8") return {"type": "http.request", "body": chunk, "more_body": True} except StopIteration: request_complete = True return {"type": "http.request", "body": b""} else: body_bytes = body request_complete = True return {"type": "http.request", "body": body_bytes} async def send(message: Message) -> None: nonlocal raw_kwargs, response_started, template, context if message["type"] == "http.response.start": assert ( not response_started ), 'Received multiple "http.response.start" messages.' raw_kwargs["version"] = 11 raw_kwargs["status"] = message["status"] raw_kwargs["reason"] = _get_reason_phrase(message["status"]) raw_kwargs["headers"] = [ (key.decode(), value.decode()) for key, value in message.get("headers", []) ] raw_kwargs["preload_content"] = False raw_kwargs["original_response"] = _MockOriginalResponse( raw_kwargs["headers"] ) response_started = True elif message["type"] == "http.response.body": assert ( response_started ), 'Received "http.response.body" without "http.response.start".' assert ( not response_complete.is_set() ), 'Received "http.response.body" after response completed.' body = message.get("body", b"") more_body = message.get("more_body", False) if request.method != "HEAD": raw_kwargs["body"].write(body) if not more_body: raw_kwargs["body"].seek(0) response_complete.set() elif message["type"] == "http.response.template": template = message["template"] context = message["context"] try: with self.portal_factory() as portal: > response_complete = portal.call(anyio.Event) E AttributeError: module 'anyio' has no attribute 'Event' /usr/lib/python3/dist-packages/starlette/testclient.py:262: AttributeError _______________________________ test_delete_hero _______________________________ session = client = def test_delete_hero(session: Session, client: TestClient): > test_mod.test_delete_hero(session=session, client=client) tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests_main.py:54: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ docs_src/tutorial/fastapi/app_testing/tutorial001/test_main.py:119: in test_delete_hero response = client.delete(f"/heroes/{hero_1.id}") /usr/lib/python3/dist-packages/requests/sessions.py:624: in delete return self.request('DELETE', url, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:468: in request return super().request( /usr/lib/python3/dist-packages/requests/sessions.py:542: in request resp = self.send(prep, **send_kwargs) /usr/lib/python3/dist-packages/requests/sessions.py:655: in send r = adapter.send(request, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:266: in send raise exc _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , args = () kwargs = {'cert': None, 'proxies': OrderedDict([('no', 'localhost'), ('https', 'https://127.0.0.1:9/'), ('http', 'http://127.0.0.1:9/')]), 'stream': False, 'timeout': None, ...} scheme = 'http', netloc = 'testserver', path = '/heroes/1', query = '' fragment = '', default_port = 80, host = 'testserver', port = 80 headers = [(b'host', b'testserver'), (b'user-agent', b'testclient'), (b'accept-encoding', b'gzip, deflate'), (b'accept', b'*/*'), (b'connection', b'keep-alive'), (b'content-length', b'0')] def send( self, request: requests.PreparedRequest, *args: typing.Any, **kwargs: typing.Any ) -> requests.Response: scheme, netloc, path, query, fragment = ( str(item) for item in urlsplit(request.url) ) default_port = {"http": 80, "ws": 80, "https": 443, "wss": 443}[scheme] if ":" in netloc: host, port_string = netloc.split(":", 1) port = int(port_string) else: host = netloc port = default_port # Include the 'host' header. if "host" in request.headers: headers: typing.List[typing.Tuple[bytes, bytes]] = [] elif port == default_port: headers = [(b"host", host.encode())] else: headers = [(b"host", (f"{host}:{port}").encode())] # Include other request headers. headers += [ (key.lower().encode(), value.encode()) for key, value in request.headers.items() ] if scheme in {"ws", "wss"}: subprotocol = request.headers.get("sec-websocket-protocol", None) if subprotocol is None: subprotocols: typing.Sequence[str] = [] else: subprotocols = [value.strip() for value in subprotocol.split(",")] scope = { "type": "websocket", "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "subprotocols": subprotocols, } session = WebSocketTestSession(self.app, scope, self.portal_factory) raise _Upgrade(session) scope = { "type": "http", "http_version": "1.1", "method": request.method, "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "extensions": {"http.response.template": {}}, } request_complete = False response_started = False response_complete: anyio.Event raw_kwargs: typing.Dict[str, typing.Any] = {"body": io.BytesIO()} template = None context = None async def receive() -> Message: nonlocal request_complete if request_complete: if not response_complete.is_set(): await response_complete.wait() return {"type": "http.disconnect"} body = request.body if isinstance(body, str): body_bytes: bytes = body.encode("utf-8") elif body is None: body_bytes = b"" elif isinstance(body, types.GeneratorType): try: chunk = body.send(None) if isinstance(chunk, str): chunk = chunk.encode("utf-8") return {"type": "http.request", "body": chunk, "more_body": True} except StopIteration: request_complete = True return {"type": "http.request", "body": b""} else: body_bytes = body request_complete = True return {"type": "http.request", "body": body_bytes} async def send(message: Message) -> None: nonlocal raw_kwargs, response_started, template, context if message["type"] == "http.response.start": assert ( not response_started ), 'Received multiple "http.response.start" messages.' raw_kwargs["version"] = 11 raw_kwargs["status"] = message["status"] raw_kwargs["reason"] = _get_reason_phrase(message["status"]) raw_kwargs["headers"] = [ (key.decode(), value.decode()) for key, value in message.get("headers", []) ] raw_kwargs["preload_content"] = False raw_kwargs["original_response"] = _MockOriginalResponse( raw_kwargs["headers"] ) response_started = True elif message["type"] == "http.response.body": assert ( response_started ), 'Received "http.response.body" without "http.response.start".' assert ( not response_complete.is_set() ), 'Received "http.response.body" after response completed.' body = message.get("body", b"") more_body = message.get("more_body", False) if request.method != "HEAD": raw_kwargs["body"].write(body) if not more_body: raw_kwargs["body"].seek(0) response_complete.set() elif message["type"] == "http.response.template": template = message["template"] context = message["context"] try: with self.portal_factory() as portal: > response_complete = portal.call(anyio.Event) E AttributeError: module 'anyio' has no attribute 'Event' /usr/lib/python3/dist-packages/starlette/testclient.py:262: AttributeError ___________________________ test_read_hero_not_found ___________________________ client = def test_read_hero_not_found(client: TestClient): > response = client.get("/heroes/9000") tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests_main.py:72: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3/dist-packages/requests/sessions.py:555: in get return self.request('GET', url, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:468: in request return super().request( /usr/lib/python3/dist-packages/requests/sessions.py:542: in request resp = self.send(prep, **send_kwargs) /usr/lib/python3/dist-packages/requests/sessions.py:655: in send r = adapter.send(request, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:266: in send raise exc _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , args = () kwargs = {'cert': None, 'proxies': OrderedDict([('no', 'localhost'), ('https', 'https://127.0.0.1:9/'), ('http', 'http://127.0.0.1:9/')]), 'stream': False, 'timeout': None, ...} scheme = 'http', netloc = 'testserver', path = '/heroes/9000', query = '' fragment = '', default_port = 80, host = 'testserver', port = 80 headers = [(b'host', b'testserver'), (b'user-agent', b'testclient'), (b'accept-encoding', b'gzip, deflate'), (b'accept', b'*/*'), (b'connection', b'keep-alive')] def send( self, request: requests.PreparedRequest, *args: typing.Any, **kwargs: typing.Any ) -> requests.Response: scheme, netloc, path, query, fragment = ( str(item) for item in urlsplit(request.url) ) default_port = {"http": 80, "ws": 80, "https": 443, "wss": 443}[scheme] if ":" in netloc: host, port_string = netloc.split(":", 1) port = int(port_string) else: host = netloc port = default_port # Include the 'host' header. if "host" in request.headers: headers: typing.List[typing.Tuple[bytes, bytes]] = [] elif port == default_port: headers = [(b"host", host.encode())] else: headers = [(b"host", (f"{host}:{port}").encode())] # Include other request headers. headers += [ (key.lower().encode(), value.encode()) for key, value in request.headers.items() ] if scheme in {"ws", "wss"}: subprotocol = request.headers.get("sec-websocket-protocol", None) if subprotocol is None: subprotocols: typing.Sequence[str] = [] else: subprotocols = [value.strip() for value in subprotocol.split(",")] scope = { "type": "websocket", "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "subprotocols": subprotocols, } session = WebSocketTestSession(self.app, scope, self.portal_factory) raise _Upgrade(session) scope = { "type": "http", "http_version": "1.1", "method": request.method, "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "extensions": {"http.response.template": {}}, } request_complete = False response_started = False response_complete: anyio.Event raw_kwargs: typing.Dict[str, typing.Any] = {"body": io.BytesIO()} template = None context = None async def receive() -> Message: nonlocal request_complete if request_complete: if not response_complete.is_set(): await response_complete.wait() return {"type": "http.disconnect"} body = request.body if isinstance(body, str): body_bytes: bytes = body.encode("utf-8") elif body is None: body_bytes = b"" elif isinstance(body, types.GeneratorType): try: chunk = body.send(None) if isinstance(chunk, str): chunk = chunk.encode("utf-8") return {"type": "http.request", "body": chunk, "more_body": True} except StopIteration: request_complete = True return {"type": "http.request", "body": b""} else: body_bytes = body request_complete = True return {"type": "http.request", "body": body_bytes} async def send(message: Message) -> None: nonlocal raw_kwargs, response_started, template, context if message["type"] == "http.response.start": assert ( not response_started ), 'Received multiple "http.response.start" messages.' raw_kwargs["version"] = 11 raw_kwargs["status"] = message["status"] raw_kwargs["reason"] = _get_reason_phrase(message["status"]) raw_kwargs["headers"] = [ (key.decode(), value.decode()) for key, value in message.get("headers", []) ] raw_kwargs["preload_content"] = False raw_kwargs["original_response"] = _MockOriginalResponse( raw_kwargs["headers"] ) response_started = True elif message["type"] == "http.response.body": assert ( response_started ), 'Received "http.response.body" without "http.response.start".' assert ( not response_complete.is_set() ), 'Received "http.response.body" after response completed.' body = message.get("body", b"") more_body = message.get("more_body", False) if request.method != "HEAD": raw_kwargs["body"].write(body) if not more_body: raw_kwargs["body"].seek(0) response_complete.set() elif message["type"] == "http.response.template": template = message["template"] context = message["context"] try: with self.portal_factory() as portal: > response_complete = portal.call(anyio.Event) E AttributeError: module 'anyio' has no attribute 'Event' /usr/lib/python3/dist-packages/starlette/testclient.py:262: AttributeError __________________________ test_update_hero_not_found __________________________ client = def test_update_hero_not_found(client: TestClient): > response = client.patch("/heroes/9000", json={"name": "Very-Rusty-Man"}) tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests_main.py:77: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3/dist-packages/requests/sessions.py:614: in patch return self.request('PATCH', url, data=data, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:468: in request return super().request( /usr/lib/python3/dist-packages/requests/sessions.py:542: in request resp = self.send(prep, **send_kwargs) /usr/lib/python3/dist-packages/requests/sessions.py:655: in send r = adapter.send(request, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:266: in send raise exc _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , args = () kwargs = {'cert': None, 'proxies': OrderedDict([('no', 'localhost'), ('https', 'https://127.0.0.1:9/'), ('http', 'http://127.0.0.1:9/')]), 'stream': False, 'timeout': None, ...} scheme = 'http', netloc = 'testserver', path = '/heroes/9000', query = '' fragment = '', default_port = 80, host = 'testserver', port = 80 headers = [(b'host', b'testserver'), (b'user-agent', b'testclient'), (b'accept-encoding', b'gzip, deflate'), (b'accept', b'*/*'), (b'connection', b'keep-alive'), (b'content-length', b'26'), ...] def send( self, request: requests.PreparedRequest, *args: typing.Any, **kwargs: typing.Any ) -> requests.Response: scheme, netloc, path, query, fragment = ( str(item) for item in urlsplit(request.url) ) default_port = {"http": 80, "ws": 80, "https": 443, "wss": 443}[scheme] if ":" in netloc: host, port_string = netloc.split(":", 1) port = int(port_string) else: host = netloc port = default_port # Include the 'host' header. if "host" in request.headers: headers: typing.List[typing.Tuple[bytes, bytes]] = [] elif port == default_port: headers = [(b"host", host.encode())] else: headers = [(b"host", (f"{host}:{port}").encode())] # Include other request headers. headers += [ (key.lower().encode(), value.encode()) for key, value in request.headers.items() ] if scheme in {"ws", "wss"}: subprotocol = request.headers.get("sec-websocket-protocol", None) if subprotocol is None: subprotocols: typing.Sequence[str] = [] else: subprotocols = [value.strip() for value in subprotocol.split(",")] scope = { "type": "websocket", "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "subprotocols": subprotocols, } session = WebSocketTestSession(self.app, scope, self.portal_factory) raise _Upgrade(session) scope = { "type": "http", "http_version": "1.1", "method": request.method, "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "extensions": {"http.response.template": {}}, } request_complete = False response_started = False response_complete: anyio.Event raw_kwargs: typing.Dict[str, typing.Any] = {"body": io.BytesIO()} template = None context = None async def receive() -> Message: nonlocal request_complete if request_complete: if not response_complete.is_set(): await response_complete.wait() return {"type": "http.disconnect"} body = request.body if isinstance(body, str): body_bytes: bytes = body.encode("utf-8") elif body is None: body_bytes = b"" elif isinstance(body, types.GeneratorType): try: chunk = body.send(None) if isinstance(chunk, str): chunk = chunk.encode("utf-8") return {"type": "http.request", "body": chunk, "more_body": True} except StopIteration: request_complete = True return {"type": "http.request", "body": b""} else: body_bytes = body request_complete = True return {"type": "http.request", "body": body_bytes} async def send(message: Message) -> None: nonlocal raw_kwargs, response_started, template, context if message["type"] == "http.response.start": assert ( not response_started ), 'Received multiple "http.response.start" messages.' raw_kwargs["version"] = 11 raw_kwargs["status"] = message["status"] raw_kwargs["reason"] = _get_reason_phrase(message["status"]) raw_kwargs["headers"] = [ (key.decode(), value.decode()) for key, value in message.get("headers", []) ] raw_kwargs["preload_content"] = False raw_kwargs["original_response"] = _MockOriginalResponse( raw_kwargs["headers"] ) response_started = True elif message["type"] == "http.response.body": assert ( response_started ), 'Received "http.response.body" without "http.response.start".' assert ( not response_complete.is_set() ), 'Received "http.response.body" after response completed.' body = message.get("body", b"") more_body = message.get("more_body", False) if request.method != "HEAD": raw_kwargs["body"].write(body) if not more_body: raw_kwargs["body"].seek(0) response_complete.set() elif message["type"] == "http.response.template": template = message["template"] context = message["context"] try: with self.portal_factory() as portal: > response_complete = portal.call(anyio.Event) E AttributeError: module 'anyio' has no attribute 'Event' /usr/lib/python3/dist-packages/starlette/testclient.py:262: AttributeError __________________________ test_delete_hero_not_found __________________________ client = def test_delete_hero_not_found(client: TestClient): > response = client.delete("/heroes/9000") tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests_main.py:82: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3/dist-packages/requests/sessions.py:624: in delete return self.request('DELETE', url, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:468: in request return super().request( /usr/lib/python3/dist-packages/requests/sessions.py:542: in request resp = self.send(prep, **send_kwargs) /usr/lib/python3/dist-packages/requests/sessions.py:655: in send r = adapter.send(request, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:266: in send raise exc _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , args = () kwargs = {'cert': None, 'proxies': OrderedDict([('no', 'localhost'), ('https', 'https://127.0.0.1:9/'), ('http', 'http://127.0.0.1:9/')]), 'stream': False, 'timeout': None, ...} scheme = 'http', netloc = 'testserver', path = '/heroes/9000', query = '' fragment = '', default_port = 80, host = 'testserver', port = 80 headers = [(b'host', b'testserver'), (b'user-agent', b'testclient'), (b'accept-encoding', b'gzip, deflate'), (b'accept', b'*/*'), (b'connection', b'keep-alive'), (b'content-length', b'0')] def send( self, request: requests.PreparedRequest, *args: typing.Any, **kwargs: typing.Any ) -> requests.Response: scheme, netloc, path, query, fragment = ( str(item) for item in urlsplit(request.url) ) default_port = {"http": 80, "ws": 80, "https": 443, "wss": 443}[scheme] if ":" in netloc: host, port_string = netloc.split(":", 1) port = int(port_string) else: host = netloc port = default_port # Include the 'host' header. if "host" in request.headers: headers: typing.List[typing.Tuple[bytes, bytes]] = [] elif port == default_port: headers = [(b"host", host.encode())] else: headers = [(b"host", (f"{host}:{port}").encode())] # Include other request headers. headers += [ (key.lower().encode(), value.encode()) for key, value in request.headers.items() ] if scheme in {"ws", "wss"}: subprotocol = request.headers.get("sec-websocket-protocol", None) if subprotocol is None: subprotocols: typing.Sequence[str] = [] else: subprotocols = [value.strip() for value in subprotocol.split(",")] scope = { "type": "websocket", "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "subprotocols": subprotocols, } session = WebSocketTestSession(self.app, scope, self.portal_factory) raise _Upgrade(session) scope = { "type": "http", "http_version": "1.1", "method": request.method, "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "extensions": {"http.response.template": {}}, } request_complete = False response_started = False response_complete: anyio.Event raw_kwargs: typing.Dict[str, typing.Any] = {"body": io.BytesIO()} template = None context = None async def receive() -> Message: nonlocal request_complete if request_complete: if not response_complete.is_set(): await response_complete.wait() return {"type": "http.disconnect"} body = request.body if isinstance(body, str): body_bytes: bytes = body.encode("utf-8") elif body is None: body_bytes = b"" elif isinstance(body, types.GeneratorType): try: chunk = body.send(None) if isinstance(chunk, str): chunk = chunk.encode("utf-8") return {"type": "http.request", "body": chunk, "more_body": True} except StopIteration: request_complete = True return {"type": "http.request", "body": b""} else: body_bytes = body request_complete = True return {"type": "http.request", "body": body_bytes} async def send(message: Message) -> None: nonlocal raw_kwargs, response_started, template, context if message["type"] == "http.response.start": assert ( not response_started ), 'Received multiple "http.response.start" messages.' raw_kwargs["version"] = 11 raw_kwargs["status"] = message["status"] raw_kwargs["reason"] = _get_reason_phrase(message["status"]) raw_kwargs["headers"] = [ (key.decode(), value.decode()) for key, value in message.get("headers", []) ] raw_kwargs["preload_content"] = False raw_kwargs["original_response"] = _MockOriginalResponse( raw_kwargs["headers"] ) response_started = True elif message["type"] == "http.response.body": assert ( response_started ), 'Received "http.response.body" without "http.response.start".' assert ( not response_complete.is_set() ), 'Received "http.response.body" after response completed.' body = message.get("body", b"") more_body = message.get("more_body", False) if request.method != "HEAD": raw_kwargs["body"].write(body) if not more_body: raw_kwargs["body"].seek(0) response_complete.set() elif message["type"] == "http.response.template": template = message["template"] context = message["context"] try: with self.portal_factory() as portal: > response_complete = portal.call(anyio.Event) E AttributeError: module 'anyio' has no attribute 'Event' /usr/lib/python3/dist-packages/starlette/testclient.py:262: AttributeError ________________________________ test_tutorial _________________________________ clear_sqlmodel = None def test_tutorial(clear_sqlmodel): from docs_src.tutorial.fastapi.delete import tutorial001 as mod mod.sqlite_url = "sqlite://" mod.engine = create_engine( mod.sqlite_url, connect_args=mod.connect_args, poolclass=StaticPool ) > with TestClient(mod.app) as client: tests/test_tutorial/test_fastapi/test_delete/test_tutorial001.py:263: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> "TestClient": with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context( anyio.start_blocking_portal(**self.async_backend) ) @stack.callback def reset_portal() -> None: self.portal = None self.stream_send = StapledObjectStream( *anyio.create_memory_object_stream(math.inf) ) self.stream_receive = StapledObjectStream( *anyio.create_memory_object_stream(math.inf) ) > self.task = portal.start_task_soon(self.lifespan) E AttributeError: 'BlockingPortal' object has no attribute 'start_task_soon' /usr/lib/python3/dist-packages/starlette/testclient.py:523: AttributeError ________________________________ test_tutorial _________________________________ clear_sqlmodel = None def test_tutorial(clear_sqlmodel): from docs_src.tutorial.fastapi.limit_and_offset import tutorial001 as mod mod.sqlite_url = "sqlite://" mod.engine = create_engine( mod.sqlite_url, connect_args=mod.connect_args, poolclass=StaticPool ) > with TestClient(mod.app) as client: tests/test_tutorial/test_fastapi/test_limit_and_offset/test_tutorial001.py:186: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> "TestClient": with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context( anyio.start_blocking_portal(**self.async_backend) ) @stack.callback def reset_portal() -> None: self.portal = None self.stream_send = StapledObjectStream( *anyio.create_memory_object_stream(math.inf) ) self.stream_receive = StapledObjectStream( *anyio.create_memory_object_stream(math.inf) ) > self.task = portal.start_task_soon(self.lifespan) E AttributeError: 'BlockingPortal' object has no attribute 'start_task_soon' /usr/lib/python3/dist-packages/starlette/testclient.py:523: AttributeError ________________________________ test_tutorial _________________________________ clear_sqlmodel = None def test_tutorial(clear_sqlmodel): from docs_src.tutorial.fastapi.multiple_models import tutorial001 as mod mod.sqlite_url = "sqlite://" mod.engine = create_engine( mod.sqlite_url, connect_args=mod.connect_args, poolclass=StaticPool ) > with TestClient(mod.app) as client: tests/test_tutorial/test_fastapi/test_multiple_models/test_tutorial001.py:123: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> "TestClient": with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context( anyio.start_blocking_portal(**self.async_backend) ) @stack.callback def reset_portal() -> None: self.portal = None self.stream_send = StapledObjectStream( *anyio.create_memory_object_stream(math.inf) ) self.stream_receive = StapledObjectStream( *anyio.create_memory_object_stream(math.inf) ) > self.task = portal.start_task_soon(self.lifespan) E AttributeError: 'BlockingPortal' object has no attribute 'start_task_soon' /usr/lib/python3/dist-packages/starlette/testclient.py:523: AttributeError ________________________________ test_tutorial _________________________________ clear_sqlmodel = None def test_tutorial(clear_sqlmodel): from docs_src.tutorial.fastapi.multiple_models import tutorial002 as mod mod.sqlite_url = "sqlite://" mod.engine = create_engine( mod.sqlite_url, connect_args=mod.connect_args, poolclass=StaticPool ) > with TestClient(mod.app) as client: tests/test_tutorial/test_fastapi/test_multiple_models/test_tutorial002.py:123: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> "TestClient": with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context( anyio.start_blocking_portal(**self.async_backend) ) @stack.callback def reset_portal() -> None: self.portal = None self.stream_send = StapledObjectStream( *anyio.create_memory_object_stream(math.inf) ) self.stream_receive = StapledObjectStream( *anyio.create_memory_object_stream(math.inf) ) > self.task = portal.start_task_soon(self.lifespan) E AttributeError: 'BlockingPortal' object has no attribute 'start_task_soon' /usr/lib/python3/dist-packages/starlette/testclient.py:523: AttributeError ________________________________ test_tutorial _________________________________ clear_sqlmodel = None def test_tutorial(clear_sqlmodel): from docs_src.tutorial.fastapi.read_one import tutorial001 as mod mod.sqlite_url = "sqlite://" mod.engine = create_engine( mod.sqlite_url, connect_args=mod.connect_args, poolclass=StaticPool ) > with TestClient(mod.app) as client: tests/test_tutorial/test_fastapi/test_read_one/test_tutorial001.py:157: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> "TestClient": with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context( anyio.start_blocking_portal(**self.async_backend) ) @stack.callback def reset_portal() -> None: self.portal = None self.stream_send = StapledObjectStream( *anyio.create_memory_object_stream(math.inf) ) self.stream_receive = StapledObjectStream( *anyio.create_memory_object_stream(math.inf) ) > self.task = portal.start_task_soon(self.lifespan) E AttributeError: 'BlockingPortal' object has no attribute 'start_task_soon' /usr/lib/python3/dist-packages/starlette/testclient.py:523: AttributeError ________________________________ test_tutorial _________________________________ clear_sqlmodel = None def test_tutorial(clear_sqlmodel): from docs_src.tutorial.fastapi.relationships import tutorial001 as mod mod.sqlite_url = "sqlite://" mod.engine = create_engine( mod.sqlite_url, connect_args=mod.connect_args, poolclass=StaticPool ) > with TestClient(mod.app) as client: tests/test_tutorial/test_fastapi/test_relationships/test_tutorial001.py:510: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> "TestClient": with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context( anyio.start_blocking_portal(**self.async_backend) ) @stack.callback def reset_portal() -> None: self.portal = None self.stream_send = StapledObjectStream( *anyio.create_memory_object_stream(math.inf) ) self.stream_receive = StapledObjectStream( *anyio.create_memory_object_stream(math.inf) ) > self.task = portal.start_task_soon(self.lifespan) E AttributeError: 'BlockingPortal' object has no attribute 'start_task_soon' /usr/lib/python3/dist-packages/starlette/testclient.py:523: AttributeError ________________________________ test_tutorial _________________________________ clear_sqlmodel = None def test_tutorial(clear_sqlmodel): from docs_src.tutorial.fastapi.response_model import tutorial001 as mod mod.sqlite_url = "sqlite://" mod.engine = create_engine( mod.sqlite_url, connect_args=mod.connect_args, poolclass=StaticPool ) > with TestClient(mod.app) as client: tests/test_tutorial/test_fastapi/test_response_model/test_tutorial001.py:113: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> "TestClient": with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context( anyio.start_blocking_portal(**self.async_backend) ) @stack.callback def reset_portal() -> None: self.portal = None self.stream_send = StapledObjectStream( *anyio.create_memory_object_stream(math.inf) ) self.stream_receive = StapledObjectStream( *anyio.create_memory_object_stream(math.inf) ) > self.task = portal.start_task_soon(self.lifespan) E AttributeError: 'BlockingPortal' object has no attribute 'start_task_soon' /usr/lib/python3/dist-packages/starlette/testclient.py:523: AttributeError ________________________________ test_tutorial _________________________________ clear_sqlmodel = None def test_tutorial(clear_sqlmodel): from docs_src.tutorial.fastapi.session_with_dependency import tutorial001 as mod mod.sqlite_url = "sqlite://" mod.engine = create_engine( mod.sqlite_url, connect_args=mod.connect_args, poolclass=StaticPool ) > with TestClient(mod.app) as client: tests/test_tutorial/test_fastapi/test_session_with_dependency/test_tutorial001.py:263: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> "TestClient": with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context( anyio.start_blocking_portal(**self.async_backend) ) @stack.callback def reset_portal() -> None: self.portal = None self.stream_send = StapledObjectStream( *anyio.create_memory_object_stream(math.inf) ) self.stream_receive = StapledObjectStream( *anyio.create_memory_object_stream(math.inf) ) > self.task = portal.start_task_soon(self.lifespan) E AttributeError: 'BlockingPortal' object has no attribute 'start_task_soon' /usr/lib/python3/dist-packages/starlette/testclient.py:523: AttributeError ________________________________ test_tutorial _________________________________ clear_sqlmodel = None def test_tutorial(clear_sqlmodel): from docs_src.tutorial.fastapi.simple_hero_api import tutorial001 as mod mod.sqlite_url = "sqlite://" mod.engine = create_engine( mod.sqlite_url, connect_args=mod.connect_args, poolclass=StaticPool ) > with TestClient(mod.app) as client: tests/test_tutorial/test_fastapi/test_simple_hero_api/test_tutorial001.py:101: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> "TestClient": with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context( anyio.start_blocking_portal(**self.async_backend) ) @stack.callback def reset_portal() -> None: self.portal = None self.stream_send = StapledObjectStream( *anyio.create_memory_object_stream(math.inf) ) self.stream_receive = StapledObjectStream( *anyio.create_memory_object_stream(math.inf) ) > self.task = portal.start_task_soon(self.lifespan) E AttributeError: 'BlockingPortal' object has no attribute 'start_task_soon' /usr/lib/python3/dist-packages/starlette/testclient.py:523: AttributeError ________________________________ test_tutorial _________________________________ clear_sqlmodel = None def test_tutorial(clear_sqlmodel): from docs_src.tutorial.fastapi.teams import tutorial001 as mod mod.sqlite_url = "sqlite://" mod.engine = create_engine( mod.sqlite_url, connect_args=mod.connect_args, poolclass=StaticPool ) > with TestClient(mod.app) as client: tests/test_tutorial/test_fastapi/test_teams/test_tutorial001.py:477: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> "TestClient": with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context( anyio.start_blocking_portal(**self.async_backend) ) @stack.callback def reset_portal() -> None: self.portal = None self.stream_send = StapledObjectStream( *anyio.create_memory_object_stream(math.inf) ) self.stream_receive = StapledObjectStream( *anyio.create_memory_object_stream(math.inf) ) > self.task = portal.start_task_soon(self.lifespan) E AttributeError: 'BlockingPortal' object has no attribute 'start_task_soon' /usr/lib/python3/dist-packages/starlette/testclient.py:523: AttributeError ________________________________ test_tutorial _________________________________ clear_sqlmodel = None def test_tutorial(clear_sqlmodel): from docs_src.tutorial.fastapi.update import tutorial001 as mod mod.sqlite_url = "sqlite://" mod.engine = create_engine( mod.sqlite_url, connect_args=mod.connect_args, poolclass=StaticPool ) > with TestClient(mod.app) as client: tests/test_tutorial/test_fastapi/test_update/test_tutorial001.py:235: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> "TestClient": with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context( anyio.start_blocking_portal(**self.async_backend) ) @stack.callback def reset_portal() -> None: self.portal = None self.stream_send = StapledObjectStream( *anyio.create_memory_object_stream(math.inf) ) self.stream_receive = StapledObjectStream( *anyio.create_memory_object_stream(math.inf) ) > self.task = portal.start_task_soon(self.lifespan) E AttributeError: 'BlockingPortal' object has no attribute 'start_task_soon' /usr/lib/python3/dist-packages/starlette/testclient.py:523: AttributeError =========================== short test summary info ============================ FAILED docs_src/tutorial/fastapi/app_testing/tutorial001/test_main.py::test_create_hero FAILED docs_src/tutorial/fastapi/app_testing/tutorial001/test_main.py::test_create_hero_incomplete FAILED docs_src/tutorial/fastapi/app_testing/tutorial001/test_main.py::test_create_hero_invalid FAILED docs_src/tutorial/fastapi/app_testing/tutorial001/test_main.py::test_read_heroes FAILED docs_src/tutorial/fastapi/app_testing/tutorial001/test_main.py::test_read_hero FAILED docs_src/tutorial/fastapi/app_testing/tutorial001/test_main.py::test_update_hero FAILED docs_src/tutorial/fastapi/app_testing/tutorial001/test_main.py::test_delete_hero FAILED docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_001.py::test_create_hero FAILED docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_002.py::test_create_hero FAILED docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_003.py::test_create_hero FAILED docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_004.py::test_create_hero FAILED docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_005.py::test_create_hero FAILED docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_006.py::test_create_hero FAILED tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests001.py::test_tutorial FAILED tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests002.py::test_tutorial FAILED tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests003.py::test_tutorial FAILED tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests004.py::test_tutorial FAILED tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests005.py::test_tutorial FAILED tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests006.py::test_tutorial FAILED tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests_main.py::test_create_hero FAILED tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests_main.py::test_create_hero_incomplete FAILED tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests_main.py::test_create_hero_invalid FAILED tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests_main.py::test_read_heroes FAILED tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests_main.py::test_read_hero FAILED tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests_main.py::test_update_hero FAILED tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests_main.py::test_delete_hero FAILED tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests_main.py::test_read_hero_not_found FAILED tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests_main.py::test_update_hero_not_found FAILED tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests_main.py::test_delete_hero_not_found FAILED tests/test_tutorial/test_fastapi/test_delete/test_tutorial001.py::test_tutorial FAILED tests/test_tutorial/test_fastapi/test_limit_and_offset/test_tutorial001.py::test_tutorial FAILED tests/test_tutorial/test_fastapi/test_multiple_models/test_tutorial001.py::test_tutorial FAILED tests/test_tutorial/test_fastapi/test_multiple_models/test_tutorial002.py::test_tutorial FAILED tests/test_tutorial/test_fastapi/test_read_one/test_tutorial001.py::test_tutorial FAILED tests/test_tutorial/test_fastapi/test_relationships/test_tutorial001.py::test_tutorial FAILED tests/test_tutorial/test_fastapi/test_response_model/test_tutorial001.py::test_tutorial FAILED tests/test_tutorial/test_fastapi/test_session_with_dependency/test_tutorial001.py::test_tutorial FAILED tests/test_tutorial/test_fastapi/test_simple_hero_api/test_tutorial001.py::test_tutorial FAILED tests/test_tutorial/test_fastapi/test_teams/test_tutorial001.py::test_tutorial FAILED tests/test_tutorial/test_fastapi/test_update/test_tutorial001.py::test_tutorial ================= 40 failed, 68 passed, 3 deselected in 8.60s ================== E: pybuild pybuild:354: test: plugin custom failed with: exit code=1: PYTHONPATH=/<> python3.10 -m pytest -k 'not test_create_db_and_table' I: pybuild base:237: PYTHONPATH=/<> python3.9 -m pytest -k 'not test_create_db_and_table' ============================= test session starts ============================== platform linux -- Python 3.9.9, pytest-6.2.5, py-1.10.0, pluggy-0.13.0 rootdir: /<> plugins: anyio-0.0.0 collected 111 items / 3 deselected / 108 selected docs_src/tutorial/fastapi/app_testing/tutorial001/test_main.py FFFFFFF [ 6%] docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_001.py F [ 7%] docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_002.py F [ 8%] docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_003.py F [ 9%] docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_004.py F [ 10%] docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_005.py F [ 11%] docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_006.py F [ 12%] tests/test_default.py .... [ 15%] tests/test_instance_no_args.py . [ 16%] tests/test_query.py . [ 17%] tests/test_tutorial/test_automatic_id_none_refresh/test_tutorial001_tutorial002.py . [ 18%] . [ 19%] tests/test_tutorial/test_code_structure/test_tutorial001.py . [ 20%] tests/test_tutorial/test_code_structure/test_tutorial002.py . [ 21%] tests/test_tutorial/test_connect/test_create_connected_tables/test_tutorial001.py . [ 22%] [ 22%] tests/test_tutorial/test_connect/test_delete/test_tutorial001.py . [ 23%] tests/test_tutorial/test_connect/test_insert/test_tutorial001.py . [ 24%] tests/test_tutorial/test_connect/test_select/test_tutorial001_tutorial002.py . [ 25%] . [ 25%] tests/test_tutorial/test_connect/test_select/test_tutorial003.py . [ 26%] tests/test_tutorial/test_connect/test_select/test_tutorial004.py . [ 27%] tests/test_tutorial/test_connect/test_select/test_tutorial005.py . [ 28%] tests/test_tutorial/test_connect/test_update/test_tutorial001.py . [ 29%] tests/test_tutorial/test_delete/test_tutorial001_tutorial002.py .. [ 31%] tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests001.py F [ 32%] [ 32%] tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests002.py F [ 33%] [ 33%] tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests003.py F [ 34%] [ 34%] tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests004.py F [ 35%] [ 35%] tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests005.py F [ 36%] [ 36%] tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests006.py F [ 37%] [ 37%] tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests_main.py F [ 37%] FFFFFF..FFF [ 48%] tests/test_tutorial/test_fastapi/test_delete/test_tutorial001.py F [ 49%] tests/test_tutorial/test_fastapi/test_limit_and_offset/test_tutorial001.py F [ 50%] [ 50%] tests/test_tutorial/test_fastapi/test_multiple_models/test_tutorial001.py F [ 50%] [ 50%] tests/test_tutorial/test_fastapi/test_multiple_models/test_tutorial002.py F [ 51%] [ 51%] tests/test_tutorial/test_fastapi/test_read_one/test_tutorial001.py F [ 52%] tests/test_tutorial/test_fastapi/test_relationships/test_tutorial001.py F [ 53%] [ 53%] tests/test_tutorial/test_fastapi/test_response_model/test_tutorial001.py F [ 54%] [ 54%] tests/test_tutorial/test_fastapi/test_session_with_dependency/test_tutorial001.py F [ 55%] [ 55%] tests/test_tutorial/test_fastapi/test_simple_hero_api/test_tutorial001.py F [ 56%] [ 56%] tests/test_tutorial/test_fastapi/test_teams/test_tutorial001.py F [ 57%] tests/test_tutorial/test_fastapi/test_update/test_tutorial001.py F [ 58%] tests/test_tutorial/test_insert/test_tutorial001.py . [ 59%] tests/test_tutorial/test_insert/test_tutorial002.py . [ 60%] tests/test_tutorial/test_insert/test_tutorial003.py . [ 61%] tests/test_tutorial/test_limit_and_offset/test_tutorial001.py . [ 62%] tests/test_tutorial/test_limit_and_offset/test_tutorial002.py . [ 62%] tests/test_tutorial/test_limit_and_offset/test_tutorial003.py . [ 63%] tests/test_tutorial/test_limit_and_offset/test_tutorial004.py . [ 64%] tests/test_tutorial/test_many_to_many/test_tutorial001.py . [ 65%] tests/test_tutorial/test_many_to_many/test_tutorial002.py . [ 66%] tests/test_tutorial/test_many_to_many/test_tutorial003.py . [ 67%] tests/test_tutorial/test_one/test_tutorial001.py . [ 68%] tests/test_tutorial/test_one/test_tutorial002.py . [ 69%] tests/test_tutorial/test_one/test_tutorial003.py . [ 70%] tests/test_tutorial/test_one/test_tutorial004.py . [ 71%] tests/test_tutorial/test_one/test_tutorial005.py . [ 72%] tests/test_tutorial/test_one/test_tutorial006.py . [ 73%] tests/test_tutorial/test_one/test_tutorial007.py . [ 74%] tests/test_tutorial/test_one/test_tutorial008.py . [ 75%] tests/test_tutorial/test_one/test_tutorial009.py . [ 75%] tests/test_tutorial/test_relationship_attributes/test_back_populates/test_tutorial001.py . [ 76%] [ 76%] tests/test_tutorial/test_relationship_attributes/test_back_populates/test_tutorial002.py . [ 77%] [ 77%] tests/test_tutorial/test_relationship_attributes/test_back_populates/test_tutorial003.py . [ 78%] [ 78%] tests/test_tutorial/test_relationship_attributes/test_create_and_update_relationships/test_tutorial001.py . [ 79%] [ 79%] tests/test_tutorial/test_relationship_attributes/test_define_relationship_attributes/test_tutorial001.py . [ 80%] [ 80%] tests/test_tutorial/test_relationship_attributes/test_read_relationships/test_tutorial001.py . [ 81%] [ 81%] tests/test_tutorial/test_relationship_attributes/test_read_relationships/test_tutorial002.py . [ 82%] [ 82%] tests/test_tutorial/test_select/test_tutorial001_tutorial002.py .. [ 84%] tests/test_tutorial/test_select/test_tutorial003_tutorial004.py .. [ 86%] tests/test_tutorial/test_update/test_tutorial001_tutorial002.py .. [ 87%] tests/test_tutorial/test_update/test_tutorial003_tutorial004.py .. [ 89%] tests/test_tutorial/test_where/test_tutorial001.py . [ 90%] tests/test_tutorial/test_where/test_tutorial002.py . [ 91%] tests/test_tutorial/test_where/test_tutorial003.py . [ 92%] tests/test_tutorial/test_where/test_tutorial004.py . [ 93%] tests/test_tutorial/test_where/test_tutorial005.py . [ 94%] tests/test_tutorial/test_where/test_tutorial006.py . [ 95%] tests/test_tutorial/test_where/test_tutorial007.py . [ 96%] tests/test_tutorial/test_where/test_tutorial008.py . [ 97%] tests/test_tutorial/test_where/test_tutorial009.py . [ 98%] tests/test_tutorial/test_where/test_tutorial010.py . [ 99%] tests/test_tutorial/test_where/test_tutorial011.py . [100%] =================================== FAILURES =================================== _______________________________ test_create_hero _______________________________ client = def test_create_hero(client: TestClient): > response = client.post( "/heroes/", json={"name": "Deadpond", "secret_name": "Dive Wilson"} ) docs_src/tutorial/fastapi/app_testing/tutorial001/test_main.py:31: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3/dist-packages/requests/sessions.py:590: in post return self.request('POST', url, data=data, json=json, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:468: in request return super().request( /usr/lib/python3/dist-packages/requests/sessions.py:542: in request resp = self.send(prep, **send_kwargs) /usr/lib/python3/dist-packages/requests/sessions.py:655: in send r = adapter.send(request, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:266: in send raise exc _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , args = () kwargs = {'cert': None, 'proxies': OrderedDict([('no', 'localhost'), ('https', 'https://127.0.0.1:9/'), ('http', 'http://127.0.0.1:9/')]), 'stream': False, 'timeout': None, ...} scheme = 'http', netloc = 'testserver', path = '/heroes/', query = '' fragment = '', default_port = 80, host = 'testserver', port = 80 headers = [(b'host', b'testserver'), (b'user-agent', b'testclient'), (b'accept-encoding', b'gzip, deflate'), (b'accept', b'*/*'), (b'connection', b'keep-alive'), (b'content-length', b'50'), ...] def send( self, request: requests.PreparedRequest, *args: typing.Any, **kwargs: typing.Any ) -> requests.Response: scheme, netloc, path, query, fragment = ( str(item) for item in urlsplit(request.url) ) default_port = {"http": 80, "ws": 80, "https": 443, "wss": 443}[scheme] if ":" in netloc: host, port_string = netloc.split(":", 1) port = int(port_string) else: host = netloc port = default_port # Include the 'host' header. if "host" in request.headers: headers: typing.List[typing.Tuple[bytes, bytes]] = [] elif port == default_port: headers = [(b"host", host.encode())] else: headers = [(b"host", (f"{host}:{port}").encode())] # Include other request headers. headers += [ (key.lower().encode(), value.encode()) for key, value in request.headers.items() ] if scheme in {"ws", "wss"}: subprotocol = request.headers.get("sec-websocket-protocol", None) if subprotocol is None: subprotocols: typing.Sequence[str] = [] else: subprotocols = [value.strip() for value in subprotocol.split(",")] scope = { "type": "websocket", "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "subprotocols": subprotocols, } session = WebSocketTestSession(self.app, scope, self.portal_factory) raise _Upgrade(session) scope = { "type": "http", "http_version": "1.1", "method": request.method, "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "extensions": {"http.response.template": {}}, } request_complete = False response_started = False response_complete: anyio.Event raw_kwargs: typing.Dict[str, typing.Any] = {"body": io.BytesIO()} template = None context = None async def receive() -> Message: nonlocal request_complete if request_complete: if not response_complete.is_set(): await response_complete.wait() return {"type": "http.disconnect"} body = request.body if isinstance(body, str): body_bytes: bytes = body.encode("utf-8") elif body is None: body_bytes = b"" elif isinstance(body, types.GeneratorType): try: chunk = body.send(None) if isinstance(chunk, str): chunk = chunk.encode("utf-8") return {"type": "http.request", "body": chunk, "more_body": True} except StopIteration: request_complete = True return {"type": "http.request", "body": b""} else: body_bytes = body request_complete = True return {"type": "http.request", "body": body_bytes} async def send(message: Message) -> None: nonlocal raw_kwargs, response_started, template, context if message["type"] == "http.response.start": assert ( not response_started ), 'Received multiple "http.response.start" messages.' raw_kwargs["version"] = 11 raw_kwargs["status"] = message["status"] raw_kwargs["reason"] = _get_reason_phrase(message["status"]) raw_kwargs["headers"] = [ (key.decode(), value.decode()) for key, value in message.get("headers", []) ] raw_kwargs["preload_content"] = False raw_kwargs["original_response"] = _MockOriginalResponse( raw_kwargs["headers"] ) response_started = True elif message["type"] == "http.response.body": assert ( response_started ), 'Received "http.response.body" without "http.response.start".' assert ( not response_complete.is_set() ), 'Received "http.response.body" after response completed.' body = message.get("body", b"") more_body = message.get("more_body", False) if request.method != "HEAD": raw_kwargs["body"].write(body) if not more_body: raw_kwargs["body"].seek(0) response_complete.set() elif message["type"] == "http.response.template": template = message["template"] context = message["context"] try: with self.portal_factory() as portal: > response_complete = portal.call(anyio.Event) E AttributeError: module 'anyio' has no attribute 'Event' /usr/lib/python3/dist-packages/starlette/testclient.py:262: AttributeError _________________________ test_create_hero_incomplete __________________________ client = def test_create_hero_incomplete(client: TestClient): # No secret_name > response = client.post("/heroes/", json={"name": "Deadpond"}) docs_src/tutorial/fastapi/app_testing/tutorial001/test_main.py:45: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3/dist-packages/requests/sessions.py:590: in post return self.request('POST', url, data=data, json=json, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:468: in request return super().request( /usr/lib/python3/dist-packages/requests/sessions.py:542: in request resp = self.send(prep, **send_kwargs) /usr/lib/python3/dist-packages/requests/sessions.py:655: in send r = adapter.send(request, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:266: in send raise exc _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , args = () kwargs = {'cert': None, 'proxies': OrderedDict([('no', 'localhost'), ('https', 'https://127.0.0.1:9/'), ('http', 'http://127.0.0.1:9/')]), 'stream': False, 'timeout': None, ...} scheme = 'http', netloc = 'testserver', path = '/heroes/', query = '' fragment = '', default_port = 80, host = 'testserver', port = 80 headers = [(b'host', b'testserver'), (b'user-agent', b'testclient'), (b'accept-encoding', b'gzip, deflate'), (b'accept', b'*/*'), (b'connection', b'keep-alive'), (b'content-length', b'20'), ...] def send( self, request: requests.PreparedRequest, *args: typing.Any, **kwargs: typing.Any ) -> requests.Response: scheme, netloc, path, query, fragment = ( str(item) for item in urlsplit(request.url) ) default_port = {"http": 80, "ws": 80, "https": 443, "wss": 443}[scheme] if ":" in netloc: host, port_string = netloc.split(":", 1) port = int(port_string) else: host = netloc port = default_port # Include the 'host' header. if "host" in request.headers: headers: typing.List[typing.Tuple[bytes, bytes]] = [] elif port == default_port: headers = [(b"host", host.encode())] else: headers = [(b"host", (f"{host}:{port}").encode())] # Include other request headers. headers += [ (key.lower().encode(), value.encode()) for key, value in request.headers.items() ] if scheme in {"ws", "wss"}: subprotocol = request.headers.get("sec-websocket-protocol", None) if subprotocol is None: subprotocols: typing.Sequence[str] = [] else: subprotocols = [value.strip() for value in subprotocol.split(",")] scope = { "type": "websocket", "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "subprotocols": subprotocols, } session = WebSocketTestSession(self.app, scope, self.portal_factory) raise _Upgrade(session) scope = { "type": "http", "http_version": "1.1", "method": request.method, "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "extensions": {"http.response.template": {}}, } request_complete = False response_started = False response_complete: anyio.Event raw_kwargs: typing.Dict[str, typing.Any] = {"body": io.BytesIO()} template = None context = None async def receive() -> Message: nonlocal request_complete if request_complete: if not response_complete.is_set(): await response_complete.wait() return {"type": "http.disconnect"} body = request.body if isinstance(body, str): body_bytes: bytes = body.encode("utf-8") elif body is None: body_bytes = b"" elif isinstance(body, types.GeneratorType): try: chunk = body.send(None) if isinstance(chunk, str): chunk = chunk.encode("utf-8") return {"type": "http.request", "body": chunk, "more_body": True} except StopIteration: request_complete = True return {"type": "http.request", "body": b""} else: body_bytes = body request_complete = True return {"type": "http.request", "body": body_bytes} async def send(message: Message) -> None: nonlocal raw_kwargs, response_started, template, context if message["type"] == "http.response.start": assert ( not response_started ), 'Received multiple "http.response.start" messages.' raw_kwargs["version"] = 11 raw_kwargs["status"] = message["status"] raw_kwargs["reason"] = _get_reason_phrase(message["status"]) raw_kwargs["headers"] = [ (key.decode(), value.decode()) for key, value in message.get("headers", []) ] raw_kwargs["preload_content"] = False raw_kwargs["original_response"] = _MockOriginalResponse( raw_kwargs["headers"] ) response_started = True elif message["type"] == "http.response.body": assert ( response_started ), 'Received "http.response.body" without "http.response.start".' assert ( not response_complete.is_set() ), 'Received "http.response.body" after response completed.' body = message.get("body", b"") more_body = message.get("more_body", False) if request.method != "HEAD": raw_kwargs["body"].write(body) if not more_body: raw_kwargs["body"].seek(0) response_complete.set() elif message["type"] == "http.response.template": template = message["template"] context = message["context"] try: with self.portal_factory() as portal: > response_complete = portal.call(anyio.Event) E AttributeError: module 'anyio' has no attribute 'Event' /usr/lib/python3/dist-packages/starlette/testclient.py:262: AttributeError ___________________________ test_create_hero_invalid ___________________________ client = def test_create_hero_invalid(client: TestClient): # secret_name has an invalid type > response = client.post( "/heroes/", json={ "name": "Deadpond", "secret_name": {"message": "Do you wanna know my secret identity?"}, }, ) docs_src/tutorial/fastapi/app_testing/tutorial001/test_main.py:51: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3/dist-packages/requests/sessions.py:590: in post return self.request('POST', url, data=data, json=json, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:468: in request return super().request( /usr/lib/python3/dist-packages/requests/sessions.py:542: in request resp = self.send(prep, **send_kwargs) /usr/lib/python3/dist-packages/requests/sessions.py:655: in send r = adapter.send(request, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:266: in send raise exc _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , args = () kwargs = {'cert': None, 'proxies': OrderedDict([('no', 'localhost'), ('https', 'https://127.0.0.1:9/'), ('http', 'http://127.0.0.1:9/')]), 'stream': False, 'timeout': None, ...} scheme = 'http', netloc = 'testserver', path = '/heroes/', query = '' fragment = '', default_port = 80, host = 'testserver', port = 80 headers = [(b'host', b'testserver'), (b'user-agent', b'testclient'), (b'accept-encoding', b'gzip, deflate'), (b'accept', b'*/*'), (b'connection', b'keep-alive'), (b'content-length', b'89'), ...] def send( self, request: requests.PreparedRequest, *args: typing.Any, **kwargs: typing.Any ) -> requests.Response: scheme, netloc, path, query, fragment = ( str(item) for item in urlsplit(request.url) ) default_port = {"http": 80, "ws": 80, "https": 443, "wss": 443}[scheme] if ":" in netloc: host, port_string = netloc.split(":", 1) port = int(port_string) else: host = netloc port = default_port # Include the 'host' header. if "host" in request.headers: headers: typing.List[typing.Tuple[bytes, bytes]] = [] elif port == default_port: headers = [(b"host", host.encode())] else: headers = [(b"host", (f"{host}:{port}").encode())] # Include other request headers. headers += [ (key.lower().encode(), value.encode()) for key, value in request.headers.items() ] if scheme in {"ws", "wss"}: subprotocol = request.headers.get("sec-websocket-protocol", None) if subprotocol is None: subprotocols: typing.Sequence[str] = [] else: subprotocols = [value.strip() for value in subprotocol.split(",")] scope = { "type": "websocket", "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "subprotocols": subprotocols, } session = WebSocketTestSession(self.app, scope, self.portal_factory) raise _Upgrade(session) scope = { "type": "http", "http_version": "1.1", "method": request.method, "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "extensions": {"http.response.template": {}}, } request_complete = False response_started = False response_complete: anyio.Event raw_kwargs: typing.Dict[str, typing.Any] = {"body": io.BytesIO()} template = None context = None async def receive() -> Message: nonlocal request_complete if request_complete: if not response_complete.is_set(): await response_complete.wait() return {"type": "http.disconnect"} body = request.body if isinstance(body, str): body_bytes: bytes = body.encode("utf-8") elif body is None: body_bytes = b"" elif isinstance(body, types.GeneratorType): try: chunk = body.send(None) if isinstance(chunk, str): chunk = chunk.encode("utf-8") return {"type": "http.request", "body": chunk, "more_body": True} except StopIteration: request_complete = True return {"type": "http.request", "body": b""} else: body_bytes = body request_complete = True return {"type": "http.request", "body": body_bytes} async def send(message: Message) -> None: nonlocal raw_kwargs, response_started, template, context if message["type"] == "http.response.start": assert ( not response_started ), 'Received multiple "http.response.start" messages.' raw_kwargs["version"] = 11 raw_kwargs["status"] = message["status"] raw_kwargs["reason"] = _get_reason_phrase(message["status"]) raw_kwargs["headers"] = [ (key.decode(), value.decode()) for key, value in message.get("headers", []) ] raw_kwargs["preload_content"] = False raw_kwargs["original_response"] = _MockOriginalResponse( raw_kwargs["headers"] ) response_started = True elif message["type"] == "http.response.body": assert ( response_started ), 'Received "http.response.body" without "http.response.start".' assert ( not response_complete.is_set() ), 'Received "http.response.body" after response completed.' body = message.get("body", b"") more_body = message.get("more_body", False) if request.method != "HEAD": raw_kwargs["body"].write(body) if not more_body: raw_kwargs["body"].seek(0) response_complete.set() elif message["type"] == "http.response.template": template = message["template"] context = message["context"] try: with self.portal_factory() as portal: > response_complete = portal.call(anyio.Event) E AttributeError: module 'anyio' has no attribute 'Event' /usr/lib/python3/dist-packages/starlette/testclient.py:262: AttributeError _______________________________ test_read_heroes _______________________________ session = client = def test_read_heroes(session: Session, client: TestClient): hero_1 = Hero(name="Deadpond", secret_name="Dive Wilson") hero_2 = Hero(name="Rusty-Man", secret_name="Tommy Sharp", age=48) session.add(hero_1) session.add(hero_2) session.commit() > response = client.get("/heroes/") docs_src/tutorial/fastapi/app_testing/tutorial001/test_main.py:68: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3/dist-packages/requests/sessions.py:555: in get return self.request('GET', url, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:468: in request return super().request( /usr/lib/python3/dist-packages/requests/sessions.py:542: in request resp = self.send(prep, **send_kwargs) /usr/lib/python3/dist-packages/requests/sessions.py:655: in send r = adapter.send(request, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:266: in send raise exc _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , args = () kwargs = {'cert': None, 'proxies': OrderedDict([('no', 'localhost'), ('https', 'https://127.0.0.1:9/'), ('http', 'http://127.0.0.1:9/')]), 'stream': False, 'timeout': None, ...} scheme = 'http', netloc = 'testserver', path = '/heroes/', query = '' fragment = '', default_port = 80, host = 'testserver', port = 80 headers = [(b'host', b'testserver'), (b'user-agent', b'testclient'), (b'accept-encoding', b'gzip, deflate'), (b'accept', b'*/*'), (b'connection', b'keep-alive')] def send( self, request: requests.PreparedRequest, *args: typing.Any, **kwargs: typing.Any ) -> requests.Response: scheme, netloc, path, query, fragment = ( str(item) for item in urlsplit(request.url) ) default_port = {"http": 80, "ws": 80, "https": 443, "wss": 443}[scheme] if ":" in netloc: host, port_string = netloc.split(":", 1) port = int(port_string) else: host = netloc port = default_port # Include the 'host' header. if "host" in request.headers: headers: typing.List[typing.Tuple[bytes, bytes]] = [] elif port == default_port: headers = [(b"host", host.encode())] else: headers = [(b"host", (f"{host}:{port}").encode())] # Include other request headers. headers += [ (key.lower().encode(), value.encode()) for key, value in request.headers.items() ] if scheme in {"ws", "wss"}: subprotocol = request.headers.get("sec-websocket-protocol", None) if subprotocol is None: subprotocols: typing.Sequence[str] = [] else: subprotocols = [value.strip() for value in subprotocol.split(",")] scope = { "type": "websocket", "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "subprotocols": subprotocols, } session = WebSocketTestSession(self.app, scope, self.portal_factory) raise _Upgrade(session) scope = { "type": "http", "http_version": "1.1", "method": request.method, "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "extensions": {"http.response.template": {}}, } request_complete = False response_started = False response_complete: anyio.Event raw_kwargs: typing.Dict[str, typing.Any] = {"body": io.BytesIO()} template = None context = None async def receive() -> Message: nonlocal request_complete if request_complete: if not response_complete.is_set(): await response_complete.wait() return {"type": "http.disconnect"} body = request.body if isinstance(body, str): body_bytes: bytes = body.encode("utf-8") elif body is None: body_bytes = b"" elif isinstance(body, types.GeneratorType): try: chunk = body.send(None) if isinstance(chunk, str): chunk = chunk.encode("utf-8") return {"type": "http.request", "body": chunk, "more_body": True} except StopIteration: request_complete = True return {"type": "http.request", "body": b""} else: body_bytes = body request_complete = True return {"type": "http.request", "body": body_bytes} async def send(message: Message) -> None: nonlocal raw_kwargs, response_started, template, context if message["type"] == "http.response.start": assert ( not response_started ), 'Received multiple "http.response.start" messages.' raw_kwargs["version"] = 11 raw_kwargs["status"] = message["status"] raw_kwargs["reason"] = _get_reason_phrase(message["status"]) raw_kwargs["headers"] = [ (key.decode(), value.decode()) for key, value in message.get("headers", []) ] raw_kwargs["preload_content"] = False raw_kwargs["original_response"] = _MockOriginalResponse( raw_kwargs["headers"] ) response_started = True elif message["type"] == "http.response.body": assert ( response_started ), 'Received "http.response.body" without "http.response.start".' assert ( not response_complete.is_set() ), 'Received "http.response.body" after response completed.' body = message.get("body", b"") more_body = message.get("more_body", False) if request.method != "HEAD": raw_kwargs["body"].write(body) if not more_body: raw_kwargs["body"].seek(0) response_complete.set() elif message["type"] == "http.response.template": template = message["template"] context = message["context"] try: with self.portal_factory() as portal: > response_complete = portal.call(anyio.Event) E AttributeError: module 'anyio' has no attribute 'Event' /usr/lib/python3/dist-packages/starlette/testclient.py:262: AttributeError ________________________________ test_read_hero ________________________________ session = client = def test_read_hero(session: Session, client: TestClient): hero_1 = Hero(name="Deadpond", secret_name="Dive Wilson") session.add(hero_1) session.commit() > response = client.get(f"/heroes/{hero_1.id}") docs_src/tutorial/fastapi/app_testing/tutorial001/test_main.py:89: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3/dist-packages/requests/sessions.py:555: in get return self.request('GET', url, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:468: in request return super().request( /usr/lib/python3/dist-packages/requests/sessions.py:542: in request resp = self.send(prep, **send_kwargs) /usr/lib/python3/dist-packages/requests/sessions.py:655: in send r = adapter.send(request, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:266: in send raise exc _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , args = () kwargs = {'cert': None, 'proxies': OrderedDict([('no', 'localhost'), ('https', 'https://127.0.0.1:9/'), ('http', 'http://127.0.0.1:9/')]), 'stream': False, 'timeout': None, ...} scheme = 'http', netloc = 'testserver', path = '/heroes/1', query = '' fragment = '', default_port = 80, host = 'testserver', port = 80 headers = [(b'host', b'testserver'), (b'user-agent', b'testclient'), (b'accept-encoding', b'gzip, deflate'), (b'accept', b'*/*'), (b'connection', b'keep-alive')] def send( self, request: requests.PreparedRequest, *args: typing.Any, **kwargs: typing.Any ) -> requests.Response: scheme, netloc, path, query, fragment = ( str(item) for item in urlsplit(request.url) ) default_port = {"http": 80, "ws": 80, "https": 443, "wss": 443}[scheme] if ":" in netloc: host, port_string = netloc.split(":", 1) port = int(port_string) else: host = netloc port = default_port # Include the 'host' header. if "host" in request.headers: headers: typing.List[typing.Tuple[bytes, bytes]] = [] elif port == default_port: headers = [(b"host", host.encode())] else: headers = [(b"host", (f"{host}:{port}").encode())] # Include other request headers. headers += [ (key.lower().encode(), value.encode()) for key, value in request.headers.items() ] if scheme in {"ws", "wss"}: subprotocol = request.headers.get("sec-websocket-protocol", None) if subprotocol is None: subprotocols: typing.Sequence[str] = [] else: subprotocols = [value.strip() for value in subprotocol.split(",")] scope = { "type": "websocket", "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "subprotocols": subprotocols, } session = WebSocketTestSession(self.app, scope, self.portal_factory) raise _Upgrade(session) scope = { "type": "http", "http_version": "1.1", "method": request.method, "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "extensions": {"http.response.template": {}}, } request_complete = False response_started = False response_complete: anyio.Event raw_kwargs: typing.Dict[str, typing.Any] = {"body": io.BytesIO()} template = None context = None async def receive() -> Message: nonlocal request_complete if request_complete: if not response_complete.is_set(): await response_complete.wait() return {"type": "http.disconnect"} body = request.body if isinstance(body, str): body_bytes: bytes = body.encode("utf-8") elif body is None: body_bytes = b"" elif isinstance(body, types.GeneratorType): try: chunk = body.send(None) if isinstance(chunk, str): chunk = chunk.encode("utf-8") return {"type": "http.request", "body": chunk, "more_body": True} except StopIteration: request_complete = True return {"type": "http.request", "body": b""} else: body_bytes = body request_complete = True return {"type": "http.request", "body": body_bytes} async def send(message: Message) -> None: nonlocal raw_kwargs, response_started, template, context if message["type"] == "http.response.start": assert ( not response_started ), 'Received multiple "http.response.start" messages.' raw_kwargs["version"] = 11 raw_kwargs["status"] = message["status"] raw_kwargs["reason"] = _get_reason_phrase(message["status"]) raw_kwargs["headers"] = [ (key.decode(), value.decode()) for key, value in message.get("headers", []) ] raw_kwargs["preload_content"] = False raw_kwargs["original_response"] = _MockOriginalResponse( raw_kwargs["headers"] ) response_started = True elif message["type"] == "http.response.body": assert ( response_started ), 'Received "http.response.body" without "http.response.start".' assert ( not response_complete.is_set() ), 'Received "http.response.body" after response completed.' body = message.get("body", b"") more_body = message.get("more_body", False) if request.method != "HEAD": raw_kwargs["body"].write(body) if not more_body: raw_kwargs["body"].seek(0) response_complete.set() elif message["type"] == "http.response.template": template = message["template"] context = message["context"] try: with self.portal_factory() as portal: > response_complete = portal.call(anyio.Event) E AttributeError: module 'anyio' has no attribute 'Event' /usr/lib/python3/dist-packages/starlette/testclient.py:262: AttributeError _______________________________ test_update_hero _______________________________ session = client = def test_update_hero(session: Session, client: TestClient): hero_1 = Hero(name="Deadpond", secret_name="Dive Wilson") session.add(hero_1) session.commit() > response = client.patch(f"/heroes/{hero_1.id}", json={"name": "Deadpuddle"}) docs_src/tutorial/fastapi/app_testing/tutorial001/test_main.py:104: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3/dist-packages/requests/sessions.py:614: in patch return self.request('PATCH', url, data=data, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:468: in request return super().request( /usr/lib/python3/dist-packages/requests/sessions.py:542: in request resp = self.send(prep, **send_kwargs) /usr/lib/python3/dist-packages/requests/sessions.py:655: in send r = adapter.send(request, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:266: in send raise exc _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , args = () kwargs = {'cert': None, 'proxies': OrderedDict([('no', 'localhost'), ('https', 'https://127.0.0.1:9/'), ('http', 'http://127.0.0.1:9/')]), 'stream': False, 'timeout': None, ...} scheme = 'http', netloc = 'testserver', path = '/heroes/1', query = '' fragment = '', default_port = 80, host = 'testserver', port = 80 headers = [(b'host', b'testserver'), (b'user-agent', b'testclient'), (b'accept-encoding', b'gzip, deflate'), (b'accept', b'*/*'), (b'connection', b'keep-alive'), (b'content-length', b'22'), ...] def send( self, request: requests.PreparedRequest, *args: typing.Any, **kwargs: typing.Any ) -> requests.Response: scheme, netloc, path, query, fragment = ( str(item) for item in urlsplit(request.url) ) default_port = {"http": 80, "ws": 80, "https": 443, "wss": 443}[scheme] if ":" in netloc: host, port_string = netloc.split(":", 1) port = int(port_string) else: host = netloc port = default_port # Include the 'host' header. if "host" in request.headers: headers: typing.List[typing.Tuple[bytes, bytes]] = [] elif port == default_port: headers = [(b"host", host.encode())] else: headers = [(b"host", (f"{host}:{port}").encode())] # Include other request headers. headers += [ (key.lower().encode(), value.encode()) for key, value in request.headers.items() ] if scheme in {"ws", "wss"}: subprotocol = request.headers.get("sec-websocket-protocol", None) if subprotocol is None: subprotocols: typing.Sequence[str] = [] else: subprotocols = [value.strip() for value in subprotocol.split(",")] scope = { "type": "websocket", "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "subprotocols": subprotocols, } session = WebSocketTestSession(self.app, scope, self.portal_factory) raise _Upgrade(session) scope = { "type": "http", "http_version": "1.1", "method": request.method, "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "extensions": {"http.response.template": {}}, } request_complete = False response_started = False response_complete: anyio.Event raw_kwargs: typing.Dict[str, typing.Any] = {"body": io.BytesIO()} template = None context = None async def receive() -> Message: nonlocal request_complete if request_complete: if not response_complete.is_set(): await response_complete.wait() return {"type": "http.disconnect"} body = request.body if isinstance(body, str): body_bytes: bytes = body.encode("utf-8") elif body is None: body_bytes = b"" elif isinstance(body, types.GeneratorType): try: chunk = body.send(None) if isinstance(chunk, str): chunk = chunk.encode("utf-8") return {"type": "http.request", "body": chunk, "more_body": True} except StopIteration: request_complete = True return {"type": "http.request", "body": b""} else: body_bytes = body request_complete = True return {"type": "http.request", "body": body_bytes} async def send(message: Message) -> None: nonlocal raw_kwargs, response_started, template, context if message["type"] == "http.response.start": assert ( not response_started ), 'Received multiple "http.response.start" messages.' raw_kwargs["version"] = 11 raw_kwargs["status"] = message["status"] raw_kwargs["reason"] = _get_reason_phrase(message["status"]) raw_kwargs["headers"] = [ (key.decode(), value.decode()) for key, value in message.get("headers", []) ] raw_kwargs["preload_content"] = False raw_kwargs["original_response"] = _MockOriginalResponse( raw_kwargs["headers"] ) response_started = True elif message["type"] == "http.response.body": assert ( response_started ), 'Received "http.response.body" without "http.response.start".' assert ( not response_complete.is_set() ), 'Received "http.response.body" after response completed.' body = message.get("body", b"") more_body = message.get("more_body", False) if request.method != "HEAD": raw_kwargs["body"].write(body) if not more_body: raw_kwargs["body"].seek(0) response_complete.set() elif message["type"] == "http.response.template": template = message["template"] context = message["context"] try: with self.portal_factory() as portal: > response_complete = portal.call(anyio.Event) E AttributeError: module 'anyio' has no attribute 'Event' /usr/lib/python3/dist-packages/starlette/testclient.py:262: AttributeError _______________________________ test_delete_hero _______________________________ session = client = def test_delete_hero(session: Session, client: TestClient): hero_1 = Hero(name="Deadpond", secret_name="Dive Wilson") session.add(hero_1) session.commit() > response = client.delete(f"/heroes/{hero_1.id}") docs_src/tutorial/fastapi/app_testing/tutorial001/test_main.py:119: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3/dist-packages/requests/sessions.py:624: in delete return self.request('DELETE', url, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:468: in request return super().request( /usr/lib/python3/dist-packages/requests/sessions.py:542: in request resp = self.send(prep, **send_kwargs) /usr/lib/python3/dist-packages/requests/sessions.py:655: in send r = adapter.send(request, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:266: in send raise exc _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , args = () kwargs = {'cert': None, 'proxies': OrderedDict([('no', 'localhost'), ('https', 'https://127.0.0.1:9/'), ('http', 'http://127.0.0.1:9/')]), 'stream': False, 'timeout': None, ...} scheme = 'http', netloc = 'testserver', path = '/heroes/1', query = '' fragment = '', default_port = 80, host = 'testserver', port = 80 headers = [(b'host', b'testserver'), (b'user-agent', b'testclient'), (b'accept-encoding', b'gzip, deflate'), (b'accept', b'*/*'), (b'connection', b'keep-alive'), (b'content-length', b'0')] def send( self, request: requests.PreparedRequest, *args: typing.Any, **kwargs: typing.Any ) -> requests.Response: scheme, netloc, path, query, fragment = ( str(item) for item in urlsplit(request.url) ) default_port = {"http": 80, "ws": 80, "https": 443, "wss": 443}[scheme] if ":" in netloc: host, port_string = netloc.split(":", 1) port = int(port_string) else: host = netloc port = default_port # Include the 'host' header. if "host" in request.headers: headers: typing.List[typing.Tuple[bytes, bytes]] = [] elif port == default_port: headers = [(b"host", host.encode())] else: headers = [(b"host", (f"{host}:{port}").encode())] # Include other request headers. headers += [ (key.lower().encode(), value.encode()) for key, value in request.headers.items() ] if scheme in {"ws", "wss"}: subprotocol = request.headers.get("sec-websocket-protocol", None) if subprotocol is None: subprotocols: typing.Sequence[str] = [] else: subprotocols = [value.strip() for value in subprotocol.split(",")] scope = { "type": "websocket", "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "subprotocols": subprotocols, } session = WebSocketTestSession(self.app, scope, self.portal_factory) raise _Upgrade(session) scope = { "type": "http", "http_version": "1.1", "method": request.method, "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "extensions": {"http.response.template": {}}, } request_complete = False response_started = False response_complete: anyio.Event raw_kwargs: typing.Dict[str, typing.Any] = {"body": io.BytesIO()} template = None context = None async def receive() -> Message: nonlocal request_complete if request_complete: if not response_complete.is_set(): await response_complete.wait() return {"type": "http.disconnect"} body = request.body if isinstance(body, str): body_bytes: bytes = body.encode("utf-8") elif body is None: body_bytes = b"" elif isinstance(body, types.GeneratorType): try: chunk = body.send(None) if isinstance(chunk, str): chunk = chunk.encode("utf-8") return {"type": "http.request", "body": chunk, "more_body": True} except StopIteration: request_complete = True return {"type": "http.request", "body": b""} else: body_bytes = body request_complete = True return {"type": "http.request", "body": body_bytes} async def send(message: Message) -> None: nonlocal raw_kwargs, response_started, template, context if message["type"] == "http.response.start": assert ( not response_started ), 'Received multiple "http.response.start" messages.' raw_kwargs["version"] = 11 raw_kwargs["status"] = message["status"] raw_kwargs["reason"] = _get_reason_phrase(message["status"]) raw_kwargs["headers"] = [ (key.decode(), value.decode()) for key, value in message.get("headers", []) ] raw_kwargs["preload_content"] = False raw_kwargs["original_response"] = _MockOriginalResponse( raw_kwargs["headers"] ) response_started = True elif message["type"] == "http.response.body": assert ( response_started ), 'Received "http.response.body" without "http.response.start".' assert ( not response_complete.is_set() ), 'Received "http.response.body" after response completed.' body = message.get("body", b"") more_body = message.get("more_body", False) if request.method != "HEAD": raw_kwargs["body"].write(body) if not more_body: raw_kwargs["body"].seek(0) response_complete.set() elif message["type"] == "http.response.template": template = message["template"] context = message["context"] try: with self.portal_factory() as portal: > response_complete = portal.call(anyio.Event) E AttributeError: module 'anyio' has no attribute 'Event' /usr/lib/python3/dist-packages/starlette/testclient.py:262: AttributeError _______________________________ test_create_hero _______________________________ def test_create_hero(): engine = create_engine( "sqlite:///testing.db", connect_args={"check_same_thread": False} ) SQLModel.metadata.create_all(engine) with Session(engine) as session: def get_session_override(): return session app.dependency_overrides[get_session] = get_session_override client = TestClient(app) # (2) > response = client.post( # (3) "/heroes/", json={"name": "Deadpond", "secret_name": "Dive Wilson"} ) docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_001.py:22: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3/dist-packages/requests/sessions.py:590: in post return self.request('POST', url, data=data, json=json, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:468: in request return super().request( /usr/lib/python3/dist-packages/requests/sessions.py:542: in request resp = self.send(prep, **send_kwargs) /usr/lib/python3/dist-packages/requests/sessions.py:655: in send r = adapter.send(request, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:266: in send raise exc _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , args = () kwargs = {'cert': None, 'proxies': OrderedDict([('no', 'localhost'), ('https', 'https://127.0.0.1:9/'), ('http', 'http://127.0.0.1:9/')]), 'stream': False, 'timeout': None, ...} scheme = 'http', netloc = 'testserver', path = '/heroes/', query = '' fragment = '', default_port = 80, host = 'testserver', port = 80 headers = [(b'host', b'testserver'), (b'user-agent', b'testclient'), (b'accept-encoding', b'gzip, deflate'), (b'accept', b'*/*'), (b'connection', b'keep-alive'), (b'content-length', b'50'), ...] def send( self, request: requests.PreparedRequest, *args: typing.Any, **kwargs: typing.Any ) -> requests.Response: scheme, netloc, path, query, fragment = ( str(item) for item in urlsplit(request.url) ) default_port = {"http": 80, "ws": 80, "https": 443, "wss": 443}[scheme] if ":" in netloc: host, port_string = netloc.split(":", 1) port = int(port_string) else: host = netloc port = default_port # Include the 'host' header. if "host" in request.headers: headers: typing.List[typing.Tuple[bytes, bytes]] = [] elif port == default_port: headers = [(b"host", host.encode())] else: headers = [(b"host", (f"{host}:{port}").encode())] # Include other request headers. headers += [ (key.lower().encode(), value.encode()) for key, value in request.headers.items() ] if scheme in {"ws", "wss"}: subprotocol = request.headers.get("sec-websocket-protocol", None) if subprotocol is None: subprotocols: typing.Sequence[str] = [] else: subprotocols = [value.strip() for value in subprotocol.split(",")] scope = { "type": "websocket", "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "subprotocols": subprotocols, } session = WebSocketTestSession(self.app, scope, self.portal_factory) raise _Upgrade(session) scope = { "type": "http", "http_version": "1.1", "method": request.method, "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "extensions": {"http.response.template": {}}, } request_complete = False response_started = False response_complete: anyio.Event raw_kwargs: typing.Dict[str, typing.Any] = {"body": io.BytesIO()} template = None context = None async def receive() -> Message: nonlocal request_complete if request_complete: if not response_complete.is_set(): await response_complete.wait() return {"type": "http.disconnect"} body = request.body if isinstance(body, str): body_bytes: bytes = body.encode("utf-8") elif body is None: body_bytes = b"" elif isinstance(body, types.GeneratorType): try: chunk = body.send(None) if isinstance(chunk, str): chunk = chunk.encode("utf-8") return {"type": "http.request", "body": chunk, "more_body": True} except StopIteration: request_complete = True return {"type": "http.request", "body": b""} else: body_bytes = body request_complete = True return {"type": "http.request", "body": body_bytes} async def send(message: Message) -> None: nonlocal raw_kwargs, response_started, template, context if message["type"] == "http.response.start": assert ( not response_started ), 'Received multiple "http.response.start" messages.' raw_kwargs["version"] = 11 raw_kwargs["status"] = message["status"] raw_kwargs["reason"] = _get_reason_phrase(message["status"]) raw_kwargs["headers"] = [ (key.decode(), value.decode()) for key, value in message.get("headers", []) ] raw_kwargs["preload_content"] = False raw_kwargs["original_response"] = _MockOriginalResponse( raw_kwargs["headers"] ) response_started = True elif message["type"] == "http.response.body": assert ( response_started ), 'Received "http.response.body" without "http.response.start".' assert ( not response_complete.is_set() ), 'Received "http.response.body" after response completed.' body = message.get("body", b"") more_body = message.get("more_body", False) if request.method != "HEAD": raw_kwargs["body"].write(body) if not more_body: raw_kwargs["body"].seek(0) response_complete.set() elif message["type"] == "http.response.template": template = message["template"] context = message["context"] try: with self.portal_factory() as portal: > response_complete = portal.call(anyio.Event) E AttributeError: module 'anyio' has no attribute 'Event' /usr/lib/python3/dist-packages/starlette/testclient.py:262: AttributeError _______________________________ test_create_hero _______________________________ def test_create_hero(): engine = create_engine( "sqlite:///testing.db", connect_args={"check_same_thread": False} ) SQLModel.metadata.create_all(engine) with Session(engine) as session: def get_session_override(): # (2) return session # (3) app.dependency_overrides[get_session] = get_session_override # (4) client = TestClient(app) > response = client.post( "/heroes/", json={"name": "Deadpond", "secret_name": "Dive Wilson"} ) docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_002.py:22: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3/dist-packages/requests/sessions.py:590: in post return self.request('POST', url, data=data, json=json, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:468: in request return super().request( /usr/lib/python3/dist-packages/requests/sessions.py:542: in request resp = self.send(prep, **send_kwargs) /usr/lib/python3/dist-packages/requests/sessions.py:655: in send r = adapter.send(request, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:266: in send raise exc _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , args = () kwargs = {'cert': None, 'proxies': OrderedDict([('no', 'localhost'), ('https', 'https://127.0.0.1:9/'), ('http', 'http://127.0.0.1:9/')]), 'stream': False, 'timeout': None, ...} scheme = 'http', netloc = 'testserver', path = '/heroes/', query = '' fragment = '', default_port = 80, host = 'testserver', port = 80 headers = [(b'host', b'testserver'), (b'user-agent', b'testclient'), (b'accept-encoding', b'gzip, deflate'), (b'accept', b'*/*'), (b'connection', b'keep-alive'), (b'content-length', b'50'), ...] def send( self, request: requests.PreparedRequest, *args: typing.Any, **kwargs: typing.Any ) -> requests.Response: scheme, netloc, path, query, fragment = ( str(item) for item in urlsplit(request.url) ) default_port = {"http": 80, "ws": 80, "https": 443, "wss": 443}[scheme] if ":" in netloc: host, port_string = netloc.split(":", 1) port = int(port_string) else: host = netloc port = default_port # Include the 'host' header. if "host" in request.headers: headers: typing.List[typing.Tuple[bytes, bytes]] = [] elif port == default_port: headers = [(b"host", host.encode())] else: headers = [(b"host", (f"{host}:{port}").encode())] # Include other request headers. headers += [ (key.lower().encode(), value.encode()) for key, value in request.headers.items() ] if scheme in {"ws", "wss"}: subprotocol = request.headers.get("sec-websocket-protocol", None) if subprotocol is None: subprotocols: typing.Sequence[str] = [] else: subprotocols = [value.strip() for value in subprotocol.split(",")] scope = { "type": "websocket", "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "subprotocols": subprotocols, } session = WebSocketTestSession(self.app, scope, self.portal_factory) raise _Upgrade(session) scope = { "type": "http", "http_version": "1.1", "method": request.method, "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "extensions": {"http.response.template": {}}, } request_complete = False response_started = False response_complete: anyio.Event raw_kwargs: typing.Dict[str, typing.Any] = {"body": io.BytesIO()} template = None context = None async def receive() -> Message: nonlocal request_complete if request_complete: if not response_complete.is_set(): await response_complete.wait() return {"type": "http.disconnect"} body = request.body if isinstance(body, str): body_bytes: bytes = body.encode("utf-8") elif body is None: body_bytes = b"" elif isinstance(body, types.GeneratorType): try: chunk = body.send(None) if isinstance(chunk, str): chunk = chunk.encode("utf-8") return {"type": "http.request", "body": chunk, "more_body": True} except StopIteration: request_complete = True return {"type": "http.request", "body": b""} else: body_bytes = body request_complete = True return {"type": "http.request", "body": body_bytes} async def send(message: Message) -> None: nonlocal raw_kwargs, response_started, template, context if message["type"] == "http.response.start": assert ( not response_started ), 'Received multiple "http.response.start" messages.' raw_kwargs["version"] = 11 raw_kwargs["status"] = message["status"] raw_kwargs["reason"] = _get_reason_phrase(message["status"]) raw_kwargs["headers"] = [ (key.decode(), value.decode()) for key, value in message.get("headers", []) ] raw_kwargs["preload_content"] = False raw_kwargs["original_response"] = _MockOriginalResponse( raw_kwargs["headers"] ) response_started = True elif message["type"] == "http.response.body": assert ( response_started ), 'Received "http.response.body" without "http.response.start".' assert ( not response_complete.is_set() ), 'Received "http.response.body" after response completed.' body = message.get("body", b"") more_body = message.get("more_body", False) if request.method != "HEAD": raw_kwargs["body"].write(body) if not more_body: raw_kwargs["body"].seek(0) response_complete.set() elif message["type"] == "http.response.template": template = message["template"] context = message["context"] try: with self.portal_factory() as portal: > response_complete = portal.call(anyio.Event) E AttributeError: module 'anyio' has no attribute 'Event' /usr/lib/python3/dist-packages/starlette/testclient.py:262: AttributeError _______________________________ test_create_hero _______________________________ def test_create_hero(): engine = create_engine( # (2) "sqlite:///testing.db", connect_args={"check_same_thread": False} ) SQLModel.metadata.create_all(engine) # (3) with Session(engine) as session: # (4) def get_session_override(): return session # (5) app.dependency_overrides[get_session] = get_session_override # (4) client = TestClient(app) > response = client.post( "/heroes/", json={"name": "Deadpond", "secret_name": "Dive Wilson"} ) docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_003.py:22: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3/dist-packages/requests/sessions.py:590: in post return self.request('POST', url, data=data, json=json, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:468: in request return super().request( /usr/lib/python3/dist-packages/requests/sessions.py:542: in request resp = self.send(prep, **send_kwargs) /usr/lib/python3/dist-packages/requests/sessions.py:655: in send r = adapter.send(request, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:266: in send raise exc _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , args = () kwargs = {'cert': None, 'proxies': OrderedDict([('no', 'localhost'), ('https', 'https://127.0.0.1:9/'), ('http', 'http://127.0.0.1:9/')]), 'stream': False, 'timeout': None, ...} scheme = 'http', netloc = 'testserver', path = '/heroes/', query = '' fragment = '', default_port = 80, host = 'testserver', port = 80 headers = [(b'host', b'testserver'), (b'user-agent', b'testclient'), (b'accept-encoding', b'gzip, deflate'), (b'accept', b'*/*'), (b'connection', b'keep-alive'), (b'content-length', b'50'), ...] def send( self, request: requests.PreparedRequest, *args: typing.Any, **kwargs: typing.Any ) -> requests.Response: scheme, netloc, path, query, fragment = ( str(item) for item in urlsplit(request.url) ) default_port = {"http": 80, "ws": 80, "https": 443, "wss": 443}[scheme] if ":" in netloc: host, port_string = netloc.split(":", 1) port = int(port_string) else: host = netloc port = default_port # Include the 'host' header. if "host" in request.headers: headers: typing.List[typing.Tuple[bytes, bytes]] = [] elif port == default_port: headers = [(b"host", host.encode())] else: headers = [(b"host", (f"{host}:{port}").encode())] # Include other request headers. headers += [ (key.lower().encode(), value.encode()) for key, value in request.headers.items() ] if scheme in {"ws", "wss"}: subprotocol = request.headers.get("sec-websocket-protocol", None) if subprotocol is None: subprotocols: typing.Sequence[str] = [] else: subprotocols = [value.strip() for value in subprotocol.split(",")] scope = { "type": "websocket", "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "subprotocols": subprotocols, } session = WebSocketTestSession(self.app, scope, self.portal_factory) raise _Upgrade(session) scope = { "type": "http", "http_version": "1.1", "method": request.method, "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "extensions": {"http.response.template": {}}, } request_complete = False response_started = False response_complete: anyio.Event raw_kwargs: typing.Dict[str, typing.Any] = {"body": io.BytesIO()} template = None context = None async def receive() -> Message: nonlocal request_complete if request_complete: if not response_complete.is_set(): await response_complete.wait() return {"type": "http.disconnect"} body = request.body if isinstance(body, str): body_bytes: bytes = body.encode("utf-8") elif body is None: body_bytes = b"" elif isinstance(body, types.GeneratorType): try: chunk = body.send(None) if isinstance(chunk, str): chunk = chunk.encode("utf-8") return {"type": "http.request", "body": chunk, "more_body": True} except StopIteration: request_complete = True return {"type": "http.request", "body": b""} else: body_bytes = body request_complete = True return {"type": "http.request", "body": body_bytes} async def send(message: Message) -> None: nonlocal raw_kwargs, response_started, template, context if message["type"] == "http.response.start": assert ( not response_started ), 'Received multiple "http.response.start" messages.' raw_kwargs["version"] = 11 raw_kwargs["status"] = message["status"] raw_kwargs["reason"] = _get_reason_phrase(message["status"]) raw_kwargs["headers"] = [ (key.decode(), value.decode()) for key, value in message.get("headers", []) ] raw_kwargs["preload_content"] = False raw_kwargs["original_response"] = _MockOriginalResponse( raw_kwargs["headers"] ) response_started = True elif message["type"] == "http.response.body": assert ( response_started ), 'Received "http.response.body" without "http.response.start".' assert ( not response_complete.is_set() ), 'Received "http.response.body" after response completed.' body = message.get("body", b"") more_body = message.get("more_body", False) if request.method != "HEAD": raw_kwargs["body"].write(body) if not more_body: raw_kwargs["body"].seek(0) response_complete.set() elif message["type"] == "http.response.template": template = message["template"] context = message["context"] try: with self.portal_factory() as portal: > response_complete = portal.call(anyio.Event) E AttributeError: module 'anyio' has no attribute 'Event' /usr/lib/python3/dist-packages/starlette/testclient.py:262: AttributeError _______________________________ test_create_hero _______________________________ def test_create_hero(): engine = create_engine( "sqlite://", # (2) connect_args={"check_same_thread": False}, poolclass=StaticPool, # (3) ) SQLModel.metadata.create_all(engine) with Session(engine) as session: def get_session_override(): return session app.dependency_overrides[get_session] = get_session_override client = TestClient(app) > response = client.post( "/heroes/", json={"name": "Deadpond", "secret_name": "Dive Wilson"} ) docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_004.py:25: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3/dist-packages/requests/sessions.py:590: in post return self.request('POST', url, data=data, json=json, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:468: in request return super().request( /usr/lib/python3/dist-packages/requests/sessions.py:542: in request resp = self.send(prep, **send_kwargs) /usr/lib/python3/dist-packages/requests/sessions.py:655: in send r = adapter.send(request, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:266: in send raise exc _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , args = () kwargs = {'cert': None, 'proxies': OrderedDict([('no', 'localhost'), ('https', 'https://127.0.0.1:9/'), ('http', 'http://127.0.0.1:9/')]), 'stream': False, 'timeout': None, ...} scheme = 'http', netloc = 'testserver', path = '/heroes/', query = '' fragment = '', default_port = 80, host = 'testserver', port = 80 headers = [(b'host', b'testserver'), (b'user-agent', b'testclient'), (b'accept-encoding', b'gzip, deflate'), (b'accept', b'*/*'), (b'connection', b'keep-alive'), (b'content-length', b'50'), ...] def send( self, request: requests.PreparedRequest, *args: typing.Any, **kwargs: typing.Any ) -> requests.Response: scheme, netloc, path, query, fragment = ( str(item) for item in urlsplit(request.url) ) default_port = {"http": 80, "ws": 80, "https": 443, "wss": 443}[scheme] if ":" in netloc: host, port_string = netloc.split(":", 1) port = int(port_string) else: host = netloc port = default_port # Include the 'host' header. if "host" in request.headers: headers: typing.List[typing.Tuple[bytes, bytes]] = [] elif port == default_port: headers = [(b"host", host.encode())] else: headers = [(b"host", (f"{host}:{port}").encode())] # Include other request headers. headers += [ (key.lower().encode(), value.encode()) for key, value in request.headers.items() ] if scheme in {"ws", "wss"}: subprotocol = request.headers.get("sec-websocket-protocol", None) if subprotocol is None: subprotocols: typing.Sequence[str] = [] else: subprotocols = [value.strip() for value in subprotocol.split(",")] scope = { "type": "websocket", "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "subprotocols": subprotocols, } session = WebSocketTestSession(self.app, scope, self.portal_factory) raise _Upgrade(session) scope = { "type": "http", "http_version": "1.1", "method": request.method, "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "extensions": {"http.response.template": {}}, } request_complete = False response_started = False response_complete: anyio.Event raw_kwargs: typing.Dict[str, typing.Any] = {"body": io.BytesIO()} template = None context = None async def receive() -> Message: nonlocal request_complete if request_complete: if not response_complete.is_set(): await response_complete.wait() return {"type": "http.disconnect"} body = request.body if isinstance(body, str): body_bytes: bytes = body.encode("utf-8") elif body is None: body_bytes = b"" elif isinstance(body, types.GeneratorType): try: chunk = body.send(None) if isinstance(chunk, str): chunk = chunk.encode("utf-8") return {"type": "http.request", "body": chunk, "more_body": True} except StopIteration: request_complete = True return {"type": "http.request", "body": b""} else: body_bytes = body request_complete = True return {"type": "http.request", "body": body_bytes} async def send(message: Message) -> None: nonlocal raw_kwargs, response_started, template, context if message["type"] == "http.response.start": assert ( not response_started ), 'Received multiple "http.response.start" messages.' raw_kwargs["version"] = 11 raw_kwargs["status"] = message["status"] raw_kwargs["reason"] = _get_reason_phrase(message["status"]) raw_kwargs["headers"] = [ (key.decode(), value.decode()) for key, value in message.get("headers", []) ] raw_kwargs["preload_content"] = False raw_kwargs["original_response"] = _MockOriginalResponse( raw_kwargs["headers"] ) response_started = True elif message["type"] == "http.response.body": assert ( response_started ), 'Received "http.response.body" without "http.response.start".' assert ( not response_complete.is_set() ), 'Received "http.response.body" after response completed.' body = message.get("body", b"") more_body = message.get("more_body", False) if request.method != "HEAD": raw_kwargs["body"].write(body) if not more_body: raw_kwargs["body"].seek(0) response_complete.set() elif message["type"] == "http.response.template": template = message["template"] context = message["context"] try: with self.portal_factory() as portal: > response_complete = portal.call(anyio.Event) E AttributeError: module 'anyio' has no attribute 'Event' /usr/lib/python3/dist-packages/starlette/testclient.py:262: AttributeError _______________________________ test_create_hero _______________________________ session = def test_create_hero(session: Session): # (5) def get_session_override(): return session # (6) app.dependency_overrides[get_session] = get_session_override client = TestClient(app) > response = client.post( "/heroes/", json={"name": "Deadpond", "secret_name": "Dive Wilson"} ) docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_005.py:27: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3/dist-packages/requests/sessions.py:590: in post return self.request('POST', url, data=data, json=json, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:468: in request return super().request( /usr/lib/python3/dist-packages/requests/sessions.py:542: in request resp = self.send(prep, **send_kwargs) /usr/lib/python3/dist-packages/requests/sessions.py:655: in send r = adapter.send(request, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:266: in send raise exc _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , args = () kwargs = {'cert': None, 'proxies': OrderedDict([('no', 'localhost'), ('https', 'https://127.0.0.1:9/'), ('http', 'http://127.0.0.1:9/')]), 'stream': False, 'timeout': None, ...} scheme = 'http', netloc = 'testserver', path = '/heroes/', query = '' fragment = '', default_port = 80, host = 'testserver', port = 80 headers = [(b'host', b'testserver'), (b'user-agent', b'testclient'), (b'accept-encoding', b'gzip, deflate'), (b'accept', b'*/*'), (b'connection', b'keep-alive'), (b'content-length', b'50'), ...] def send( self, request: requests.PreparedRequest, *args: typing.Any, **kwargs: typing.Any ) -> requests.Response: scheme, netloc, path, query, fragment = ( str(item) for item in urlsplit(request.url) ) default_port = {"http": 80, "ws": 80, "https": 443, "wss": 443}[scheme] if ":" in netloc: host, port_string = netloc.split(":", 1) port = int(port_string) else: host = netloc port = default_port # Include the 'host' header. if "host" in request.headers: headers: typing.List[typing.Tuple[bytes, bytes]] = [] elif port == default_port: headers = [(b"host", host.encode())] else: headers = [(b"host", (f"{host}:{port}").encode())] # Include other request headers. headers += [ (key.lower().encode(), value.encode()) for key, value in request.headers.items() ] if scheme in {"ws", "wss"}: subprotocol = request.headers.get("sec-websocket-protocol", None) if subprotocol is None: subprotocols: typing.Sequence[str] = [] else: subprotocols = [value.strip() for value in subprotocol.split(",")] scope = { "type": "websocket", "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "subprotocols": subprotocols, } session = WebSocketTestSession(self.app, scope, self.portal_factory) raise _Upgrade(session) scope = { "type": "http", "http_version": "1.1", "method": request.method, "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "extensions": {"http.response.template": {}}, } request_complete = False response_started = False response_complete: anyio.Event raw_kwargs: typing.Dict[str, typing.Any] = {"body": io.BytesIO()} template = None context = None async def receive() -> Message: nonlocal request_complete if request_complete: if not response_complete.is_set(): await response_complete.wait() return {"type": "http.disconnect"} body = request.body if isinstance(body, str): body_bytes: bytes = body.encode("utf-8") elif body is None: body_bytes = b"" elif isinstance(body, types.GeneratorType): try: chunk = body.send(None) if isinstance(chunk, str): chunk = chunk.encode("utf-8") return {"type": "http.request", "body": chunk, "more_body": True} except StopIteration: request_complete = True return {"type": "http.request", "body": b""} else: body_bytes = body request_complete = True return {"type": "http.request", "body": body_bytes} async def send(message: Message) -> None: nonlocal raw_kwargs, response_started, template, context if message["type"] == "http.response.start": assert ( not response_started ), 'Received multiple "http.response.start" messages.' raw_kwargs["version"] = 11 raw_kwargs["status"] = message["status"] raw_kwargs["reason"] = _get_reason_phrase(message["status"]) raw_kwargs["headers"] = [ (key.decode(), value.decode()) for key, value in message.get("headers", []) ] raw_kwargs["preload_content"] = False raw_kwargs["original_response"] = _MockOriginalResponse( raw_kwargs["headers"] ) response_started = True elif message["type"] == "http.response.body": assert ( response_started ), 'Received "http.response.body" without "http.response.start".' assert ( not response_complete.is_set() ), 'Received "http.response.body" after response completed.' body = message.get("body", b"") more_body = message.get("more_body", False) if request.method != "HEAD": raw_kwargs["body"].write(body) if not more_body: raw_kwargs["body"].seek(0) response_complete.set() elif message["type"] == "http.response.template": template = message["template"] context = message["context"] try: with self.portal_factory() as portal: > response_complete = portal.call(anyio.Event) E AttributeError: module 'anyio' has no attribute 'Event' /usr/lib/python3/dist-packages/starlette/testclient.py:262: AttributeError _______________________________ test_create_hero _______________________________ client = def test_create_hero(client: TestClient): # (8) > response = client.post( "/heroes/", json={"name": "Deadpond", "secret_name": "Dive Wilson"} ) docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_006.py:32: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3/dist-packages/requests/sessions.py:590: in post return self.request('POST', url, data=data, json=json, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:468: in request return super().request( /usr/lib/python3/dist-packages/requests/sessions.py:542: in request resp = self.send(prep, **send_kwargs) /usr/lib/python3/dist-packages/requests/sessions.py:655: in send r = adapter.send(request, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:266: in send raise exc _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , args = () kwargs = {'cert': None, 'proxies': OrderedDict([('no', 'localhost'), ('https', 'https://127.0.0.1:9/'), ('http', 'http://127.0.0.1:9/')]), 'stream': False, 'timeout': None, ...} scheme = 'http', netloc = 'testserver', path = '/heroes/', query = '' fragment = '', default_port = 80, host = 'testserver', port = 80 headers = [(b'host', b'testserver'), (b'user-agent', b'testclient'), (b'accept-encoding', b'gzip, deflate'), (b'accept', b'*/*'), (b'connection', b'keep-alive'), (b'content-length', b'50'), ...] def send( self, request: requests.PreparedRequest, *args: typing.Any, **kwargs: typing.Any ) -> requests.Response: scheme, netloc, path, query, fragment = ( str(item) for item in urlsplit(request.url) ) default_port = {"http": 80, "ws": 80, "https": 443, "wss": 443}[scheme] if ":" in netloc: host, port_string = netloc.split(":", 1) port = int(port_string) else: host = netloc port = default_port # Include the 'host' header. if "host" in request.headers: headers: typing.List[typing.Tuple[bytes, bytes]] = [] elif port == default_port: headers = [(b"host", host.encode())] else: headers = [(b"host", (f"{host}:{port}").encode())] # Include other request headers. headers += [ (key.lower().encode(), value.encode()) for key, value in request.headers.items() ] if scheme in {"ws", "wss"}: subprotocol = request.headers.get("sec-websocket-protocol", None) if subprotocol is None: subprotocols: typing.Sequence[str] = [] else: subprotocols = [value.strip() for value in subprotocol.split(",")] scope = { "type": "websocket", "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "subprotocols": subprotocols, } session = WebSocketTestSession(self.app, scope, self.portal_factory) raise _Upgrade(session) scope = { "type": "http", "http_version": "1.1", "method": request.method, "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "extensions": {"http.response.template": {}}, } request_complete = False response_started = False response_complete: anyio.Event raw_kwargs: typing.Dict[str, typing.Any] = {"body": io.BytesIO()} template = None context = None async def receive() -> Message: nonlocal request_complete if request_complete: if not response_complete.is_set(): await response_complete.wait() return {"type": "http.disconnect"} body = request.body if isinstance(body, str): body_bytes: bytes = body.encode("utf-8") elif body is None: body_bytes = b"" elif isinstance(body, types.GeneratorType): try: chunk = body.send(None) if isinstance(chunk, str): chunk = chunk.encode("utf-8") return {"type": "http.request", "body": chunk, "more_body": True} except StopIteration: request_complete = True return {"type": "http.request", "body": b""} else: body_bytes = body request_complete = True return {"type": "http.request", "body": body_bytes} async def send(message: Message) -> None: nonlocal raw_kwargs, response_started, template, context if message["type"] == "http.response.start": assert ( not response_started ), 'Received multiple "http.response.start" messages.' raw_kwargs["version"] = 11 raw_kwargs["status"] = message["status"] raw_kwargs["reason"] = _get_reason_phrase(message["status"]) raw_kwargs["headers"] = [ (key.decode(), value.decode()) for key, value in message.get("headers", []) ] raw_kwargs["preload_content"] = False raw_kwargs["original_response"] = _MockOriginalResponse( raw_kwargs["headers"] ) response_started = True elif message["type"] == "http.response.body": assert ( response_started ), 'Received "http.response.body" without "http.response.start".' assert ( not response_complete.is_set() ), 'Received "http.response.body" after response completed.' body = message.get("body", b"") more_body = message.get("more_body", False) if request.method != "HEAD": raw_kwargs["body"].write(body) if not more_body: raw_kwargs["body"].seek(0) response_complete.set() elif message["type"] == "http.response.template": template = message["template"] context = message["context"] try: with self.portal_factory() as portal: > response_complete = portal.call(anyio.Event) E AttributeError: module 'anyio' has no attribute 'Event' /usr/lib/python3/dist-packages/starlette/testclient.py:262: AttributeError ________________________________ test_tutorial _________________________________ def test_tutorial(): > test_mod.test_create_hero() tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests001.py:18: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_001.py:22: in test_create_hero response = client.post( # (3) /usr/lib/python3/dist-packages/requests/sessions.py:590: in post return self.request('POST', url, data=data, json=json, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:468: in request return super().request( /usr/lib/python3/dist-packages/requests/sessions.py:542: in request resp = self.send(prep, **send_kwargs) /usr/lib/python3/dist-packages/requests/sessions.py:655: in send r = adapter.send(request, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:266: in send raise exc _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , args = () kwargs = {'cert': None, 'proxies': OrderedDict([('no', 'localhost'), ('https', 'https://127.0.0.1:9/'), ('http', 'http://127.0.0.1:9/')]), 'stream': False, 'timeout': None, ...} scheme = 'http', netloc = 'testserver', path = '/heroes/', query = '' fragment = '', default_port = 80, host = 'testserver', port = 80 headers = [(b'host', b'testserver'), (b'user-agent', b'testclient'), (b'accept-encoding', b'gzip, deflate'), (b'accept', b'*/*'), (b'connection', b'keep-alive'), (b'content-length', b'50'), ...] def send( self, request: requests.PreparedRequest, *args: typing.Any, **kwargs: typing.Any ) -> requests.Response: scheme, netloc, path, query, fragment = ( str(item) for item in urlsplit(request.url) ) default_port = {"http": 80, "ws": 80, "https": 443, "wss": 443}[scheme] if ":" in netloc: host, port_string = netloc.split(":", 1) port = int(port_string) else: host = netloc port = default_port # Include the 'host' header. if "host" in request.headers: headers: typing.List[typing.Tuple[bytes, bytes]] = [] elif port == default_port: headers = [(b"host", host.encode())] else: headers = [(b"host", (f"{host}:{port}").encode())] # Include other request headers. headers += [ (key.lower().encode(), value.encode()) for key, value in request.headers.items() ] if scheme in {"ws", "wss"}: subprotocol = request.headers.get("sec-websocket-protocol", None) if subprotocol is None: subprotocols: typing.Sequence[str] = [] else: subprotocols = [value.strip() for value in subprotocol.split(",")] scope = { "type": "websocket", "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "subprotocols": subprotocols, } session = WebSocketTestSession(self.app, scope, self.portal_factory) raise _Upgrade(session) scope = { "type": "http", "http_version": "1.1", "method": request.method, "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "extensions": {"http.response.template": {}}, } request_complete = False response_started = False response_complete: anyio.Event raw_kwargs: typing.Dict[str, typing.Any] = {"body": io.BytesIO()} template = None context = None async def receive() -> Message: nonlocal request_complete if request_complete: if not response_complete.is_set(): await response_complete.wait() return {"type": "http.disconnect"} body = request.body if isinstance(body, str): body_bytes: bytes = body.encode("utf-8") elif body is None: body_bytes = b"" elif isinstance(body, types.GeneratorType): try: chunk = body.send(None) if isinstance(chunk, str): chunk = chunk.encode("utf-8") return {"type": "http.request", "body": chunk, "more_body": True} except StopIteration: request_complete = True return {"type": "http.request", "body": b""} else: body_bytes = body request_complete = True return {"type": "http.request", "body": body_bytes} async def send(message: Message) -> None: nonlocal raw_kwargs, response_started, template, context if message["type"] == "http.response.start": assert ( not response_started ), 'Received multiple "http.response.start" messages.' raw_kwargs["version"] = 11 raw_kwargs["status"] = message["status"] raw_kwargs["reason"] = _get_reason_phrase(message["status"]) raw_kwargs["headers"] = [ (key.decode(), value.decode()) for key, value in message.get("headers", []) ] raw_kwargs["preload_content"] = False raw_kwargs["original_response"] = _MockOriginalResponse( raw_kwargs["headers"] ) response_started = True elif message["type"] == "http.response.body": assert ( response_started ), 'Received "http.response.body" without "http.response.start".' assert ( not response_complete.is_set() ), 'Received "http.response.body" after response completed.' body = message.get("body", b"") more_body = message.get("more_body", False) if request.method != "HEAD": raw_kwargs["body"].write(body) if not more_body: raw_kwargs["body"].seek(0) response_complete.set() elif message["type"] == "http.response.template": template = message["template"] context = message["context"] try: with self.portal_factory() as portal: > response_complete = portal.call(anyio.Event) E AttributeError: module 'anyio' has no attribute 'Event' /usr/lib/python3/dist-packages/starlette/testclient.py:262: AttributeError ________________________________ test_tutorial _________________________________ def test_tutorial(): > test_mod.test_create_hero() tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests002.py:18: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_002.py:22: in test_create_hero response = client.post( /usr/lib/python3/dist-packages/requests/sessions.py:590: in post return self.request('POST', url, data=data, json=json, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:468: in request return super().request( /usr/lib/python3/dist-packages/requests/sessions.py:542: in request resp = self.send(prep, **send_kwargs) /usr/lib/python3/dist-packages/requests/sessions.py:655: in send r = adapter.send(request, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:266: in send raise exc _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , args = () kwargs = {'cert': None, 'proxies': OrderedDict([('no', 'localhost'), ('https', 'https://127.0.0.1:9/'), ('http', 'http://127.0.0.1:9/')]), 'stream': False, 'timeout': None, ...} scheme = 'http', netloc = 'testserver', path = '/heroes/', query = '' fragment = '', default_port = 80, host = 'testserver', port = 80 headers = [(b'host', b'testserver'), (b'user-agent', b'testclient'), (b'accept-encoding', b'gzip, deflate'), (b'accept', b'*/*'), (b'connection', b'keep-alive'), (b'content-length', b'50'), ...] def send( self, request: requests.PreparedRequest, *args: typing.Any, **kwargs: typing.Any ) -> requests.Response: scheme, netloc, path, query, fragment = ( str(item) for item in urlsplit(request.url) ) default_port = {"http": 80, "ws": 80, "https": 443, "wss": 443}[scheme] if ":" in netloc: host, port_string = netloc.split(":", 1) port = int(port_string) else: host = netloc port = default_port # Include the 'host' header. if "host" in request.headers: headers: typing.List[typing.Tuple[bytes, bytes]] = [] elif port == default_port: headers = [(b"host", host.encode())] else: headers = [(b"host", (f"{host}:{port}").encode())] # Include other request headers. headers += [ (key.lower().encode(), value.encode()) for key, value in request.headers.items() ] if scheme in {"ws", "wss"}: subprotocol = request.headers.get("sec-websocket-protocol", None) if subprotocol is None: subprotocols: typing.Sequence[str] = [] else: subprotocols = [value.strip() for value in subprotocol.split(",")] scope = { "type": "websocket", "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "subprotocols": subprotocols, } session = WebSocketTestSession(self.app, scope, self.portal_factory) raise _Upgrade(session) scope = { "type": "http", "http_version": "1.1", "method": request.method, "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "extensions": {"http.response.template": {}}, } request_complete = False response_started = False response_complete: anyio.Event raw_kwargs: typing.Dict[str, typing.Any] = {"body": io.BytesIO()} template = None context = None async def receive() -> Message: nonlocal request_complete if request_complete: if not response_complete.is_set(): await response_complete.wait() return {"type": "http.disconnect"} body = request.body if isinstance(body, str): body_bytes: bytes = body.encode("utf-8") elif body is None: body_bytes = b"" elif isinstance(body, types.GeneratorType): try: chunk = body.send(None) if isinstance(chunk, str): chunk = chunk.encode("utf-8") return {"type": "http.request", "body": chunk, "more_body": True} except StopIteration: request_complete = True return {"type": "http.request", "body": b""} else: body_bytes = body request_complete = True return {"type": "http.request", "body": body_bytes} async def send(message: Message) -> None: nonlocal raw_kwargs, response_started, template, context if message["type"] == "http.response.start": assert ( not response_started ), 'Received multiple "http.response.start" messages.' raw_kwargs["version"] = 11 raw_kwargs["status"] = message["status"] raw_kwargs["reason"] = _get_reason_phrase(message["status"]) raw_kwargs["headers"] = [ (key.decode(), value.decode()) for key, value in message.get("headers", []) ] raw_kwargs["preload_content"] = False raw_kwargs["original_response"] = _MockOriginalResponse( raw_kwargs["headers"] ) response_started = True elif message["type"] == "http.response.body": assert ( response_started ), 'Received "http.response.body" without "http.response.start".' assert ( not response_complete.is_set() ), 'Received "http.response.body" after response completed.' body = message.get("body", b"") more_body = message.get("more_body", False) if request.method != "HEAD": raw_kwargs["body"].write(body) if not more_body: raw_kwargs["body"].seek(0) response_complete.set() elif message["type"] == "http.response.template": template = message["template"] context = message["context"] try: with self.portal_factory() as portal: > response_complete = portal.call(anyio.Event) E AttributeError: module 'anyio' has no attribute 'Event' /usr/lib/python3/dist-packages/starlette/testclient.py:262: AttributeError ________________________________ test_tutorial _________________________________ def test_tutorial(): > test_mod.test_create_hero() tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests003.py:18: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_003.py:22: in test_create_hero response = client.post( /usr/lib/python3/dist-packages/requests/sessions.py:590: in post return self.request('POST', url, data=data, json=json, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:468: in request return super().request( /usr/lib/python3/dist-packages/requests/sessions.py:542: in request resp = self.send(prep, **send_kwargs) /usr/lib/python3/dist-packages/requests/sessions.py:655: in send r = adapter.send(request, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:266: in send raise exc _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , args = () kwargs = {'cert': None, 'proxies': OrderedDict([('no', 'localhost'), ('https', 'https://127.0.0.1:9/'), ('http', 'http://127.0.0.1:9/')]), 'stream': False, 'timeout': None, ...} scheme = 'http', netloc = 'testserver', path = '/heroes/', query = '' fragment = '', default_port = 80, host = 'testserver', port = 80 headers = [(b'host', b'testserver'), (b'user-agent', b'testclient'), (b'accept-encoding', b'gzip, deflate'), (b'accept', b'*/*'), (b'connection', b'keep-alive'), (b'content-length', b'50'), ...] def send( self, request: requests.PreparedRequest, *args: typing.Any, **kwargs: typing.Any ) -> requests.Response: scheme, netloc, path, query, fragment = ( str(item) for item in urlsplit(request.url) ) default_port = {"http": 80, "ws": 80, "https": 443, "wss": 443}[scheme] if ":" in netloc: host, port_string = netloc.split(":", 1) port = int(port_string) else: host = netloc port = default_port # Include the 'host' header. if "host" in request.headers: headers: typing.List[typing.Tuple[bytes, bytes]] = [] elif port == default_port: headers = [(b"host", host.encode())] else: headers = [(b"host", (f"{host}:{port}").encode())] # Include other request headers. headers += [ (key.lower().encode(), value.encode()) for key, value in request.headers.items() ] if scheme in {"ws", "wss"}: subprotocol = request.headers.get("sec-websocket-protocol", None) if subprotocol is None: subprotocols: typing.Sequence[str] = [] else: subprotocols = [value.strip() for value in subprotocol.split(",")] scope = { "type": "websocket", "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "subprotocols": subprotocols, } session = WebSocketTestSession(self.app, scope, self.portal_factory) raise _Upgrade(session) scope = { "type": "http", "http_version": "1.1", "method": request.method, "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "extensions": {"http.response.template": {}}, } request_complete = False response_started = False response_complete: anyio.Event raw_kwargs: typing.Dict[str, typing.Any] = {"body": io.BytesIO()} template = None context = None async def receive() -> Message: nonlocal request_complete if request_complete: if not response_complete.is_set(): await response_complete.wait() return {"type": "http.disconnect"} body = request.body if isinstance(body, str): body_bytes: bytes = body.encode("utf-8") elif body is None: body_bytes = b"" elif isinstance(body, types.GeneratorType): try: chunk = body.send(None) if isinstance(chunk, str): chunk = chunk.encode("utf-8") return {"type": "http.request", "body": chunk, "more_body": True} except StopIteration: request_complete = True return {"type": "http.request", "body": b""} else: body_bytes = body request_complete = True return {"type": "http.request", "body": body_bytes} async def send(message: Message) -> None: nonlocal raw_kwargs, response_started, template, context if message["type"] == "http.response.start": assert ( not response_started ), 'Received multiple "http.response.start" messages.' raw_kwargs["version"] = 11 raw_kwargs["status"] = message["status"] raw_kwargs["reason"] = _get_reason_phrase(message["status"]) raw_kwargs["headers"] = [ (key.decode(), value.decode()) for key, value in message.get("headers", []) ] raw_kwargs["preload_content"] = False raw_kwargs["original_response"] = _MockOriginalResponse( raw_kwargs["headers"] ) response_started = True elif message["type"] == "http.response.body": assert ( response_started ), 'Received "http.response.body" without "http.response.start".' assert ( not response_complete.is_set() ), 'Received "http.response.body" after response completed.' body = message.get("body", b"") more_body = message.get("more_body", False) if request.method != "HEAD": raw_kwargs["body"].write(body) if not more_body: raw_kwargs["body"].seek(0) response_complete.set() elif message["type"] == "http.response.template": template = message["template"] context = message["context"] try: with self.portal_factory() as portal: > response_complete = portal.call(anyio.Event) E AttributeError: module 'anyio' has no attribute 'Event' /usr/lib/python3/dist-packages/starlette/testclient.py:262: AttributeError ________________________________ test_tutorial _________________________________ def test_tutorial(): > test_mod.test_create_hero() tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests004.py:18: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_004.py:25: in test_create_hero response = client.post( /usr/lib/python3/dist-packages/requests/sessions.py:590: in post return self.request('POST', url, data=data, json=json, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:468: in request return super().request( /usr/lib/python3/dist-packages/requests/sessions.py:542: in request resp = self.send(prep, **send_kwargs) /usr/lib/python3/dist-packages/requests/sessions.py:655: in send r = adapter.send(request, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:266: in send raise exc _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , args = () kwargs = {'cert': None, 'proxies': OrderedDict([('no', 'localhost'), ('https', 'https://127.0.0.1:9/'), ('http', 'http://127.0.0.1:9/')]), 'stream': False, 'timeout': None, ...} scheme = 'http', netloc = 'testserver', path = '/heroes/', query = '' fragment = '', default_port = 80, host = 'testserver', port = 80 headers = [(b'host', b'testserver'), (b'user-agent', b'testclient'), (b'accept-encoding', b'gzip, deflate'), (b'accept', b'*/*'), (b'connection', b'keep-alive'), (b'content-length', b'50'), ...] def send( self, request: requests.PreparedRequest, *args: typing.Any, **kwargs: typing.Any ) -> requests.Response: scheme, netloc, path, query, fragment = ( str(item) for item in urlsplit(request.url) ) default_port = {"http": 80, "ws": 80, "https": 443, "wss": 443}[scheme] if ":" in netloc: host, port_string = netloc.split(":", 1) port = int(port_string) else: host = netloc port = default_port # Include the 'host' header. if "host" in request.headers: headers: typing.List[typing.Tuple[bytes, bytes]] = [] elif port == default_port: headers = [(b"host", host.encode())] else: headers = [(b"host", (f"{host}:{port}").encode())] # Include other request headers. headers += [ (key.lower().encode(), value.encode()) for key, value in request.headers.items() ] if scheme in {"ws", "wss"}: subprotocol = request.headers.get("sec-websocket-protocol", None) if subprotocol is None: subprotocols: typing.Sequence[str] = [] else: subprotocols = [value.strip() for value in subprotocol.split(",")] scope = { "type": "websocket", "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "subprotocols": subprotocols, } session = WebSocketTestSession(self.app, scope, self.portal_factory) raise _Upgrade(session) scope = { "type": "http", "http_version": "1.1", "method": request.method, "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "extensions": {"http.response.template": {}}, } request_complete = False response_started = False response_complete: anyio.Event raw_kwargs: typing.Dict[str, typing.Any] = {"body": io.BytesIO()} template = None context = None async def receive() -> Message: nonlocal request_complete if request_complete: if not response_complete.is_set(): await response_complete.wait() return {"type": "http.disconnect"} body = request.body if isinstance(body, str): body_bytes: bytes = body.encode("utf-8") elif body is None: body_bytes = b"" elif isinstance(body, types.GeneratorType): try: chunk = body.send(None) if isinstance(chunk, str): chunk = chunk.encode("utf-8") return {"type": "http.request", "body": chunk, "more_body": True} except StopIteration: request_complete = True return {"type": "http.request", "body": b""} else: body_bytes = body request_complete = True return {"type": "http.request", "body": body_bytes} async def send(message: Message) -> None: nonlocal raw_kwargs, response_started, template, context if message["type"] == "http.response.start": assert ( not response_started ), 'Received multiple "http.response.start" messages.' raw_kwargs["version"] = 11 raw_kwargs["status"] = message["status"] raw_kwargs["reason"] = _get_reason_phrase(message["status"]) raw_kwargs["headers"] = [ (key.decode(), value.decode()) for key, value in message.get("headers", []) ] raw_kwargs["preload_content"] = False raw_kwargs["original_response"] = _MockOriginalResponse( raw_kwargs["headers"] ) response_started = True elif message["type"] == "http.response.body": assert ( response_started ), 'Received "http.response.body" without "http.response.start".' assert ( not response_complete.is_set() ), 'Received "http.response.body" after response completed.' body = message.get("body", b"") more_body = message.get("more_body", False) if request.method != "HEAD": raw_kwargs["body"].write(body) if not more_body: raw_kwargs["body"].seek(0) response_complete.set() elif message["type"] == "http.response.template": template = message["template"] context = message["context"] try: with self.portal_factory() as portal: > response_complete = portal.call(anyio.Event) E AttributeError: module 'anyio' has no attribute 'Event' /usr/lib/python3/dist-packages/starlette/testclient.py:262: AttributeError ________________________________ test_tutorial _________________________________ prepare = None session = def test_tutorial(prepare, session: Session): > test_mod.test_create_hero(session) tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests005.py:24: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_005.py:27: in test_create_hero response = client.post( /usr/lib/python3/dist-packages/requests/sessions.py:590: in post return self.request('POST', url, data=data, json=json, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:468: in request return super().request( /usr/lib/python3/dist-packages/requests/sessions.py:542: in request resp = self.send(prep, **send_kwargs) /usr/lib/python3/dist-packages/requests/sessions.py:655: in send r = adapter.send(request, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:266: in send raise exc _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , args = () kwargs = {'cert': None, 'proxies': OrderedDict([('no', 'localhost'), ('https', 'https://127.0.0.1:9/'), ('http', 'http://127.0.0.1:9/')]), 'stream': False, 'timeout': None, ...} scheme = 'http', netloc = 'testserver', path = '/heroes/', query = '' fragment = '', default_port = 80, host = 'testserver', port = 80 headers = [(b'host', b'testserver'), (b'user-agent', b'testclient'), (b'accept-encoding', b'gzip, deflate'), (b'accept', b'*/*'), (b'connection', b'keep-alive'), (b'content-length', b'50'), ...] def send( self, request: requests.PreparedRequest, *args: typing.Any, **kwargs: typing.Any ) -> requests.Response: scheme, netloc, path, query, fragment = ( str(item) for item in urlsplit(request.url) ) default_port = {"http": 80, "ws": 80, "https": 443, "wss": 443}[scheme] if ":" in netloc: host, port_string = netloc.split(":", 1) port = int(port_string) else: host = netloc port = default_port # Include the 'host' header. if "host" in request.headers: headers: typing.List[typing.Tuple[bytes, bytes]] = [] elif port == default_port: headers = [(b"host", host.encode())] else: headers = [(b"host", (f"{host}:{port}").encode())] # Include other request headers. headers += [ (key.lower().encode(), value.encode()) for key, value in request.headers.items() ] if scheme in {"ws", "wss"}: subprotocol = request.headers.get("sec-websocket-protocol", None) if subprotocol is None: subprotocols: typing.Sequence[str] = [] else: subprotocols = [value.strip() for value in subprotocol.split(",")] scope = { "type": "websocket", "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "subprotocols": subprotocols, } session = WebSocketTestSession(self.app, scope, self.portal_factory) raise _Upgrade(session) scope = { "type": "http", "http_version": "1.1", "method": request.method, "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "extensions": {"http.response.template": {}}, } request_complete = False response_started = False response_complete: anyio.Event raw_kwargs: typing.Dict[str, typing.Any] = {"body": io.BytesIO()} template = None context = None async def receive() -> Message: nonlocal request_complete if request_complete: if not response_complete.is_set(): await response_complete.wait() return {"type": "http.disconnect"} body = request.body if isinstance(body, str): body_bytes: bytes = body.encode("utf-8") elif body is None: body_bytes = b"" elif isinstance(body, types.GeneratorType): try: chunk = body.send(None) if isinstance(chunk, str): chunk = chunk.encode("utf-8") return {"type": "http.request", "body": chunk, "more_body": True} except StopIteration: request_complete = True return {"type": "http.request", "body": b""} else: body_bytes = body request_complete = True return {"type": "http.request", "body": body_bytes} async def send(message: Message) -> None: nonlocal raw_kwargs, response_started, template, context if message["type"] == "http.response.start": assert ( not response_started ), 'Received multiple "http.response.start" messages.' raw_kwargs["version"] = 11 raw_kwargs["status"] = message["status"] raw_kwargs["reason"] = _get_reason_phrase(message["status"]) raw_kwargs["headers"] = [ (key.decode(), value.decode()) for key, value in message.get("headers", []) ] raw_kwargs["preload_content"] = False raw_kwargs["original_response"] = _MockOriginalResponse( raw_kwargs["headers"] ) response_started = True elif message["type"] == "http.response.body": assert ( response_started ), 'Received "http.response.body" without "http.response.start".' assert ( not response_complete.is_set() ), 'Received "http.response.body" after response completed.' body = message.get("body", b"") more_body = message.get("more_body", False) if request.method != "HEAD": raw_kwargs["body"].write(body) if not more_body: raw_kwargs["body"].seek(0) response_complete.set() elif message["type"] == "http.response.template": template = message["template"] context = message["context"] try: with self.portal_factory() as portal: > response_complete = portal.call(anyio.Event) E AttributeError: module 'anyio' has no attribute 'Event' /usr/lib/python3/dist-packages/starlette/testclient.py:262: AttributeError ________________________________ test_tutorial _________________________________ prepare = None session = client = def test_tutorial(prepare, session: Session, client: TestClient): > test_mod.test_create_hero(client) tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests006.py:27: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_006.py:32: in test_create_hero response = client.post( /usr/lib/python3/dist-packages/requests/sessions.py:590: in post return self.request('POST', url, data=data, json=json, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:468: in request return super().request( /usr/lib/python3/dist-packages/requests/sessions.py:542: in request resp = self.send(prep, **send_kwargs) /usr/lib/python3/dist-packages/requests/sessions.py:655: in send r = adapter.send(request, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:266: in send raise exc _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , args = () kwargs = {'cert': None, 'proxies': OrderedDict([('no', 'localhost'), ('https', 'https://127.0.0.1:9/'), ('http', 'http://127.0.0.1:9/')]), 'stream': False, 'timeout': None, ...} scheme = 'http', netloc = 'testserver', path = '/heroes/', query = '' fragment = '', default_port = 80, host = 'testserver', port = 80 headers = [(b'host', b'testserver'), (b'user-agent', b'testclient'), (b'accept-encoding', b'gzip, deflate'), (b'accept', b'*/*'), (b'connection', b'keep-alive'), (b'content-length', b'50'), ...] def send( self, request: requests.PreparedRequest, *args: typing.Any, **kwargs: typing.Any ) -> requests.Response: scheme, netloc, path, query, fragment = ( str(item) for item in urlsplit(request.url) ) default_port = {"http": 80, "ws": 80, "https": 443, "wss": 443}[scheme] if ":" in netloc: host, port_string = netloc.split(":", 1) port = int(port_string) else: host = netloc port = default_port # Include the 'host' header. if "host" in request.headers: headers: typing.List[typing.Tuple[bytes, bytes]] = [] elif port == default_port: headers = [(b"host", host.encode())] else: headers = [(b"host", (f"{host}:{port}").encode())] # Include other request headers. headers += [ (key.lower().encode(), value.encode()) for key, value in request.headers.items() ] if scheme in {"ws", "wss"}: subprotocol = request.headers.get("sec-websocket-protocol", None) if subprotocol is None: subprotocols: typing.Sequence[str] = [] else: subprotocols = [value.strip() for value in subprotocol.split(",")] scope = { "type": "websocket", "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "subprotocols": subprotocols, } session = WebSocketTestSession(self.app, scope, self.portal_factory) raise _Upgrade(session) scope = { "type": "http", "http_version": "1.1", "method": request.method, "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "extensions": {"http.response.template": {}}, } request_complete = False response_started = False response_complete: anyio.Event raw_kwargs: typing.Dict[str, typing.Any] = {"body": io.BytesIO()} template = None context = None async def receive() -> Message: nonlocal request_complete if request_complete: if not response_complete.is_set(): await response_complete.wait() return {"type": "http.disconnect"} body = request.body if isinstance(body, str): body_bytes: bytes = body.encode("utf-8") elif body is None: body_bytes = b"" elif isinstance(body, types.GeneratorType): try: chunk = body.send(None) if isinstance(chunk, str): chunk = chunk.encode("utf-8") return {"type": "http.request", "body": chunk, "more_body": True} except StopIteration: request_complete = True return {"type": "http.request", "body": b""} else: body_bytes = body request_complete = True return {"type": "http.request", "body": body_bytes} async def send(message: Message) -> None: nonlocal raw_kwargs, response_started, template, context if message["type"] == "http.response.start": assert ( not response_started ), 'Received multiple "http.response.start" messages.' raw_kwargs["version"] = 11 raw_kwargs["status"] = message["status"] raw_kwargs["reason"] = _get_reason_phrase(message["status"]) raw_kwargs["headers"] = [ (key.decode(), value.decode()) for key, value in message.get("headers", []) ] raw_kwargs["preload_content"] = False raw_kwargs["original_response"] = _MockOriginalResponse( raw_kwargs["headers"] ) response_started = True elif message["type"] == "http.response.body": assert ( response_started ), 'Received "http.response.body" without "http.response.start".' assert ( not response_complete.is_set() ), 'Received "http.response.body" after response completed.' body = message.get("body", b"") more_body = message.get("more_body", False) if request.method != "HEAD": raw_kwargs["body"].write(body) if not more_body: raw_kwargs["body"].seek(0) response_complete.set() elif message["type"] == "http.response.template": template = message["template"] context = message["context"] try: with self.portal_factory() as portal: > response_complete = portal.call(anyio.Event) E AttributeError: module 'anyio' has no attribute 'Event' /usr/lib/python3/dist-packages/starlette/testclient.py:262: AttributeError _______________________________ test_create_hero _______________________________ session = client = def test_create_hero(session: Session, client: TestClient): > test_mod.test_create_hero(client) tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests_main.py:30: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ docs_src/tutorial/fastapi/app_testing/tutorial001/test_main.py:31: in test_create_hero response = client.post( /usr/lib/python3/dist-packages/requests/sessions.py:590: in post return self.request('POST', url, data=data, json=json, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:468: in request return super().request( /usr/lib/python3/dist-packages/requests/sessions.py:542: in request resp = self.send(prep, **send_kwargs) /usr/lib/python3/dist-packages/requests/sessions.py:655: in send r = adapter.send(request, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:266: in send raise exc _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , args = () kwargs = {'cert': None, 'proxies': OrderedDict([('no', 'localhost'), ('https', 'https://127.0.0.1:9/'), ('http', 'http://127.0.0.1:9/')]), 'stream': False, 'timeout': None, ...} scheme = 'http', netloc = 'testserver', path = '/heroes/', query = '' fragment = '', default_port = 80, host = 'testserver', port = 80 headers = [(b'host', b'testserver'), (b'user-agent', b'testclient'), (b'accept-encoding', b'gzip, deflate'), (b'accept', b'*/*'), (b'connection', b'keep-alive'), (b'content-length', b'50'), ...] def send( self, request: requests.PreparedRequest, *args: typing.Any, **kwargs: typing.Any ) -> requests.Response: scheme, netloc, path, query, fragment = ( str(item) for item in urlsplit(request.url) ) default_port = {"http": 80, "ws": 80, "https": 443, "wss": 443}[scheme] if ":" in netloc: host, port_string = netloc.split(":", 1) port = int(port_string) else: host = netloc port = default_port # Include the 'host' header. if "host" in request.headers: headers: typing.List[typing.Tuple[bytes, bytes]] = [] elif port == default_port: headers = [(b"host", host.encode())] else: headers = [(b"host", (f"{host}:{port}").encode())] # Include other request headers. headers += [ (key.lower().encode(), value.encode()) for key, value in request.headers.items() ] if scheme in {"ws", "wss"}: subprotocol = request.headers.get("sec-websocket-protocol", None) if subprotocol is None: subprotocols: typing.Sequence[str] = [] else: subprotocols = [value.strip() for value in subprotocol.split(",")] scope = { "type": "websocket", "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "subprotocols": subprotocols, } session = WebSocketTestSession(self.app, scope, self.portal_factory) raise _Upgrade(session) scope = { "type": "http", "http_version": "1.1", "method": request.method, "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "extensions": {"http.response.template": {}}, } request_complete = False response_started = False response_complete: anyio.Event raw_kwargs: typing.Dict[str, typing.Any] = {"body": io.BytesIO()} template = None context = None async def receive() -> Message: nonlocal request_complete if request_complete: if not response_complete.is_set(): await response_complete.wait() return {"type": "http.disconnect"} body = request.body if isinstance(body, str): body_bytes: bytes = body.encode("utf-8") elif body is None: body_bytes = b"" elif isinstance(body, types.GeneratorType): try: chunk = body.send(None) if isinstance(chunk, str): chunk = chunk.encode("utf-8") return {"type": "http.request", "body": chunk, "more_body": True} except StopIteration: request_complete = True return {"type": "http.request", "body": b""} else: body_bytes = body request_complete = True return {"type": "http.request", "body": body_bytes} async def send(message: Message) -> None: nonlocal raw_kwargs, response_started, template, context if message["type"] == "http.response.start": assert ( not response_started ), 'Received multiple "http.response.start" messages.' raw_kwargs["version"] = 11 raw_kwargs["status"] = message["status"] raw_kwargs["reason"] = _get_reason_phrase(message["status"]) raw_kwargs["headers"] = [ (key.decode(), value.decode()) for key, value in message.get("headers", []) ] raw_kwargs["preload_content"] = False raw_kwargs["original_response"] = _MockOriginalResponse( raw_kwargs["headers"] ) response_started = True elif message["type"] == "http.response.body": assert ( response_started ), 'Received "http.response.body" without "http.response.start".' assert ( not response_complete.is_set() ), 'Received "http.response.body" after response completed.' body = message.get("body", b"") more_body = message.get("more_body", False) if request.method != "HEAD": raw_kwargs["body"].write(body) if not more_body: raw_kwargs["body"].seek(0) response_complete.set() elif message["type"] == "http.response.template": template = message["template"] context = message["context"] try: with self.portal_factory() as portal: > response_complete = portal.call(anyio.Event) E AttributeError: module 'anyio' has no attribute 'Event' /usr/lib/python3/dist-packages/starlette/testclient.py:262: AttributeError _________________________ test_create_hero_incomplete __________________________ session = client = def test_create_hero_incomplete(session: Session, client: TestClient): > test_mod.test_create_hero_incomplete(client) tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests_main.py:34: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ docs_src/tutorial/fastapi/app_testing/tutorial001/test_main.py:45: in test_create_hero_incomplete response = client.post("/heroes/", json={"name": "Deadpond"}) /usr/lib/python3/dist-packages/requests/sessions.py:590: in post return self.request('POST', url, data=data, json=json, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:468: in request return super().request( /usr/lib/python3/dist-packages/requests/sessions.py:542: in request resp = self.send(prep, **send_kwargs) /usr/lib/python3/dist-packages/requests/sessions.py:655: in send r = adapter.send(request, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:266: in send raise exc _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , args = () kwargs = {'cert': None, 'proxies': OrderedDict([('no', 'localhost'), ('https', 'https://127.0.0.1:9/'), ('http', 'http://127.0.0.1:9/')]), 'stream': False, 'timeout': None, ...} scheme = 'http', netloc = 'testserver', path = '/heroes/', query = '' fragment = '', default_port = 80, host = 'testserver', port = 80 headers = [(b'host', b'testserver'), (b'user-agent', b'testclient'), (b'accept-encoding', b'gzip, deflate'), (b'accept', b'*/*'), (b'connection', b'keep-alive'), (b'content-length', b'20'), ...] def send( self, request: requests.PreparedRequest, *args: typing.Any, **kwargs: typing.Any ) -> requests.Response: scheme, netloc, path, query, fragment = ( str(item) for item in urlsplit(request.url) ) default_port = {"http": 80, "ws": 80, "https": 443, "wss": 443}[scheme] if ":" in netloc: host, port_string = netloc.split(":", 1) port = int(port_string) else: host = netloc port = default_port # Include the 'host' header. if "host" in request.headers: headers: typing.List[typing.Tuple[bytes, bytes]] = [] elif port == default_port: headers = [(b"host", host.encode())] else: headers = [(b"host", (f"{host}:{port}").encode())] # Include other request headers. headers += [ (key.lower().encode(), value.encode()) for key, value in request.headers.items() ] if scheme in {"ws", "wss"}: subprotocol = request.headers.get("sec-websocket-protocol", None) if subprotocol is None: subprotocols: typing.Sequence[str] = [] else: subprotocols = [value.strip() for value in subprotocol.split(",")] scope = { "type": "websocket", "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "subprotocols": subprotocols, } session = WebSocketTestSession(self.app, scope, self.portal_factory) raise _Upgrade(session) scope = { "type": "http", "http_version": "1.1", "method": request.method, "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "extensions": {"http.response.template": {}}, } request_complete = False response_started = False response_complete: anyio.Event raw_kwargs: typing.Dict[str, typing.Any] = {"body": io.BytesIO()} template = None context = None async def receive() -> Message: nonlocal request_complete if request_complete: if not response_complete.is_set(): await response_complete.wait() return {"type": "http.disconnect"} body = request.body if isinstance(body, str): body_bytes: bytes = body.encode("utf-8") elif body is None: body_bytes = b"" elif isinstance(body, types.GeneratorType): try: chunk = body.send(None) if isinstance(chunk, str): chunk = chunk.encode("utf-8") return {"type": "http.request", "body": chunk, "more_body": True} except StopIteration: request_complete = True return {"type": "http.request", "body": b""} else: body_bytes = body request_complete = True return {"type": "http.request", "body": body_bytes} async def send(message: Message) -> None: nonlocal raw_kwargs, response_started, template, context if message["type"] == "http.response.start": assert ( not response_started ), 'Received multiple "http.response.start" messages.' raw_kwargs["version"] = 11 raw_kwargs["status"] = message["status"] raw_kwargs["reason"] = _get_reason_phrase(message["status"]) raw_kwargs["headers"] = [ (key.decode(), value.decode()) for key, value in message.get("headers", []) ] raw_kwargs["preload_content"] = False raw_kwargs["original_response"] = _MockOriginalResponse( raw_kwargs["headers"] ) response_started = True elif message["type"] == "http.response.body": assert ( response_started ), 'Received "http.response.body" without "http.response.start".' assert ( not response_complete.is_set() ), 'Received "http.response.body" after response completed.' body = message.get("body", b"") more_body = message.get("more_body", False) if request.method != "HEAD": raw_kwargs["body"].write(body) if not more_body: raw_kwargs["body"].seek(0) response_complete.set() elif message["type"] == "http.response.template": template = message["template"] context = message["context"] try: with self.portal_factory() as portal: > response_complete = portal.call(anyio.Event) E AttributeError: module 'anyio' has no attribute 'Event' /usr/lib/python3/dist-packages/starlette/testclient.py:262: AttributeError ___________________________ test_create_hero_invalid ___________________________ session = client = def test_create_hero_invalid(session: Session, client: TestClient): > test_mod.test_create_hero_invalid(client) tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests_main.py:38: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ docs_src/tutorial/fastapi/app_testing/tutorial001/test_main.py:51: in test_create_hero_invalid response = client.post( /usr/lib/python3/dist-packages/requests/sessions.py:590: in post return self.request('POST', url, data=data, json=json, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:468: in request return super().request( /usr/lib/python3/dist-packages/requests/sessions.py:542: in request resp = self.send(prep, **send_kwargs) /usr/lib/python3/dist-packages/requests/sessions.py:655: in send r = adapter.send(request, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:266: in send raise exc _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , args = () kwargs = {'cert': None, 'proxies': OrderedDict([('no', 'localhost'), ('https', 'https://127.0.0.1:9/'), ('http', 'http://127.0.0.1:9/')]), 'stream': False, 'timeout': None, ...} scheme = 'http', netloc = 'testserver', path = '/heroes/', query = '' fragment = '', default_port = 80, host = 'testserver', port = 80 headers = [(b'host', b'testserver'), (b'user-agent', b'testclient'), (b'accept-encoding', b'gzip, deflate'), (b'accept', b'*/*'), (b'connection', b'keep-alive'), (b'content-length', b'89'), ...] def send( self, request: requests.PreparedRequest, *args: typing.Any, **kwargs: typing.Any ) -> requests.Response: scheme, netloc, path, query, fragment = ( str(item) for item in urlsplit(request.url) ) default_port = {"http": 80, "ws": 80, "https": 443, "wss": 443}[scheme] if ":" in netloc: host, port_string = netloc.split(":", 1) port = int(port_string) else: host = netloc port = default_port # Include the 'host' header. if "host" in request.headers: headers: typing.List[typing.Tuple[bytes, bytes]] = [] elif port == default_port: headers = [(b"host", host.encode())] else: headers = [(b"host", (f"{host}:{port}").encode())] # Include other request headers. headers += [ (key.lower().encode(), value.encode()) for key, value in request.headers.items() ] if scheme in {"ws", "wss"}: subprotocol = request.headers.get("sec-websocket-protocol", None) if subprotocol is None: subprotocols: typing.Sequence[str] = [] else: subprotocols = [value.strip() for value in subprotocol.split(",")] scope = { "type": "websocket", "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "subprotocols": subprotocols, } session = WebSocketTestSession(self.app, scope, self.portal_factory) raise _Upgrade(session) scope = { "type": "http", "http_version": "1.1", "method": request.method, "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "extensions": {"http.response.template": {}}, } request_complete = False response_started = False response_complete: anyio.Event raw_kwargs: typing.Dict[str, typing.Any] = {"body": io.BytesIO()} template = None context = None async def receive() -> Message: nonlocal request_complete if request_complete: if not response_complete.is_set(): await response_complete.wait() return {"type": "http.disconnect"} body = request.body if isinstance(body, str): body_bytes: bytes = body.encode("utf-8") elif body is None: body_bytes = b"" elif isinstance(body, types.GeneratorType): try: chunk = body.send(None) if isinstance(chunk, str): chunk = chunk.encode("utf-8") return {"type": "http.request", "body": chunk, "more_body": True} except StopIteration: request_complete = True return {"type": "http.request", "body": b""} else: body_bytes = body request_complete = True return {"type": "http.request", "body": body_bytes} async def send(message: Message) -> None: nonlocal raw_kwargs, response_started, template, context if message["type"] == "http.response.start": assert ( not response_started ), 'Received multiple "http.response.start" messages.' raw_kwargs["version"] = 11 raw_kwargs["status"] = message["status"] raw_kwargs["reason"] = _get_reason_phrase(message["status"]) raw_kwargs["headers"] = [ (key.decode(), value.decode()) for key, value in message.get("headers", []) ] raw_kwargs["preload_content"] = False raw_kwargs["original_response"] = _MockOriginalResponse( raw_kwargs["headers"] ) response_started = True elif message["type"] == "http.response.body": assert ( response_started ), 'Received "http.response.body" without "http.response.start".' assert ( not response_complete.is_set() ), 'Received "http.response.body" after response completed.' body = message.get("body", b"") more_body = message.get("more_body", False) if request.method != "HEAD": raw_kwargs["body"].write(body) if not more_body: raw_kwargs["body"].seek(0) response_complete.set() elif message["type"] == "http.response.template": template = message["template"] context = message["context"] try: with self.portal_factory() as portal: > response_complete = portal.call(anyio.Event) E AttributeError: module 'anyio' has no attribute 'Event' /usr/lib/python3/dist-packages/starlette/testclient.py:262: AttributeError _______________________________ test_read_heroes _______________________________ session = client = def test_read_heroes(session: Session, client: TestClient): > test_mod.test_read_heroes(session=session, client=client) tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests_main.py:42: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ docs_src/tutorial/fastapi/app_testing/tutorial001/test_main.py:68: in test_read_heroes response = client.get("/heroes/") /usr/lib/python3/dist-packages/requests/sessions.py:555: in get return self.request('GET', url, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:468: in request return super().request( /usr/lib/python3/dist-packages/requests/sessions.py:542: in request resp = self.send(prep, **send_kwargs) /usr/lib/python3/dist-packages/requests/sessions.py:655: in send r = adapter.send(request, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:266: in send raise exc _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , args = () kwargs = {'cert': None, 'proxies': OrderedDict([('no', 'localhost'), ('https', 'https://127.0.0.1:9/'), ('http', 'http://127.0.0.1:9/')]), 'stream': False, 'timeout': None, ...} scheme = 'http', netloc = 'testserver', path = '/heroes/', query = '' fragment = '', default_port = 80, host = 'testserver', port = 80 headers = [(b'host', b'testserver'), (b'user-agent', b'testclient'), (b'accept-encoding', b'gzip, deflate'), (b'accept', b'*/*'), (b'connection', b'keep-alive')] def send( self, request: requests.PreparedRequest, *args: typing.Any, **kwargs: typing.Any ) -> requests.Response: scheme, netloc, path, query, fragment = ( str(item) for item in urlsplit(request.url) ) default_port = {"http": 80, "ws": 80, "https": 443, "wss": 443}[scheme] if ":" in netloc: host, port_string = netloc.split(":", 1) port = int(port_string) else: host = netloc port = default_port # Include the 'host' header. if "host" in request.headers: headers: typing.List[typing.Tuple[bytes, bytes]] = [] elif port == default_port: headers = [(b"host", host.encode())] else: headers = [(b"host", (f"{host}:{port}").encode())] # Include other request headers. headers += [ (key.lower().encode(), value.encode()) for key, value in request.headers.items() ] if scheme in {"ws", "wss"}: subprotocol = request.headers.get("sec-websocket-protocol", None) if subprotocol is None: subprotocols: typing.Sequence[str] = [] else: subprotocols = [value.strip() for value in subprotocol.split(",")] scope = { "type": "websocket", "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "subprotocols": subprotocols, } session = WebSocketTestSession(self.app, scope, self.portal_factory) raise _Upgrade(session) scope = { "type": "http", "http_version": "1.1", "method": request.method, "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "extensions": {"http.response.template": {}}, } request_complete = False response_started = False response_complete: anyio.Event raw_kwargs: typing.Dict[str, typing.Any] = {"body": io.BytesIO()} template = None context = None async def receive() -> Message: nonlocal request_complete if request_complete: if not response_complete.is_set(): await response_complete.wait() return {"type": "http.disconnect"} body = request.body if isinstance(body, str): body_bytes: bytes = body.encode("utf-8") elif body is None: body_bytes = b"" elif isinstance(body, types.GeneratorType): try: chunk = body.send(None) if isinstance(chunk, str): chunk = chunk.encode("utf-8") return {"type": "http.request", "body": chunk, "more_body": True} except StopIteration: request_complete = True return {"type": "http.request", "body": b""} else: body_bytes = body request_complete = True return {"type": "http.request", "body": body_bytes} async def send(message: Message) -> None: nonlocal raw_kwargs, response_started, template, context if message["type"] == "http.response.start": assert ( not response_started ), 'Received multiple "http.response.start" messages.' raw_kwargs["version"] = 11 raw_kwargs["status"] = message["status"] raw_kwargs["reason"] = _get_reason_phrase(message["status"]) raw_kwargs["headers"] = [ (key.decode(), value.decode()) for key, value in message.get("headers", []) ] raw_kwargs["preload_content"] = False raw_kwargs["original_response"] = _MockOriginalResponse( raw_kwargs["headers"] ) response_started = True elif message["type"] == "http.response.body": assert ( response_started ), 'Received "http.response.body" without "http.response.start".' assert ( not response_complete.is_set() ), 'Received "http.response.body" after response completed.' body = message.get("body", b"") more_body = message.get("more_body", False) if request.method != "HEAD": raw_kwargs["body"].write(body) if not more_body: raw_kwargs["body"].seek(0) response_complete.set() elif message["type"] == "http.response.template": template = message["template"] context = message["context"] try: with self.portal_factory() as portal: > response_complete = portal.call(anyio.Event) E AttributeError: module 'anyio' has no attribute 'Event' /usr/lib/python3/dist-packages/starlette/testclient.py:262: AttributeError ________________________________ test_read_hero ________________________________ session = client = def test_read_hero(session: Session, client: TestClient): > test_mod.test_read_hero(session=session, client=client) tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests_main.py:46: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ docs_src/tutorial/fastapi/app_testing/tutorial001/test_main.py:89: in test_read_hero response = client.get(f"/heroes/{hero_1.id}") /usr/lib/python3/dist-packages/requests/sessions.py:555: in get return self.request('GET', url, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:468: in request return super().request( /usr/lib/python3/dist-packages/requests/sessions.py:542: in request resp = self.send(prep, **send_kwargs) /usr/lib/python3/dist-packages/requests/sessions.py:655: in send r = adapter.send(request, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:266: in send raise exc _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , args = () kwargs = {'cert': None, 'proxies': OrderedDict([('no', 'localhost'), ('https', 'https://127.0.0.1:9/'), ('http', 'http://127.0.0.1:9/')]), 'stream': False, 'timeout': None, ...} scheme = 'http', netloc = 'testserver', path = '/heroes/1', query = '' fragment = '', default_port = 80, host = 'testserver', port = 80 headers = [(b'host', b'testserver'), (b'user-agent', b'testclient'), (b'accept-encoding', b'gzip, deflate'), (b'accept', b'*/*'), (b'connection', b'keep-alive')] def send( self, request: requests.PreparedRequest, *args: typing.Any, **kwargs: typing.Any ) -> requests.Response: scheme, netloc, path, query, fragment = ( str(item) for item in urlsplit(request.url) ) default_port = {"http": 80, "ws": 80, "https": 443, "wss": 443}[scheme] if ":" in netloc: host, port_string = netloc.split(":", 1) port = int(port_string) else: host = netloc port = default_port # Include the 'host' header. if "host" in request.headers: headers: typing.List[typing.Tuple[bytes, bytes]] = [] elif port == default_port: headers = [(b"host", host.encode())] else: headers = [(b"host", (f"{host}:{port}").encode())] # Include other request headers. headers += [ (key.lower().encode(), value.encode()) for key, value in request.headers.items() ] if scheme in {"ws", "wss"}: subprotocol = request.headers.get("sec-websocket-protocol", None) if subprotocol is None: subprotocols: typing.Sequence[str] = [] else: subprotocols = [value.strip() for value in subprotocol.split(",")] scope = { "type": "websocket", "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "subprotocols": subprotocols, } session = WebSocketTestSession(self.app, scope, self.portal_factory) raise _Upgrade(session) scope = { "type": "http", "http_version": "1.1", "method": request.method, "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "extensions": {"http.response.template": {}}, } request_complete = False response_started = False response_complete: anyio.Event raw_kwargs: typing.Dict[str, typing.Any] = {"body": io.BytesIO()} template = None context = None async def receive() -> Message: nonlocal request_complete if request_complete: if not response_complete.is_set(): await response_complete.wait() return {"type": "http.disconnect"} body = request.body if isinstance(body, str): body_bytes: bytes = body.encode("utf-8") elif body is None: body_bytes = b"" elif isinstance(body, types.GeneratorType): try: chunk = body.send(None) if isinstance(chunk, str): chunk = chunk.encode("utf-8") return {"type": "http.request", "body": chunk, "more_body": True} except StopIteration: request_complete = True return {"type": "http.request", "body": b""} else: body_bytes = body request_complete = True return {"type": "http.request", "body": body_bytes} async def send(message: Message) -> None: nonlocal raw_kwargs, response_started, template, context if message["type"] == "http.response.start": assert ( not response_started ), 'Received multiple "http.response.start" messages.' raw_kwargs["version"] = 11 raw_kwargs["status"] = message["status"] raw_kwargs["reason"] = _get_reason_phrase(message["status"]) raw_kwargs["headers"] = [ (key.decode(), value.decode()) for key, value in message.get("headers", []) ] raw_kwargs["preload_content"] = False raw_kwargs["original_response"] = _MockOriginalResponse( raw_kwargs["headers"] ) response_started = True elif message["type"] == "http.response.body": assert ( response_started ), 'Received "http.response.body" without "http.response.start".' assert ( not response_complete.is_set() ), 'Received "http.response.body" after response completed.' body = message.get("body", b"") more_body = message.get("more_body", False) if request.method != "HEAD": raw_kwargs["body"].write(body) if not more_body: raw_kwargs["body"].seek(0) response_complete.set() elif message["type"] == "http.response.template": template = message["template"] context = message["context"] try: with self.portal_factory() as portal: > response_complete = portal.call(anyio.Event) E AttributeError: module 'anyio' has no attribute 'Event' /usr/lib/python3/dist-packages/starlette/testclient.py:262: AttributeError _______________________________ test_update_hero _______________________________ session = client = def test_update_hero(session: Session, client: TestClient): > test_mod.test_update_hero(session=session, client=client) tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests_main.py:50: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ docs_src/tutorial/fastapi/app_testing/tutorial001/test_main.py:104: in test_update_hero response = client.patch(f"/heroes/{hero_1.id}", json={"name": "Deadpuddle"}) /usr/lib/python3/dist-packages/requests/sessions.py:614: in patch return self.request('PATCH', url, data=data, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:468: in request return super().request( /usr/lib/python3/dist-packages/requests/sessions.py:542: in request resp = self.send(prep, **send_kwargs) /usr/lib/python3/dist-packages/requests/sessions.py:655: in send r = adapter.send(request, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:266: in send raise exc _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , args = () kwargs = {'cert': None, 'proxies': OrderedDict([('no', 'localhost'), ('https', 'https://127.0.0.1:9/'), ('http', 'http://127.0.0.1:9/')]), 'stream': False, 'timeout': None, ...} scheme = 'http', netloc = 'testserver', path = '/heroes/1', query = '' fragment = '', default_port = 80, host = 'testserver', port = 80 headers = [(b'host', b'testserver'), (b'user-agent', b'testclient'), (b'accept-encoding', b'gzip, deflate'), (b'accept', b'*/*'), (b'connection', b'keep-alive'), (b'content-length', b'22'), ...] def send( self, request: requests.PreparedRequest, *args: typing.Any, **kwargs: typing.Any ) -> requests.Response: scheme, netloc, path, query, fragment = ( str(item) for item in urlsplit(request.url) ) default_port = {"http": 80, "ws": 80, "https": 443, "wss": 443}[scheme] if ":" in netloc: host, port_string = netloc.split(":", 1) port = int(port_string) else: host = netloc port = default_port # Include the 'host' header. if "host" in request.headers: headers: typing.List[typing.Tuple[bytes, bytes]] = [] elif port == default_port: headers = [(b"host", host.encode())] else: headers = [(b"host", (f"{host}:{port}").encode())] # Include other request headers. headers += [ (key.lower().encode(), value.encode()) for key, value in request.headers.items() ] if scheme in {"ws", "wss"}: subprotocol = request.headers.get("sec-websocket-protocol", None) if subprotocol is None: subprotocols: typing.Sequence[str] = [] else: subprotocols = [value.strip() for value in subprotocol.split(",")] scope = { "type": "websocket", "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "subprotocols": subprotocols, } session = WebSocketTestSession(self.app, scope, self.portal_factory) raise _Upgrade(session) scope = { "type": "http", "http_version": "1.1", "method": request.method, "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "extensions": {"http.response.template": {}}, } request_complete = False response_started = False response_complete: anyio.Event raw_kwargs: typing.Dict[str, typing.Any] = {"body": io.BytesIO()} template = None context = None async def receive() -> Message: nonlocal request_complete if request_complete: if not response_complete.is_set(): await response_complete.wait() return {"type": "http.disconnect"} body = request.body if isinstance(body, str): body_bytes: bytes = body.encode("utf-8") elif body is None: body_bytes = b"" elif isinstance(body, types.GeneratorType): try: chunk = body.send(None) if isinstance(chunk, str): chunk = chunk.encode("utf-8") return {"type": "http.request", "body": chunk, "more_body": True} except StopIteration: request_complete = True return {"type": "http.request", "body": b""} else: body_bytes = body request_complete = True return {"type": "http.request", "body": body_bytes} async def send(message: Message) -> None: nonlocal raw_kwargs, response_started, template, context if message["type"] == "http.response.start": assert ( not response_started ), 'Received multiple "http.response.start" messages.' raw_kwargs["version"] = 11 raw_kwargs["status"] = message["status"] raw_kwargs["reason"] = _get_reason_phrase(message["status"]) raw_kwargs["headers"] = [ (key.decode(), value.decode()) for key, value in message.get("headers", []) ] raw_kwargs["preload_content"] = False raw_kwargs["original_response"] = _MockOriginalResponse( raw_kwargs["headers"] ) response_started = True elif message["type"] == "http.response.body": assert ( response_started ), 'Received "http.response.body" without "http.response.start".' assert ( not response_complete.is_set() ), 'Received "http.response.body" after response completed.' body = message.get("body", b"") more_body = message.get("more_body", False) if request.method != "HEAD": raw_kwargs["body"].write(body) if not more_body: raw_kwargs["body"].seek(0) response_complete.set() elif message["type"] == "http.response.template": template = message["template"] context = message["context"] try: with self.portal_factory() as portal: > response_complete = portal.call(anyio.Event) E AttributeError: module 'anyio' has no attribute 'Event' /usr/lib/python3/dist-packages/starlette/testclient.py:262: AttributeError _______________________________ test_delete_hero _______________________________ session = client = def test_delete_hero(session: Session, client: TestClient): > test_mod.test_delete_hero(session=session, client=client) tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests_main.py:54: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ docs_src/tutorial/fastapi/app_testing/tutorial001/test_main.py:119: in test_delete_hero response = client.delete(f"/heroes/{hero_1.id}") /usr/lib/python3/dist-packages/requests/sessions.py:624: in delete return self.request('DELETE', url, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:468: in request return super().request( /usr/lib/python3/dist-packages/requests/sessions.py:542: in request resp = self.send(prep, **send_kwargs) /usr/lib/python3/dist-packages/requests/sessions.py:655: in send r = adapter.send(request, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:266: in send raise exc _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , args = () kwargs = {'cert': None, 'proxies': OrderedDict([('no', 'localhost'), ('https', 'https://127.0.0.1:9/'), ('http', 'http://127.0.0.1:9/')]), 'stream': False, 'timeout': None, ...} scheme = 'http', netloc = 'testserver', path = '/heroes/1', query = '' fragment = '', default_port = 80, host = 'testserver', port = 80 headers = [(b'host', b'testserver'), (b'user-agent', b'testclient'), (b'accept-encoding', b'gzip, deflate'), (b'accept', b'*/*'), (b'connection', b'keep-alive'), (b'content-length', b'0')] def send( self, request: requests.PreparedRequest, *args: typing.Any, **kwargs: typing.Any ) -> requests.Response: scheme, netloc, path, query, fragment = ( str(item) for item in urlsplit(request.url) ) default_port = {"http": 80, "ws": 80, "https": 443, "wss": 443}[scheme] if ":" in netloc: host, port_string = netloc.split(":", 1) port = int(port_string) else: host = netloc port = default_port # Include the 'host' header. if "host" in request.headers: headers: typing.List[typing.Tuple[bytes, bytes]] = [] elif port == default_port: headers = [(b"host", host.encode())] else: headers = [(b"host", (f"{host}:{port}").encode())] # Include other request headers. headers += [ (key.lower().encode(), value.encode()) for key, value in request.headers.items() ] if scheme in {"ws", "wss"}: subprotocol = request.headers.get("sec-websocket-protocol", None) if subprotocol is None: subprotocols: typing.Sequence[str] = [] else: subprotocols = [value.strip() for value in subprotocol.split(",")] scope = { "type": "websocket", "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "subprotocols": subprotocols, } session = WebSocketTestSession(self.app, scope, self.portal_factory) raise _Upgrade(session) scope = { "type": "http", "http_version": "1.1", "method": request.method, "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "extensions": {"http.response.template": {}}, } request_complete = False response_started = False response_complete: anyio.Event raw_kwargs: typing.Dict[str, typing.Any] = {"body": io.BytesIO()} template = None context = None async def receive() -> Message: nonlocal request_complete if request_complete: if not response_complete.is_set(): await response_complete.wait() return {"type": "http.disconnect"} body = request.body if isinstance(body, str): body_bytes: bytes = body.encode("utf-8") elif body is None: body_bytes = b"" elif isinstance(body, types.GeneratorType): try: chunk = body.send(None) if isinstance(chunk, str): chunk = chunk.encode("utf-8") return {"type": "http.request", "body": chunk, "more_body": True} except StopIteration: request_complete = True return {"type": "http.request", "body": b""} else: body_bytes = body request_complete = True return {"type": "http.request", "body": body_bytes} async def send(message: Message) -> None: nonlocal raw_kwargs, response_started, template, context if message["type"] == "http.response.start": assert ( not response_started ), 'Received multiple "http.response.start" messages.' raw_kwargs["version"] = 11 raw_kwargs["status"] = message["status"] raw_kwargs["reason"] = _get_reason_phrase(message["status"]) raw_kwargs["headers"] = [ (key.decode(), value.decode()) for key, value in message.get("headers", []) ] raw_kwargs["preload_content"] = False raw_kwargs["original_response"] = _MockOriginalResponse( raw_kwargs["headers"] ) response_started = True elif message["type"] == "http.response.body": assert ( response_started ), 'Received "http.response.body" without "http.response.start".' assert ( not response_complete.is_set() ), 'Received "http.response.body" after response completed.' body = message.get("body", b"") more_body = message.get("more_body", False) if request.method != "HEAD": raw_kwargs["body"].write(body) if not more_body: raw_kwargs["body"].seek(0) response_complete.set() elif message["type"] == "http.response.template": template = message["template"] context = message["context"] try: with self.portal_factory() as portal: > response_complete = portal.call(anyio.Event) E AttributeError: module 'anyio' has no attribute 'Event' /usr/lib/python3/dist-packages/starlette/testclient.py:262: AttributeError ___________________________ test_read_hero_not_found ___________________________ client = def test_read_hero_not_found(client: TestClient): > response = client.get("/heroes/9000") tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests_main.py:72: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3/dist-packages/requests/sessions.py:555: in get return self.request('GET', url, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:468: in request return super().request( /usr/lib/python3/dist-packages/requests/sessions.py:542: in request resp = self.send(prep, **send_kwargs) /usr/lib/python3/dist-packages/requests/sessions.py:655: in send r = adapter.send(request, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:266: in send raise exc _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , args = () kwargs = {'cert': None, 'proxies': OrderedDict([('no', 'localhost'), ('https', 'https://127.0.0.1:9/'), ('http', 'http://127.0.0.1:9/')]), 'stream': False, 'timeout': None, ...} scheme = 'http', netloc = 'testserver', path = '/heroes/9000', query = '' fragment = '', default_port = 80, host = 'testserver', port = 80 headers = [(b'host', b'testserver'), (b'user-agent', b'testclient'), (b'accept-encoding', b'gzip, deflate'), (b'accept', b'*/*'), (b'connection', b'keep-alive')] def send( self, request: requests.PreparedRequest, *args: typing.Any, **kwargs: typing.Any ) -> requests.Response: scheme, netloc, path, query, fragment = ( str(item) for item in urlsplit(request.url) ) default_port = {"http": 80, "ws": 80, "https": 443, "wss": 443}[scheme] if ":" in netloc: host, port_string = netloc.split(":", 1) port = int(port_string) else: host = netloc port = default_port # Include the 'host' header. if "host" in request.headers: headers: typing.List[typing.Tuple[bytes, bytes]] = [] elif port == default_port: headers = [(b"host", host.encode())] else: headers = [(b"host", (f"{host}:{port}").encode())] # Include other request headers. headers += [ (key.lower().encode(), value.encode()) for key, value in request.headers.items() ] if scheme in {"ws", "wss"}: subprotocol = request.headers.get("sec-websocket-protocol", None) if subprotocol is None: subprotocols: typing.Sequence[str] = [] else: subprotocols = [value.strip() for value in subprotocol.split(",")] scope = { "type": "websocket", "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "subprotocols": subprotocols, } session = WebSocketTestSession(self.app, scope, self.portal_factory) raise _Upgrade(session) scope = { "type": "http", "http_version": "1.1", "method": request.method, "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "extensions": {"http.response.template": {}}, } request_complete = False response_started = False response_complete: anyio.Event raw_kwargs: typing.Dict[str, typing.Any] = {"body": io.BytesIO()} template = None context = None async def receive() -> Message: nonlocal request_complete if request_complete: if not response_complete.is_set(): await response_complete.wait() return {"type": "http.disconnect"} body = request.body if isinstance(body, str): body_bytes: bytes = body.encode("utf-8") elif body is None: body_bytes = b"" elif isinstance(body, types.GeneratorType): try: chunk = body.send(None) if isinstance(chunk, str): chunk = chunk.encode("utf-8") return {"type": "http.request", "body": chunk, "more_body": True} except StopIteration: request_complete = True return {"type": "http.request", "body": b""} else: body_bytes = body request_complete = True return {"type": "http.request", "body": body_bytes} async def send(message: Message) -> None: nonlocal raw_kwargs, response_started, template, context if message["type"] == "http.response.start": assert ( not response_started ), 'Received multiple "http.response.start" messages.' raw_kwargs["version"] = 11 raw_kwargs["status"] = message["status"] raw_kwargs["reason"] = _get_reason_phrase(message["status"]) raw_kwargs["headers"] = [ (key.decode(), value.decode()) for key, value in message.get("headers", []) ] raw_kwargs["preload_content"] = False raw_kwargs["original_response"] = _MockOriginalResponse( raw_kwargs["headers"] ) response_started = True elif message["type"] == "http.response.body": assert ( response_started ), 'Received "http.response.body" without "http.response.start".' assert ( not response_complete.is_set() ), 'Received "http.response.body" after response completed.' body = message.get("body", b"") more_body = message.get("more_body", False) if request.method != "HEAD": raw_kwargs["body"].write(body) if not more_body: raw_kwargs["body"].seek(0) response_complete.set() elif message["type"] == "http.response.template": template = message["template"] context = message["context"] try: with self.portal_factory() as portal: > response_complete = portal.call(anyio.Event) E AttributeError: module 'anyio' has no attribute 'Event' /usr/lib/python3/dist-packages/starlette/testclient.py:262: AttributeError __________________________ test_update_hero_not_found __________________________ client = def test_update_hero_not_found(client: TestClient): > response = client.patch("/heroes/9000", json={"name": "Very-Rusty-Man"}) tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests_main.py:77: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3/dist-packages/requests/sessions.py:614: in patch return self.request('PATCH', url, data=data, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:468: in request return super().request( /usr/lib/python3/dist-packages/requests/sessions.py:542: in request resp = self.send(prep, **send_kwargs) /usr/lib/python3/dist-packages/requests/sessions.py:655: in send r = adapter.send(request, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:266: in send raise exc _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , args = () kwargs = {'cert': None, 'proxies': OrderedDict([('no', 'localhost'), ('https', 'https://127.0.0.1:9/'), ('http', 'http://127.0.0.1:9/')]), 'stream': False, 'timeout': None, ...} scheme = 'http', netloc = 'testserver', path = '/heroes/9000', query = '' fragment = '', default_port = 80, host = 'testserver', port = 80 headers = [(b'host', b'testserver'), (b'user-agent', b'testclient'), (b'accept-encoding', b'gzip, deflate'), (b'accept', b'*/*'), (b'connection', b'keep-alive'), (b'content-length', b'26'), ...] def send( self, request: requests.PreparedRequest, *args: typing.Any, **kwargs: typing.Any ) -> requests.Response: scheme, netloc, path, query, fragment = ( str(item) for item in urlsplit(request.url) ) default_port = {"http": 80, "ws": 80, "https": 443, "wss": 443}[scheme] if ":" in netloc: host, port_string = netloc.split(":", 1) port = int(port_string) else: host = netloc port = default_port # Include the 'host' header. if "host" in request.headers: headers: typing.List[typing.Tuple[bytes, bytes]] = [] elif port == default_port: headers = [(b"host", host.encode())] else: headers = [(b"host", (f"{host}:{port}").encode())] # Include other request headers. headers += [ (key.lower().encode(), value.encode()) for key, value in request.headers.items() ] if scheme in {"ws", "wss"}: subprotocol = request.headers.get("sec-websocket-protocol", None) if subprotocol is None: subprotocols: typing.Sequence[str] = [] else: subprotocols = [value.strip() for value in subprotocol.split(",")] scope = { "type": "websocket", "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "subprotocols": subprotocols, } session = WebSocketTestSession(self.app, scope, self.portal_factory) raise _Upgrade(session) scope = { "type": "http", "http_version": "1.1", "method": request.method, "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "extensions": {"http.response.template": {}}, } request_complete = False response_started = False response_complete: anyio.Event raw_kwargs: typing.Dict[str, typing.Any] = {"body": io.BytesIO()} template = None context = None async def receive() -> Message: nonlocal request_complete if request_complete: if not response_complete.is_set(): await response_complete.wait() return {"type": "http.disconnect"} body = request.body if isinstance(body, str): body_bytes: bytes = body.encode("utf-8") elif body is None: body_bytes = b"" elif isinstance(body, types.GeneratorType): try: chunk = body.send(None) if isinstance(chunk, str): chunk = chunk.encode("utf-8") return {"type": "http.request", "body": chunk, "more_body": True} except StopIteration: request_complete = True return {"type": "http.request", "body": b""} else: body_bytes = body request_complete = True return {"type": "http.request", "body": body_bytes} async def send(message: Message) -> None: nonlocal raw_kwargs, response_started, template, context if message["type"] == "http.response.start": assert ( not response_started ), 'Received multiple "http.response.start" messages.' raw_kwargs["version"] = 11 raw_kwargs["status"] = message["status"] raw_kwargs["reason"] = _get_reason_phrase(message["status"]) raw_kwargs["headers"] = [ (key.decode(), value.decode()) for key, value in message.get("headers", []) ] raw_kwargs["preload_content"] = False raw_kwargs["original_response"] = _MockOriginalResponse( raw_kwargs["headers"] ) response_started = True elif message["type"] == "http.response.body": assert ( response_started ), 'Received "http.response.body" without "http.response.start".' assert ( not response_complete.is_set() ), 'Received "http.response.body" after response completed.' body = message.get("body", b"") more_body = message.get("more_body", False) if request.method != "HEAD": raw_kwargs["body"].write(body) if not more_body: raw_kwargs["body"].seek(0) response_complete.set() elif message["type"] == "http.response.template": template = message["template"] context = message["context"] try: with self.portal_factory() as portal: > response_complete = portal.call(anyio.Event) E AttributeError: module 'anyio' has no attribute 'Event' /usr/lib/python3/dist-packages/starlette/testclient.py:262: AttributeError __________________________ test_delete_hero_not_found __________________________ client = def test_delete_hero_not_found(client: TestClient): > response = client.delete("/heroes/9000") tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests_main.py:82: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3/dist-packages/requests/sessions.py:624: in delete return self.request('DELETE', url, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:468: in request return super().request( /usr/lib/python3/dist-packages/requests/sessions.py:542: in request resp = self.send(prep, **send_kwargs) /usr/lib/python3/dist-packages/requests/sessions.py:655: in send r = adapter.send(request, **kwargs) /usr/lib/python3/dist-packages/starlette/testclient.py:266: in send raise exc _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = request = , args = () kwargs = {'cert': None, 'proxies': OrderedDict([('no', 'localhost'), ('https', 'https://127.0.0.1:9/'), ('http', 'http://127.0.0.1:9/')]), 'stream': False, 'timeout': None, ...} scheme = 'http', netloc = 'testserver', path = '/heroes/9000', query = '' fragment = '', default_port = 80, host = 'testserver', port = 80 headers = [(b'host', b'testserver'), (b'user-agent', b'testclient'), (b'accept-encoding', b'gzip, deflate'), (b'accept', b'*/*'), (b'connection', b'keep-alive'), (b'content-length', b'0')] def send( self, request: requests.PreparedRequest, *args: typing.Any, **kwargs: typing.Any ) -> requests.Response: scheme, netloc, path, query, fragment = ( str(item) for item in urlsplit(request.url) ) default_port = {"http": 80, "ws": 80, "https": 443, "wss": 443}[scheme] if ":" in netloc: host, port_string = netloc.split(":", 1) port = int(port_string) else: host = netloc port = default_port # Include the 'host' header. if "host" in request.headers: headers: typing.List[typing.Tuple[bytes, bytes]] = [] elif port == default_port: headers = [(b"host", host.encode())] else: headers = [(b"host", (f"{host}:{port}").encode())] # Include other request headers. headers += [ (key.lower().encode(), value.encode()) for key, value in request.headers.items() ] if scheme in {"ws", "wss"}: subprotocol = request.headers.get("sec-websocket-protocol", None) if subprotocol is None: subprotocols: typing.Sequence[str] = [] else: subprotocols = [value.strip() for value in subprotocol.split(",")] scope = { "type": "websocket", "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "subprotocols": subprotocols, } session = WebSocketTestSession(self.app, scope, self.portal_factory) raise _Upgrade(session) scope = { "type": "http", "http_version": "1.1", "method": request.method, "path": unquote(path), "root_path": self.root_path, "scheme": scheme, "query_string": query.encode(), "headers": headers, "client": ["testclient", 50000], "server": [host, port], "extensions": {"http.response.template": {}}, } request_complete = False response_started = False response_complete: anyio.Event raw_kwargs: typing.Dict[str, typing.Any] = {"body": io.BytesIO()} template = None context = None async def receive() -> Message: nonlocal request_complete if request_complete: if not response_complete.is_set(): await response_complete.wait() return {"type": "http.disconnect"} body = request.body if isinstance(body, str): body_bytes: bytes = body.encode("utf-8") elif body is None: body_bytes = b"" elif isinstance(body, types.GeneratorType): try: chunk = body.send(None) if isinstance(chunk, str): chunk = chunk.encode("utf-8") return {"type": "http.request", "body": chunk, "more_body": True} except StopIteration: request_complete = True return {"type": "http.request", "body": b""} else: body_bytes = body request_complete = True return {"type": "http.request", "body": body_bytes} async def send(message: Message) -> None: nonlocal raw_kwargs, response_started, template, context if message["type"] == "http.response.start": assert ( not response_started ), 'Received multiple "http.response.start" messages.' raw_kwargs["version"] = 11 raw_kwargs["status"] = message["status"] raw_kwargs["reason"] = _get_reason_phrase(message["status"]) raw_kwargs["headers"] = [ (key.decode(), value.decode()) for key, value in message.get("headers", []) ] raw_kwargs["preload_content"] = False raw_kwargs["original_response"] = _MockOriginalResponse( raw_kwargs["headers"] ) response_started = True elif message["type"] == "http.response.body": assert ( response_started ), 'Received "http.response.body" without "http.response.start".' assert ( not response_complete.is_set() ), 'Received "http.response.body" after response completed.' body = message.get("body", b"") more_body = message.get("more_body", False) if request.method != "HEAD": raw_kwargs["body"].write(body) if not more_body: raw_kwargs["body"].seek(0) response_complete.set() elif message["type"] == "http.response.template": template = message["template"] context = message["context"] try: with self.portal_factory() as portal: > response_complete = portal.call(anyio.Event) E AttributeError: module 'anyio' has no attribute 'Event' /usr/lib/python3/dist-packages/starlette/testclient.py:262: AttributeError ________________________________ test_tutorial _________________________________ clear_sqlmodel = None def test_tutorial(clear_sqlmodel): from docs_src.tutorial.fastapi.delete import tutorial001 as mod mod.sqlite_url = "sqlite://" mod.engine = create_engine( mod.sqlite_url, connect_args=mod.connect_args, poolclass=StaticPool ) > with TestClient(mod.app) as client: tests/test_tutorial/test_fastapi/test_delete/test_tutorial001.py:263: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> "TestClient": with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context( anyio.start_blocking_portal(**self.async_backend) ) @stack.callback def reset_portal() -> None: self.portal = None self.stream_send = StapledObjectStream( *anyio.create_memory_object_stream(math.inf) ) self.stream_receive = StapledObjectStream( *anyio.create_memory_object_stream(math.inf) ) > self.task = portal.start_task_soon(self.lifespan) E AttributeError: 'BlockingPortal' object has no attribute 'start_task_soon' /usr/lib/python3/dist-packages/starlette/testclient.py:523: AttributeError ________________________________ test_tutorial _________________________________ clear_sqlmodel = None def test_tutorial(clear_sqlmodel): from docs_src.tutorial.fastapi.limit_and_offset import tutorial001 as mod mod.sqlite_url = "sqlite://" mod.engine = create_engine( mod.sqlite_url, connect_args=mod.connect_args, poolclass=StaticPool ) > with TestClient(mod.app) as client: tests/test_tutorial/test_fastapi/test_limit_and_offset/test_tutorial001.py:186: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> "TestClient": with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context( anyio.start_blocking_portal(**self.async_backend) ) @stack.callback def reset_portal() -> None: self.portal = None self.stream_send = StapledObjectStream( *anyio.create_memory_object_stream(math.inf) ) self.stream_receive = StapledObjectStream( *anyio.create_memory_object_stream(math.inf) ) > self.task = portal.start_task_soon(self.lifespan) E AttributeError: 'BlockingPortal' object has no attribute 'start_task_soon' /usr/lib/python3/dist-packages/starlette/testclient.py:523: AttributeError ________________________________ test_tutorial _________________________________ clear_sqlmodel = None def test_tutorial(clear_sqlmodel): from docs_src.tutorial.fastapi.multiple_models import tutorial001 as mod mod.sqlite_url = "sqlite://" mod.engine = create_engine( mod.sqlite_url, connect_args=mod.connect_args, poolclass=StaticPool ) > with TestClient(mod.app) as client: tests/test_tutorial/test_fastapi/test_multiple_models/test_tutorial001.py:123: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> "TestClient": with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context( anyio.start_blocking_portal(**self.async_backend) ) @stack.callback def reset_portal() -> None: self.portal = None self.stream_send = StapledObjectStream( *anyio.create_memory_object_stream(math.inf) ) self.stream_receive = StapledObjectStream( *anyio.create_memory_object_stream(math.inf) ) > self.task = portal.start_task_soon(self.lifespan) E AttributeError: 'BlockingPortal' object has no attribute 'start_task_soon' /usr/lib/python3/dist-packages/starlette/testclient.py:523: AttributeError ________________________________ test_tutorial _________________________________ clear_sqlmodel = None def test_tutorial(clear_sqlmodel): from docs_src.tutorial.fastapi.multiple_models import tutorial002 as mod mod.sqlite_url = "sqlite://" mod.engine = create_engine( mod.sqlite_url, connect_args=mod.connect_args, poolclass=StaticPool ) > with TestClient(mod.app) as client: tests/test_tutorial/test_fastapi/test_multiple_models/test_tutorial002.py:123: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> "TestClient": with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context( anyio.start_blocking_portal(**self.async_backend) ) @stack.callback def reset_portal() -> None: self.portal = None self.stream_send = StapledObjectStream( *anyio.create_memory_object_stream(math.inf) ) self.stream_receive = StapledObjectStream( *anyio.create_memory_object_stream(math.inf) ) > self.task = portal.start_task_soon(self.lifespan) E AttributeError: 'BlockingPortal' object has no attribute 'start_task_soon' /usr/lib/python3/dist-packages/starlette/testclient.py:523: AttributeError ________________________________ test_tutorial _________________________________ clear_sqlmodel = None def test_tutorial(clear_sqlmodel): from docs_src.tutorial.fastapi.read_one import tutorial001 as mod mod.sqlite_url = "sqlite://" mod.engine = create_engine( mod.sqlite_url, connect_args=mod.connect_args, poolclass=StaticPool ) > with TestClient(mod.app) as client: tests/test_tutorial/test_fastapi/test_read_one/test_tutorial001.py:157: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> "TestClient": with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context( anyio.start_blocking_portal(**self.async_backend) ) @stack.callback def reset_portal() -> None: self.portal = None self.stream_send = StapledObjectStream( *anyio.create_memory_object_stream(math.inf) ) self.stream_receive = StapledObjectStream( *anyio.create_memory_object_stream(math.inf) ) > self.task = portal.start_task_soon(self.lifespan) E AttributeError: 'BlockingPortal' object has no attribute 'start_task_soon' /usr/lib/python3/dist-packages/starlette/testclient.py:523: AttributeError ________________________________ test_tutorial _________________________________ clear_sqlmodel = None def test_tutorial(clear_sqlmodel): from docs_src.tutorial.fastapi.relationships import tutorial001 as mod mod.sqlite_url = "sqlite://" mod.engine = create_engine( mod.sqlite_url, connect_args=mod.connect_args, poolclass=StaticPool ) > with TestClient(mod.app) as client: tests/test_tutorial/test_fastapi/test_relationships/test_tutorial001.py:510: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> "TestClient": with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context( anyio.start_blocking_portal(**self.async_backend) ) @stack.callback def reset_portal() -> None: self.portal = None self.stream_send = StapledObjectStream( *anyio.create_memory_object_stream(math.inf) ) self.stream_receive = StapledObjectStream( *anyio.create_memory_object_stream(math.inf) ) > self.task = portal.start_task_soon(self.lifespan) E AttributeError: 'BlockingPortal' object has no attribute 'start_task_soon' /usr/lib/python3/dist-packages/starlette/testclient.py:523: AttributeError ________________________________ test_tutorial _________________________________ clear_sqlmodel = None def test_tutorial(clear_sqlmodel): from docs_src.tutorial.fastapi.response_model import tutorial001 as mod mod.sqlite_url = "sqlite://" mod.engine = create_engine( mod.sqlite_url, connect_args=mod.connect_args, poolclass=StaticPool ) > with TestClient(mod.app) as client: tests/test_tutorial/test_fastapi/test_response_model/test_tutorial001.py:113: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> "TestClient": with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context( anyio.start_blocking_portal(**self.async_backend) ) @stack.callback def reset_portal() -> None: self.portal = None self.stream_send = StapledObjectStream( *anyio.create_memory_object_stream(math.inf) ) self.stream_receive = StapledObjectStream( *anyio.create_memory_object_stream(math.inf) ) > self.task = portal.start_task_soon(self.lifespan) E AttributeError: 'BlockingPortal' object has no attribute 'start_task_soon' /usr/lib/python3/dist-packages/starlette/testclient.py:523: AttributeError ________________________________ test_tutorial _________________________________ clear_sqlmodel = None def test_tutorial(clear_sqlmodel): from docs_src.tutorial.fastapi.session_with_dependency import tutorial001 as mod mod.sqlite_url = "sqlite://" mod.engine = create_engine( mod.sqlite_url, connect_args=mod.connect_args, poolclass=StaticPool ) > with TestClient(mod.app) as client: tests/test_tutorial/test_fastapi/test_session_with_dependency/test_tutorial001.py:263: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> "TestClient": with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context( anyio.start_blocking_portal(**self.async_backend) ) @stack.callback def reset_portal() -> None: self.portal = None self.stream_send = StapledObjectStream( *anyio.create_memory_object_stream(math.inf) ) self.stream_receive = StapledObjectStream( *anyio.create_memory_object_stream(math.inf) ) > self.task = portal.start_task_soon(self.lifespan) E AttributeError: 'BlockingPortal' object has no attribute 'start_task_soon' /usr/lib/python3/dist-packages/starlette/testclient.py:523: AttributeError ________________________________ test_tutorial _________________________________ clear_sqlmodel = None def test_tutorial(clear_sqlmodel): from docs_src.tutorial.fastapi.simple_hero_api import tutorial001 as mod mod.sqlite_url = "sqlite://" mod.engine = create_engine( mod.sqlite_url, connect_args=mod.connect_args, poolclass=StaticPool ) > with TestClient(mod.app) as client: tests/test_tutorial/test_fastapi/test_simple_hero_api/test_tutorial001.py:101: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> "TestClient": with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context( anyio.start_blocking_portal(**self.async_backend) ) @stack.callback def reset_portal() -> None: self.portal = None self.stream_send = StapledObjectStream( *anyio.create_memory_object_stream(math.inf) ) self.stream_receive = StapledObjectStream( *anyio.create_memory_object_stream(math.inf) ) > self.task = portal.start_task_soon(self.lifespan) E AttributeError: 'BlockingPortal' object has no attribute 'start_task_soon' /usr/lib/python3/dist-packages/starlette/testclient.py:523: AttributeError ________________________________ test_tutorial _________________________________ clear_sqlmodel = None def test_tutorial(clear_sqlmodel): from docs_src.tutorial.fastapi.teams import tutorial001 as mod mod.sqlite_url = "sqlite://" mod.engine = create_engine( mod.sqlite_url, connect_args=mod.connect_args, poolclass=StaticPool ) > with TestClient(mod.app) as client: tests/test_tutorial/test_fastapi/test_teams/test_tutorial001.py:477: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> "TestClient": with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context( anyio.start_blocking_portal(**self.async_backend) ) @stack.callback def reset_portal() -> None: self.portal = None self.stream_send = StapledObjectStream( *anyio.create_memory_object_stream(math.inf) ) self.stream_receive = StapledObjectStream( *anyio.create_memory_object_stream(math.inf) ) > self.task = portal.start_task_soon(self.lifespan) E AttributeError: 'BlockingPortal' object has no attribute 'start_task_soon' /usr/lib/python3/dist-packages/starlette/testclient.py:523: AttributeError ________________________________ test_tutorial _________________________________ clear_sqlmodel = None def test_tutorial(clear_sqlmodel): from docs_src.tutorial.fastapi.update import tutorial001 as mod mod.sqlite_url = "sqlite://" mod.engine = create_engine( mod.sqlite_url, connect_args=mod.connect_args, poolclass=StaticPool ) > with TestClient(mod.app) as client: tests/test_tutorial/test_fastapi/test_update/test_tutorial001.py:235: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = def __enter__(self) -> "TestClient": with contextlib.ExitStack() as stack: self.portal = portal = stack.enter_context( anyio.start_blocking_portal(**self.async_backend) ) @stack.callback def reset_portal() -> None: self.portal = None self.stream_send = StapledObjectStream( *anyio.create_memory_object_stream(math.inf) ) self.stream_receive = StapledObjectStream( *anyio.create_memory_object_stream(math.inf) ) > self.task = portal.start_task_soon(self.lifespan) E AttributeError: 'BlockingPortal' object has no attribute 'start_task_soon' /usr/lib/python3/dist-packages/starlette/testclient.py:523: AttributeError =========================== short test summary info ============================ FAILED docs_src/tutorial/fastapi/app_testing/tutorial001/test_main.py::test_create_hero FAILED docs_src/tutorial/fastapi/app_testing/tutorial001/test_main.py::test_create_hero_incomplete FAILED docs_src/tutorial/fastapi/app_testing/tutorial001/test_main.py::test_create_hero_invalid FAILED docs_src/tutorial/fastapi/app_testing/tutorial001/test_main.py::test_read_heroes FAILED docs_src/tutorial/fastapi/app_testing/tutorial001/test_main.py::test_read_hero FAILED docs_src/tutorial/fastapi/app_testing/tutorial001/test_main.py::test_update_hero FAILED docs_src/tutorial/fastapi/app_testing/tutorial001/test_main.py::test_delete_hero FAILED docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_001.py::test_create_hero FAILED docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_002.py::test_create_hero FAILED docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_003.py::test_create_hero FAILED docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_004.py::test_create_hero FAILED docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_005.py::test_create_hero FAILED docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_006.py::test_create_hero FAILED tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests001.py::test_tutorial FAILED tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests002.py::test_tutorial FAILED tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests003.py::test_tutorial FAILED tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests004.py::test_tutorial FAILED tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests005.py::test_tutorial FAILED tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests006.py::test_tutorial FAILED tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests_main.py::test_create_hero FAILED tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests_main.py::test_create_hero_incomplete FAILED tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests_main.py::test_create_hero_invalid FAILED tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests_main.py::test_read_heroes FAILED tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests_main.py::test_read_hero FAILED tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests_main.py::test_update_hero FAILED tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests_main.py::test_delete_hero FAILED tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests_main.py::test_read_hero_not_found FAILED tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests_main.py::test_update_hero_not_found FAILED tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests_main.py::test_delete_hero_not_found FAILED tests/test_tutorial/test_fastapi/test_delete/test_tutorial001.py::test_tutorial FAILED tests/test_tutorial/test_fastapi/test_limit_and_offset/test_tutorial001.py::test_tutorial FAILED tests/test_tutorial/test_fastapi/test_multiple_models/test_tutorial001.py::test_tutorial FAILED tests/test_tutorial/test_fastapi/test_multiple_models/test_tutorial002.py::test_tutorial FAILED tests/test_tutorial/test_fastapi/test_read_one/test_tutorial001.py::test_tutorial FAILED tests/test_tutorial/test_fastapi/test_relationships/test_tutorial001.py::test_tutorial FAILED tests/test_tutorial/test_fastapi/test_response_model/test_tutorial001.py::test_tutorial FAILED tests/test_tutorial/test_fastapi/test_session_with_dependency/test_tutorial001.py::test_tutorial FAILED tests/test_tutorial/test_fastapi/test_simple_hero_api/test_tutorial001.py::test_tutorial FAILED tests/test_tutorial/test_fastapi/test_teams/test_tutorial001.py::test_tutorial FAILED tests/test_tutorial/test_fastapi/test_update/test_tutorial001.py::test_tutorial ================= 40 failed, 68 passed, 3 deselected in 8.95s ================== E: pybuild pybuild:354: test: plugin custom failed with: exit code=1: PYTHONPATH=/<> python3.9 -m pytest -k 'not test_create_db_and_table' rm -fr -- /tmp/dh-xdg-rundir-Je9SVLad dh_auto_test: error: pybuild --test --test-pytest -i python{version} -p "3.10 3.9" returned exit code 13 make[1]: *** [debian/rules:23: override_dh_auto_test] Error 25 make[1]: Leaving directory '/<>' make: *** [debian/rules:7: build] Error 2 dpkg-buildpackage: error: debian/rules build subprocess returned exit status 2 -------------------------------------------------------------------------------- Build finished at 2021-12-12T08:27:48Z Finished -------- +------------------------------------------------------------------------------+ | Cleanup | +------------------------------------------------------------------------------+ Purging /<> Not removing build depends: as requested E: Build failure (dpkg-buildpackage died) +------------------------------------------------------------------------------+ | Summary | +------------------------------------------------------------------------------+ Build Architecture: amd64 Build Type: binary Build-Space: n/a Build-Time: 23 Distribution: jammy-proposed Fail-Stage: build Host Architecture: amd64 Install-Time: 38 Job: sqlmodel_0.0.4-2.dsc Machine Architecture: amd64 Package: sqlmodel Package-Time: 63 Source-Version: 0.0.4-2 Space: n/a Status: attempted Version: 0.0.4-2 -------------------------------------------------------------------------------- Finished at 2021-12-12T08:27:48Z Build needed 00:01:03, no disk space E: Build failure (dpkg-buildpackage died) Adding user buildd to group lxd RUN: /usr/share/launchpad-buildd/bin/in-target scan-for-processes --backend=chroot --series=jammy --arch=amd64 PACKAGEBUILD-22594287 Scanning for processes to kill in build PACKAGEBUILD-22594287