0s autopkgtest [10:46:06]: starting date and time: 2024-06-16 10:46:06+0000 0s autopkgtest [10:46:06]: git checkout: 433ed4cb Merge branch 'skia/nova_flock' into 'ubuntu/5.34+prod' 0s autopkgtest [10:46:06]: host juju-7f2275-prod-proposed-migration-environment-2; command line: /home/ubuntu/autopkgtest/runner/autopkgtest --output-dir /tmp/autopkgtest-work.4bm5svhy/out --timeout-copy=6000 -a i386 --setup-commands /home/ubuntu/autopkgtest-cloud/worker-config-production/setup-canonical.sh --apt-pocket=proposed=src:httpx --apt-upgrade python-authlib --timeout-short=300 --timeout-copy=20000 --timeout-build=20000 --env=ADT_TEST_TRIGGERS=httpx/0.27.0-1 -- ssh -s /home/ubuntu/autopkgtest/ssh-setup/nova -- --flavor autopkgtest --security-groups autopkgtest-juju-7f2275-prod-proposed-migration-environment-2@lcy02-15.secgroup --name adt-oracular-i386-python-authlib-20240616-102151-juju-7f2275-prod-proposed-migration-environment-2-eeb49c2b-8806-44ee-b3fc-f6ce9b0832b4 --image adt/ubuntu-oracular-amd64-server --keyname testbed-juju-7f2275-prod-proposed-migration-environment-2 --net-id=net_prod-proposed-migration -e TERM=linux -e ''"'"'http_proxy=http://squid.internal:3128'"'"'' -e ''"'"'https_proxy=http://squid.internal:3128'"'"'' -e ''"'"'no_proxy=127.0.0.1,127.0.1.1,login.ubuntu.com,localhost,localdomain,novalocal,internal,archive.ubuntu.com,ports.ubuntu.com,security.ubuntu.com,ddebs.ubuntu.com,changelogs.ubuntu.com,keyserver.ubuntu.com,launchpadlibrarian.net,launchpadcontent.net,launchpad.net,10.24.0.0/24,keystone.ps5.canonical.com,objectstorage.prodstack5.canonical.com'"'"'' --mirror=http://ftpmaster.internal/ubuntu/ 48s autopkgtest [10:46:54]: testbed dpkg architecture: amd64 48s autopkgtest [10:46:54]: testbed apt version: 2.9.3 48s autopkgtest [10:46:54]: test architecture: i386 48s autopkgtest [10:46:54]: @@@@@@@@@@@@@@@@@@@@ test bed setup 48s Get:1 http://ftpmaster.internal/ubuntu oracular-proposed InRelease [110 kB] 48s Get:2 http://ftpmaster.internal/ubuntu oracular-proposed/main Sources [36.1 kB] 48s Get:3 http://ftpmaster.internal/ubuntu oracular-proposed/restricted Sources [7052 B] 48s Get:4 http://ftpmaster.internal/ubuntu oracular-proposed/universe Sources [389 kB] 48s Get:5 http://ftpmaster.internal/ubuntu oracular-proposed/multiverse Sources [2576 B] 48s Get:6 http://ftpmaster.internal/ubuntu oracular-proposed/main amd64 Packages [53.8 kB] 48s Get:7 http://ftpmaster.internal/ubuntu oracular-proposed/main i386 Packages [38.2 kB] 48s Get:8 http://ftpmaster.internal/ubuntu oracular-proposed/restricted amd64 Packages [28.9 kB] 48s Get:9 http://ftpmaster.internal/ubuntu oracular-proposed/restricted i386 Packages [6732 B] 48s Get:10 http://ftpmaster.internal/ubuntu oracular-proposed/universe i386 Packages [138 kB] 48s Get:11 http://ftpmaster.internal/ubuntu oracular-proposed/universe amd64 Packages [317 kB] 48s Get:12 http://ftpmaster.internal/ubuntu oracular-proposed/multiverse i386 Packages [3884 B] 48s Get:13 http://ftpmaster.internal/ubuntu oracular-proposed/multiverse amd64 Packages [8364 B] 48s Fetched 1140 kB in 0s (4907 kB/s) 48s Reading package lists... 50s Reading package lists... 50s Building dependency tree... 50s Reading state information... 50s Calculating upgrade... 50s The following packages will be upgraded: 50s apt apt-utils libapt-pkg6.0t64 libldap-common libldap2 50s 5 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 50s Need to get 2875 kB of archives. 50s After this operation, 11.3 kB of additional disk space will be used. 50s Get:1 http://ftpmaster.internal/ubuntu oracular/main amd64 libapt-pkg6.0t64 amd64 2.9.5 [1023 kB] 50s Get:2 http://ftpmaster.internal/ubuntu oracular/main amd64 apt amd64 2.9.5 [1403 kB] 51s Get:3 http://ftpmaster.internal/ubuntu oracular/main amd64 apt-utils amd64 2.9.5 [223 kB] 51s Get:4 http://ftpmaster.internal/ubuntu oracular/main amd64 libldap-common all 2.6.7+dfsg-1~exp1ubuntu9 [31.5 kB] 51s Get:5 http://ftpmaster.internal/ubuntu oracular/main amd64 libldap2 amd64 2.6.7+dfsg-1~exp1ubuntu9 [195 kB] 51s Fetched 2875 kB in 0s (57.1 MB/s) 51s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 74430 files and directories currently installed.) 51s Preparing to unpack .../libapt-pkg6.0t64_2.9.5_amd64.deb ... 51s Unpacking libapt-pkg6.0t64:amd64 (2.9.5) over (2.9.3) ... 51s Setting up libapt-pkg6.0t64:amd64 (2.9.5) ... 51s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 74430 files and directories currently installed.) 51s Preparing to unpack .../archives/apt_2.9.5_amd64.deb ... 51s Unpacking apt (2.9.5) over (2.9.3) ... 51s Setting up apt (2.9.5) ... 52s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 74430 files and directories currently installed.) 52s Preparing to unpack .../apt-utils_2.9.5_amd64.deb ... 52s Unpacking apt-utils (2.9.5) over (2.9.3) ... 52s Preparing to unpack .../libldap-common_2.6.7+dfsg-1~exp1ubuntu9_all.deb ... 52s Unpacking libldap-common (2.6.7+dfsg-1~exp1ubuntu9) over (2.6.7+dfsg-1~exp1ubuntu8) ... 52s Preparing to unpack .../libldap2_2.6.7+dfsg-1~exp1ubuntu9_amd64.deb ... 52s Unpacking libldap2:amd64 (2.6.7+dfsg-1~exp1ubuntu9) over (2.6.7+dfsg-1~exp1ubuntu8) ... 52s Setting up apt-utils (2.9.5) ... 52s Setting up libldap-common (2.6.7+dfsg-1~exp1ubuntu9) ... 52s Setting up libldap2:amd64 (2.6.7+dfsg-1~exp1ubuntu9) ... 52s Processing triggers for man-db (2.12.1-2) ... 54s Processing triggers for libc-bin (2.39-0ubuntu9) ... 55s Reading package lists... 55s Building dependency tree... 55s Reading state information... 55s 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 56s Hit:1 http://ftpmaster.internal/ubuntu oracular-proposed InRelease 56s Hit:2 http://ftpmaster.internal/ubuntu oracular InRelease 56s Hit:3 http://ftpmaster.internal/ubuntu oracular-updates InRelease 56s Hit:4 http://ftpmaster.internal/ubuntu oracular-security InRelease 57s Reading package lists... 57s Reading package lists... 57s Building dependency tree... 57s Reading state information... 57s Calculating upgrade... 58s 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 58s Reading package lists... 58s Building dependency tree... 58s Reading state information... 58s 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 58s autopkgtest [10:47:04]: rebooting testbed after setup commands that affected boot 62s autopkgtest-virt-ssh: WARNING: ssh connection failed. Retrying in 3 seconds... 72s autopkgtest-virt-ssh: WARNING: ssh connection failed. Retrying in 3 seconds... 76s autopkgtest [10:47:22]: testbed running kernel: Linux 6.8.0-31-generic #31-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 20 00:40:06 UTC 2024 77s autopkgtest [10:47:23]: @@@@@@@@@@@@@@@@@@@@ apt-source python-authlib 78s Get:1 http://ftpmaster.internal/ubuntu oracular/universe python-authlib 1.3.1-1 (dsc) [2494 B] 78s Get:2 http://ftpmaster.internal/ubuntu oracular/universe python-authlib 1.3.1-1 (tar) [320 kB] 78s Get:3 http://ftpmaster.internal/ubuntu oracular/universe python-authlib 1.3.1-1 (diff) [5564 B] 78s gpgv: Signature made Thu Jun 6 10:39:37 2024 UTC 78s gpgv: using EDDSA key EE9AD6F90520FA11F69F4824477B0DB0263A54D8 78s gpgv: issuer "stefanor@debian.org" 78s gpgv: Can't check signature: No public key 78s dpkg-source: warning: cannot verify inline signature for ./python-authlib_1.3.1-1.dsc: no acceptable signature found 78s autopkgtest [10:47:24]: testing package python-authlib version 1.3.1-1 78s autopkgtest [10:47:24]: build not needed 78s autopkgtest [10:47:24]: test unittests3: preparing testbed 80s Note, using file '/tmp/autopkgtest.5VRmj2/1-autopkgtest-satdep.dsc' to get the build dependencies 80s Reading package lists... 80s Building dependency tree... 80s Reading state information... 80s Starting pkgProblemResolver with broken count: 0 81s Starting 2 pkgProblemResolver with broken count: 0 81s Done 81s The following NEW packages will be installed: 81s build-essential cpp cpp-13 cpp-13-x86-64-linux-gnu cpp-x86-64-linux-gnu g++ 81s g++-13 g++-13-x86-64-linux-gnu g++-x86-64-linux-gnu gcc gcc-13 gcc-13-base 81s gcc-13-x86-64-linux-gnu gcc-x86-64-linux-gnu libasan8 libatomic1 libcc1-0 81s libgcc-13-dev libgomp1 libhwasan0 libisl23 libitm1 libjs-jquery liblsan0 81s libmpc3 libquadmath0 libstdc++-13-dev libtsan2 libubsan1 python3-all 81s python3-anyio python3-asgiref python3-async-generator python3-authlib 81s python3-cachelib python3-click python3-colorama python3-django python3-flask 81s python3-flask-sqlalchemy python3-greenlet python3-h11 python3-httpcore 81s python3-httpx python3-iniconfig python3-itsdangerous python3-packaging 81s python3-pluggy python3-pycryptodome python3-pytest python3-pytest-asyncio 81s python3-pytest-django python3-sniffio python3-sqlalchemy python3-sqlparse 81s python3-starlette python3-werkzeug 81s 0 upgraded, 57 newly installed, 0 to remove and 0 not upgraded. 81s Need to get 69.0 MB of archives. 81s After this operation, 267 MB of additional disk space will be used. 81s Get:1 http://ftpmaster.internal/ubuntu oracular/main amd64 gcc-13-base amd64 13.2.0-23ubuntu4 [49.0 kB] 81s Get:2 http://ftpmaster.internal/ubuntu oracular/main amd64 libisl23 amd64 0.26-3build1 [680 kB] 81s Get:3 http://ftpmaster.internal/ubuntu oracular/main amd64 libmpc3 amd64 1.3.1-1build1 [54.5 kB] 81s Get:4 http://ftpmaster.internal/ubuntu oracular/main amd64 cpp-13-x86-64-linux-gnu amd64 13.2.0-23ubuntu4 [11.2 MB] 81s Get:5 http://ftpmaster.internal/ubuntu oracular/main amd64 cpp-13 amd64 13.2.0-23ubuntu4 [1032 B] 81s Get:6 http://ftpmaster.internal/ubuntu oracular/main amd64 cpp-x86-64-linux-gnu amd64 4:13.2.0-7ubuntu1 [5326 B] 81s Get:7 http://ftpmaster.internal/ubuntu oracular/main amd64 cpp amd64 4:13.2.0-7ubuntu1 [22.4 kB] 81s Get:8 http://ftpmaster.internal/ubuntu oracular/main amd64 libcc1-0 amd64 14.1.0-1ubuntu1 [48.0 kB] 81s Get:9 http://ftpmaster.internal/ubuntu oracular/main amd64 libgomp1 amd64 14.1.0-1ubuntu1 [148 kB] 81s Get:10 http://ftpmaster.internal/ubuntu oracular/main amd64 libitm1 amd64 14.1.0-1ubuntu1 [29.1 kB] 81s Get:11 http://ftpmaster.internal/ubuntu oracular/main amd64 libatomic1 amd64 14.1.0-1ubuntu1 [10.4 kB] 81s Get:12 http://ftpmaster.internal/ubuntu oracular/main amd64 libasan8 amd64 14.1.0-1ubuntu1 [3025 kB] 81s Get:13 http://ftpmaster.internal/ubuntu oracular/main amd64 liblsan0 amd64 14.1.0-1ubuntu1 [1313 kB] 81s Get:14 http://ftpmaster.internal/ubuntu oracular/main amd64 libtsan2 amd64 14.1.0-1ubuntu1 [2736 kB] 81s Get:15 http://ftpmaster.internal/ubuntu oracular/main amd64 libubsan1 amd64 14.1.0-1ubuntu1 [1174 kB] 81s Get:16 http://ftpmaster.internal/ubuntu oracular/main amd64 libhwasan0 amd64 14.1.0-1ubuntu1 [1632 kB] 81s Get:17 http://ftpmaster.internal/ubuntu oracular/main amd64 libquadmath0 amd64 14.1.0-1ubuntu1 [153 kB] 81s Get:18 http://ftpmaster.internal/ubuntu oracular/main amd64 libgcc-13-dev amd64 13.2.0-23ubuntu4 [2688 kB] 81s Get:19 http://ftpmaster.internal/ubuntu oracular/main amd64 gcc-13-x86-64-linux-gnu amd64 13.2.0-23ubuntu4 [21.9 MB] 81s Get:20 http://ftpmaster.internal/ubuntu oracular/main amd64 gcc-13 amd64 13.2.0-23ubuntu4 [482 kB] 81s Get:21 http://ftpmaster.internal/ubuntu oracular/main amd64 gcc-x86-64-linux-gnu amd64 4:13.2.0-7ubuntu1 [1212 B] 81s Get:22 http://ftpmaster.internal/ubuntu oracular/main amd64 gcc amd64 4:13.2.0-7ubuntu1 [5018 B] 81s Get:23 http://ftpmaster.internal/ubuntu oracular/main amd64 libstdc++-13-dev amd64 13.2.0-23ubuntu4 [2399 kB] 81s Get:24 http://ftpmaster.internal/ubuntu oracular/main amd64 g++-13-x86-64-linux-gnu amd64 13.2.0-23ubuntu4 [12.5 MB] 81s Get:25 http://ftpmaster.internal/ubuntu oracular/main amd64 g++-13 amd64 13.2.0-23ubuntu4 [14.5 kB] 81s Get:26 http://ftpmaster.internal/ubuntu oracular/main amd64 g++-x86-64-linux-gnu amd64 4:13.2.0-7ubuntu1 [964 B] 81s Get:27 http://ftpmaster.internal/ubuntu oracular/main amd64 g++ amd64 4:13.2.0-7ubuntu1 [1100 B] 81s Get:28 http://ftpmaster.internal/ubuntu oracular/main amd64 build-essential amd64 12.10ubuntu1 [4928 B] 81s Get:29 http://ftpmaster.internal/ubuntu oracular/main amd64 libjs-jquery all 3.6.1+dfsg+~3.5.14-1 [328 kB] 81s Get:30 http://ftpmaster.internal/ubuntu oracular/main amd64 python3-all amd64 3.12.3-0ubuntu1 [888 B] 81s Get:31 http://ftpmaster.internal/ubuntu oracular/universe amd64 python3-sniffio all 1.3.1-1 [7262 B] 81s Get:32 http://ftpmaster.internal/ubuntu oracular/universe amd64 python3-anyio all 4.3.0-1 [56.6 kB] 81s Get:33 http://ftpmaster.internal/ubuntu oracular/main amd64 python3-asgiref all 3.8.1-1 [24.8 kB] 81s Get:34 http://ftpmaster.internal/ubuntu oracular/universe amd64 python3-async-generator all 1.10-4 [17.5 kB] 81s Get:35 http://ftpmaster.internal/ubuntu oracular/universe amd64 python3-pycryptodome amd64 3.20.0+dfsg-1 [1089 kB] 81s Get:36 http://ftpmaster.internal/ubuntu oracular/universe amd64 python3-authlib all 1.3.1-1 [112 kB] 81s Get:37 http://ftpmaster.internal/ubuntu oracular/universe amd64 python3-cachelib all 0.13.0-2 [20.7 kB] 81s Get:38 http://ftpmaster.internal/ubuntu oracular/main amd64 python3-colorama all 0.4.6-4 [32.1 kB] 81s Get:39 http://ftpmaster.internal/ubuntu oracular/main amd64 python3-click all 8.1.7-1 [79.1 kB] 81s Get:40 http://ftpmaster.internal/ubuntu oracular/main amd64 python3-sqlparse all 0.5.0-1 [32.4 kB] 81s Get:41 http://ftpmaster.internal/ubuntu oracular/main amd64 python3-django all 3:4.2.13-1 [2919 kB] 81s Get:42 http://ftpmaster.internal/ubuntu oracular/main amd64 python3-itsdangerous all 2.2.0-1 [15.2 kB] 81s Get:43 http://ftpmaster.internal/ubuntu oracular/main amd64 python3-werkzeug all 3.0.3-1 [170 kB] 81s Get:44 http://ftpmaster.internal/ubuntu oracular/main amd64 python3-flask all 3.0.3-1ubuntu1 [83.2 kB] 81s Get:45 http://ftpmaster.internal/ubuntu oracular/main amd64 python3-greenlet amd64 3.0.3-0ubuntu5 [154 kB] 81s Get:46 http://ftpmaster.internal/ubuntu oracular/main amd64 python3-sqlalchemy all 1.4.50+ds1-1build1 [1020 kB] 81s Get:47 http://ftpmaster.internal/ubuntu oracular/universe amd64 python3-flask-sqlalchemy all 3.0.3-1 [30.9 kB] 81s Get:48 http://ftpmaster.internal/ubuntu oracular/universe amd64 python3-h11 all 0.14.0-1 [51.1 kB] 81s Get:49 http://ftpmaster.internal/ubuntu oracular/universe amd64 python3-httpcore all 1.0.4-1 [38.8 kB] 81s Get:50 http://ftpmaster.internal/ubuntu oracular-proposed/universe amd64 python3-httpx all 0.27.0-1 [60.9 kB] 81s Get:51 http://ftpmaster.internal/ubuntu oracular/universe amd64 python3-iniconfig all 1.1.1-2 [6024 B] 81s Get:52 http://ftpmaster.internal/ubuntu oracular/main amd64 python3-packaging all 24.0-1 [41.1 kB] 81s Get:53 http://ftpmaster.internal/ubuntu oracular/universe amd64 python3-pluggy all 1.5.0-1 [21.0 kB] 81s Get:54 http://ftpmaster.internal/ubuntu oracular/universe amd64 python3-pytest all 7.4.4-1 [305 kB] 81s Get:55 http://ftpmaster.internal/ubuntu oracular/universe amd64 python3-pytest-asyncio all 0.20.3-1.3 [10.7 kB] 81s Get:56 http://ftpmaster.internal/ubuntu oracular/universe amd64 python3-pytest-django all 4.5.2-3 [18.5 kB] 81s Get:57 http://ftpmaster.internal/ubuntu oracular/universe amd64 python3-starlette all 0.31.1-1 [49.4 kB] 82s Fetched 69.0 MB in 0s (140 MB/s) 82s Selecting previously unselected package gcc-13-base:amd64. 82s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 74430 files and directories currently installed.) 82s Preparing to unpack .../00-gcc-13-base_13.2.0-23ubuntu4_amd64.deb ... 82s Unpacking gcc-13-base:amd64 (13.2.0-23ubuntu4) ... 82s Selecting previously unselected package libisl23:amd64. 82s Preparing to unpack .../01-libisl23_0.26-3build1_amd64.deb ... 82s Unpacking libisl23:amd64 (0.26-3build1) ... 82s Selecting previously unselected package libmpc3:amd64. 82s Preparing to unpack .../02-libmpc3_1.3.1-1build1_amd64.deb ... 82s Unpacking libmpc3:amd64 (1.3.1-1build1) ... 82s Selecting previously unselected package cpp-13-x86-64-linux-gnu. 82s Preparing to unpack .../03-cpp-13-x86-64-linux-gnu_13.2.0-23ubuntu4_amd64.deb ... 82s Unpacking cpp-13-x86-64-linux-gnu (13.2.0-23ubuntu4) ... 82s Selecting previously unselected package cpp-13. 82s Preparing to unpack .../04-cpp-13_13.2.0-23ubuntu4_amd64.deb ... 82s Unpacking cpp-13 (13.2.0-23ubuntu4) ... 82s Selecting previously unselected package cpp-x86-64-linux-gnu. 82s Preparing to unpack .../05-cpp-x86-64-linux-gnu_4%3a13.2.0-7ubuntu1_amd64.deb ... 82s Unpacking cpp-x86-64-linux-gnu (4:13.2.0-7ubuntu1) ... 82s Selecting previously unselected package cpp. 82s Preparing to unpack .../06-cpp_4%3a13.2.0-7ubuntu1_amd64.deb ... 82s Unpacking cpp (4:13.2.0-7ubuntu1) ... 82s Selecting previously unselected package libcc1-0:amd64. 82s Preparing to unpack .../07-libcc1-0_14.1.0-1ubuntu1_amd64.deb ... 82s Unpacking libcc1-0:amd64 (14.1.0-1ubuntu1) ... 82s Selecting previously unselected package libgomp1:amd64. 82s Preparing to unpack .../08-libgomp1_14.1.0-1ubuntu1_amd64.deb ... 82s Unpacking libgomp1:amd64 (14.1.0-1ubuntu1) ... 82s Selecting previously unselected package libitm1:amd64. 82s Preparing to unpack .../09-libitm1_14.1.0-1ubuntu1_amd64.deb ... 82s Unpacking libitm1:amd64 (14.1.0-1ubuntu1) ... 82s Selecting previously unselected package libatomic1:amd64. 82s Preparing to unpack .../10-libatomic1_14.1.0-1ubuntu1_amd64.deb ... 82s Unpacking libatomic1:amd64 (14.1.0-1ubuntu1) ... 82s Selecting previously unselected package libasan8:amd64. 82s Preparing to unpack .../11-libasan8_14.1.0-1ubuntu1_amd64.deb ... 82s Unpacking libasan8:amd64 (14.1.0-1ubuntu1) ... 83s Selecting previously unselected package liblsan0:amd64. 83s Preparing to unpack .../12-liblsan0_14.1.0-1ubuntu1_amd64.deb ... 83s Unpacking liblsan0:amd64 (14.1.0-1ubuntu1) ... 83s Selecting previously unselected package libtsan2:amd64. 83s Preparing to unpack .../13-libtsan2_14.1.0-1ubuntu1_amd64.deb ... 83s Unpacking libtsan2:amd64 (14.1.0-1ubuntu1) ... 83s Selecting previously unselected package libubsan1:amd64. 83s Preparing to unpack .../14-libubsan1_14.1.0-1ubuntu1_amd64.deb ... 83s Unpacking libubsan1:amd64 (14.1.0-1ubuntu1) ... 83s Selecting previously unselected package libhwasan0:amd64. 83s Preparing to unpack .../15-libhwasan0_14.1.0-1ubuntu1_amd64.deb ... 83s Unpacking libhwasan0:amd64 (14.1.0-1ubuntu1) ... 83s Selecting previously unselected package libquadmath0:amd64. 83s Preparing to unpack .../16-libquadmath0_14.1.0-1ubuntu1_amd64.deb ... 83s Unpacking libquadmath0:amd64 (14.1.0-1ubuntu1) ... 83s Selecting previously unselected package libgcc-13-dev:amd64. 83s Preparing to unpack .../17-libgcc-13-dev_13.2.0-23ubuntu4_amd64.deb ... 83s Unpacking libgcc-13-dev:amd64 (13.2.0-23ubuntu4) ... 83s Selecting previously unselected package gcc-13-x86-64-linux-gnu. 83s Preparing to unpack .../18-gcc-13-x86-64-linux-gnu_13.2.0-23ubuntu4_amd64.deb ... 83s Unpacking gcc-13-x86-64-linux-gnu (13.2.0-23ubuntu4) ... 83s Selecting previously unselected package gcc-13. 83s Preparing to unpack .../19-gcc-13_13.2.0-23ubuntu4_amd64.deb ... 83s Unpacking gcc-13 (13.2.0-23ubuntu4) ... 83s Selecting previously unselected package gcc-x86-64-linux-gnu. 83s Preparing to unpack .../20-gcc-x86-64-linux-gnu_4%3a13.2.0-7ubuntu1_amd64.deb ... 83s Unpacking gcc-x86-64-linux-gnu (4:13.2.0-7ubuntu1) ... 83s Selecting previously unselected package gcc. 83s Preparing to unpack .../21-gcc_4%3a13.2.0-7ubuntu1_amd64.deb ... 83s Unpacking gcc (4:13.2.0-7ubuntu1) ... 83s Selecting previously unselected package libstdc++-13-dev:amd64. 83s Preparing to unpack .../22-libstdc++-13-dev_13.2.0-23ubuntu4_amd64.deb ... 83s Unpacking libstdc++-13-dev:amd64 (13.2.0-23ubuntu4) ... 84s Selecting previously unselected package g++-13-x86-64-linux-gnu. 84s Preparing to unpack .../23-g++-13-x86-64-linux-gnu_13.2.0-23ubuntu4_amd64.deb ... 84s Unpacking g++-13-x86-64-linux-gnu (13.2.0-23ubuntu4) ... 84s Selecting previously unselected package g++-13. 84s Preparing to unpack .../24-g++-13_13.2.0-23ubuntu4_amd64.deb ... 84s Unpacking g++-13 (13.2.0-23ubuntu4) ... 84s Selecting previously unselected package g++-x86-64-linux-gnu. 84s Preparing to unpack .../25-g++-x86-64-linux-gnu_4%3a13.2.0-7ubuntu1_amd64.deb ... 84s Unpacking g++-x86-64-linux-gnu (4:13.2.0-7ubuntu1) ... 84s Selecting previously unselected package g++. 84s Preparing to unpack .../26-g++_4%3a13.2.0-7ubuntu1_amd64.deb ... 84s Unpacking g++ (4:13.2.0-7ubuntu1) ... 84s Selecting previously unselected package build-essential. 84s Preparing to unpack .../27-build-essential_12.10ubuntu1_amd64.deb ... 84s Unpacking build-essential (12.10ubuntu1) ... 84s Selecting previously unselected package libjs-jquery. 84s Preparing to unpack .../28-libjs-jquery_3.6.1+dfsg+~3.5.14-1_all.deb ... 84s Unpacking libjs-jquery (3.6.1+dfsg+~3.5.14-1) ... 84s Selecting previously unselected package python3-all. 84s Preparing to unpack .../29-python3-all_3.12.3-0ubuntu1_amd64.deb ... 84s Unpacking python3-all (3.12.3-0ubuntu1) ... 84s Selecting previously unselected package python3-sniffio. 84s Preparing to unpack .../30-python3-sniffio_1.3.1-1_all.deb ... 84s Unpacking python3-sniffio (1.3.1-1) ... 84s Selecting previously unselected package python3-anyio. 84s Preparing to unpack .../31-python3-anyio_4.3.0-1_all.deb ... 84s Unpacking python3-anyio (4.3.0-1) ... 84s Selecting previously unselected package python3-asgiref. 84s Preparing to unpack .../32-python3-asgiref_3.8.1-1_all.deb ... 84s Unpacking python3-asgiref (3.8.1-1) ... 84s Selecting previously unselected package python3-async-generator. 84s Preparing to unpack .../33-python3-async-generator_1.10-4_all.deb ... 84s Unpacking python3-async-generator (1.10-4) ... 84s Selecting previously unselected package python3-pycryptodome. 84s Preparing to unpack .../34-python3-pycryptodome_3.20.0+dfsg-1_amd64.deb ... 84s Unpacking python3-pycryptodome (3.20.0+dfsg-1) ... 84s Selecting previously unselected package python3-authlib. 84s Preparing to unpack .../35-python3-authlib_1.3.1-1_all.deb ... 84s Unpacking python3-authlib (1.3.1-1) ... 84s Selecting previously unselected package python3-cachelib. 84s Preparing to unpack .../36-python3-cachelib_0.13.0-2_all.deb ... 84s Unpacking python3-cachelib (0.13.0-2) ... 84s Selecting previously unselected package python3-colorama. 84s Preparing to unpack .../37-python3-colorama_0.4.6-4_all.deb ... 84s Unpacking python3-colorama (0.4.6-4) ... 84s Selecting previously unselected package python3-click. 84s Preparing to unpack .../38-python3-click_8.1.7-1_all.deb ... 84s Unpacking python3-click (8.1.7-1) ... 84s Selecting previously unselected package python3-sqlparse. 84s Preparing to unpack .../39-python3-sqlparse_0.5.0-1_all.deb ... 84s Unpacking python3-sqlparse (0.5.0-1) ... 84s Selecting previously unselected package python3-django. 84s Preparing to unpack .../40-python3-django_3%3a4.2.13-1_all.deb ... 84s Unpacking python3-django (3:4.2.13-1) ... 85s Selecting previously unselected package python3-itsdangerous. 85s Preparing to unpack .../41-python3-itsdangerous_2.2.0-1_all.deb ... 85s Unpacking python3-itsdangerous (2.2.0-1) ... 85s Selecting previously unselected package python3-werkzeug. 85s Preparing to unpack .../42-python3-werkzeug_3.0.3-1_all.deb ... 85s Unpacking python3-werkzeug (3.0.3-1) ... 85s Selecting previously unselected package python3-flask. 85s Preparing to unpack .../43-python3-flask_3.0.3-1ubuntu1_all.deb ... 85s Unpacking python3-flask (3.0.3-1ubuntu1) ... 85s Selecting previously unselected package python3-greenlet. 85s Preparing to unpack .../44-python3-greenlet_3.0.3-0ubuntu5_amd64.deb ... 85s Unpacking python3-greenlet (3.0.3-0ubuntu5) ... 85s Selecting previously unselected package python3-sqlalchemy. 85s Preparing to unpack .../45-python3-sqlalchemy_1.4.50+ds1-1build1_all.deb ... 85s Unpacking python3-sqlalchemy (1.4.50+ds1-1build1) ... 85s Selecting previously unselected package python3-flask-sqlalchemy. 85s Preparing to unpack .../46-python3-flask-sqlalchemy_3.0.3-1_all.deb ... 85s Unpacking python3-flask-sqlalchemy (3.0.3-1) ... 85s Selecting previously unselected package python3-h11. 85s Preparing to unpack .../47-python3-h11_0.14.0-1_all.deb ... 85s Unpacking python3-h11 (0.14.0-1) ... 85s Selecting previously unselected package python3-httpcore. 85s Preparing to unpack .../48-python3-httpcore_1.0.4-1_all.deb ... 85s Unpacking python3-httpcore (1.0.4-1) ... 85s Selecting previously unselected package python3-httpx. 85s Preparing to unpack .../49-python3-httpx_0.27.0-1_all.deb ... 85s Unpacking python3-httpx (0.27.0-1) ... 85s Selecting previously unselected package python3-iniconfig. 85s Preparing to unpack .../50-python3-iniconfig_1.1.1-2_all.deb ... 85s Unpacking python3-iniconfig (1.1.1-2) ... 85s Selecting previously unselected package python3-packaging. 85s Preparing to unpack .../51-python3-packaging_24.0-1_all.deb ... 85s Unpacking python3-packaging (24.0-1) ... 85s Selecting previously unselected package python3-pluggy. 85s Preparing to unpack .../52-python3-pluggy_1.5.0-1_all.deb ... 85s Unpacking python3-pluggy (1.5.0-1) ... 85s Selecting previously unselected package python3-pytest. 85s Preparing to unpack .../53-python3-pytest_7.4.4-1_all.deb ... 85s Unpacking python3-pytest (7.4.4-1) ... 86s Selecting previously unselected package python3-pytest-asyncio. 86s Preparing to unpack .../54-python3-pytest-asyncio_0.20.3-1.3_all.deb ... 86s Unpacking python3-pytest-asyncio (0.20.3-1.3) ... 86s Selecting previously unselected package python3-pytest-django. 86s Preparing to unpack .../55-python3-pytest-django_4.5.2-3_all.deb ... 86s Unpacking python3-pytest-django (4.5.2-3) ... 86s Selecting previously unselected package python3-starlette. 86s Preparing to unpack .../56-python3-starlette_0.31.1-1_all.deb ... 86s Unpacking python3-starlette (0.31.1-1) ... 86s Setting up python3-iniconfig (1.1.1-2) ... 86s Setting up python3-sniffio (1.3.1-1) ... 86s Setting up python3-async-generator (1.10-4) ... 86s Setting up python3-anyio (4.3.0-1) ... 86s Setting up python3-colorama (0.4.6-4) ... 86s Setting up python3-pycryptodome (3.20.0+dfsg-1) ... 87s Setting up python3-itsdangerous (2.2.0-1) ... 87s Setting up python3-all (3.12.3-0ubuntu1) ... 87s Setting up python3-starlette (0.31.1-1) ... 87s Setting up libgomp1:amd64 (14.1.0-1ubuntu1) ... 87s Setting up python3-click (8.1.7-1) ... 87s Setting up python3-packaging (24.0-1) ... 87s Setting up python3-sqlparse (0.5.0-1) ... 87s Setting up gcc-13-base:amd64 (13.2.0-23ubuntu4) ... 87s Setting up python3-greenlet (3.0.3-0ubuntu5) ... 88s Setting up libquadmath0:amd64 (14.1.0-1ubuntu1) ... 88s Setting up libmpc3:amd64 (1.3.1-1build1) ... 88s Setting up libatomic1:amd64 (14.1.0-1ubuntu1) ... 88s Setting up python3-h11 (0.14.0-1) ... 88s Setting up python3-pluggy (1.5.0-1) ... 88s Setting up libubsan1:amd64 (14.1.0-1ubuntu1) ... 88s Setting up libhwasan0:amd64 (14.1.0-1ubuntu1) ... 88s Setting up libasan8:amd64 (14.1.0-1ubuntu1) ... 88s Setting up python3-cachelib (0.13.0-2) ... 88s Setting up libtsan2:amd64 (14.1.0-1ubuntu1) ... 88s Setting up libjs-jquery (3.6.1+dfsg+~3.5.14-1) ... 88s Setting up libisl23:amd64 (0.26-3build1) ... 88s Setting up libcc1-0:amd64 (14.1.0-1ubuntu1) ... 88s Setting up liblsan0:amd64 (14.1.0-1ubuntu1) ... 88s Setting up libitm1:amd64 (14.1.0-1ubuntu1) ... 88s Setting up python3-asgiref (3.8.1-1) ... 88s Setting up python3-authlib (1.3.1-1) ... 88s Setting up python3-httpcore (1.0.4-1) ... 88s Setting up python3-django (3:4.2.13-1) ... 90s Setting up cpp-13-x86-64-linux-gnu (13.2.0-23ubuntu4) ... 90s Setting up python3-pytest (7.4.4-1) ... 90s Setting up python3-pytest-django (4.5.2-3) ... 90s Setting up python3-sqlalchemy (1.4.50+ds1-1build1) ... 91s Setting up python3-httpx (0.27.0-1) ... 91s Setting up python3-werkzeug (3.0.3-1) ... 91s Setting up python3-pytest-asyncio (0.20.3-1.3) ... 91s Setting up libgcc-13-dev:amd64 (13.2.0-23ubuntu4) ... 91s Setting up libstdc++-13-dev:amd64 (13.2.0-23ubuntu4) ... 91s Setting up cpp-x86-64-linux-gnu (4:13.2.0-7ubuntu1) ... 91s Setting up cpp-13 (13.2.0-23ubuntu4) ... 91s Setting up python3-flask (3.0.3-1ubuntu1) ... 92s Setting up gcc-13-x86-64-linux-gnu (13.2.0-23ubuntu4) ... 92s Setting up gcc-13 (13.2.0-23ubuntu4) ... 92s Setting up cpp (4:13.2.0-7ubuntu1) ... 92s Setting up python3-flask-sqlalchemy (3.0.3-1) ... 92s Setting up g++-13-x86-64-linux-gnu (13.2.0-23ubuntu4) ... 92s Setting up gcc-x86-64-linux-gnu (4:13.2.0-7ubuntu1) ... 92s Setting up gcc (4:13.2.0-7ubuntu1) ... 92s Setting up g++-x86-64-linux-gnu (4:13.2.0-7ubuntu1) ... 92s Setting up g++-13 (13.2.0-23ubuntu4) ... 92s Setting up g++ (4:13.2.0-7ubuntu1) ... 92s update-alternatives: using /usr/bin/g++ to provide /usr/bin/c++ (c++) in auto mode 92s Setting up build-essential (12.10ubuntu1) ... 92s Processing triggers for man-db (2.12.1-2) ... 93s Processing triggers for libc-bin (2.39-0ubuntu9) ... 93s Reading package lists... 93s Building dependency tree... 93s Reading state information... 94s Starting pkgProblemResolver with broken count: 0 94s Starting 2 pkgProblemResolver with broken count: 0 94s Done 94s The following NEW packages will be installed: 94s autopkgtest-satdep 94s 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. 94s Need to get 0 B/704 B of archives. 94s After this operation, 0 B of additional disk space will be used. 94s Get:1 /tmp/autopkgtest.5VRmj2/2-autopkgtest-satdep.deb autopkgtest-satdep amd64 0 [704 B] 95s Selecting previously unselected package autopkgtest-satdep. 95s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 83515 files and directories currently installed.) 95s Preparing to unpack .../2-autopkgtest-satdep.deb ... 95s Unpacking autopkgtest-satdep (0) ... 95s Setting up autopkgtest-satdep (0) ... 95s autopkgtest: WARNING: package python3-authlib:i386 is not installed though it should be 96s (Reading database ... 83515 files and directories currently installed.) 96s Removing autopkgtest-satdep (0) ... 97s autopkgtest [10:47:43]: test unittests3: [----------------------- 97s === python3.12 === 97s ============================= test session starts ============================== 97s platform linux -- Python 3.12.4, pytest-7.4.4, pluggy-1.5.0 97s rootdir: /tmp/autopkgtest.5VRmj2/autopkgtest_tmp 97s configfile: setup.cfg 97s plugins: anyio-4.3.0, django-4.5.2, asyncio-0.20.3 97s asyncio: mode=Mode.STRICT 97s collected 101 items 97s 97s tests/core/test_oauth2/test_rfc6749_misc.py ...... [ 5%] 97s tests/core/test_oauth2/test_rfc7523.py ........................ [ 29%] 97s tests/core/test_oauth2/test_rfc7591.py ...... [ 35%] 97s tests/core/test_oauth2/test_rfc7662.py ...... [ 41%] 97s tests/core/test_oauth2/test_rfc8414.py .......................... [ 67%] 97s tests/core/test_oidc/test_core.py .......... [ 77%] 97s tests/core/test_oidc/test_discovery.py ....................... [100%] 97s 97s ============================= 101 passed in 0.55s ============================== 99s ============================= test session starts ============================== 99s platform linux -- Python 3.12.4, pytest-7.4.4, pluggy-1.5.0 99s django: settings: tests.clients.test_django.settings (from env) 99s rootdir: /tmp/autopkgtest.5VRmj2/autopkgtest_tmp 99s configfile: setup.cfg 99s plugins: anyio-4.3.0, django-4.5.2, asyncio-0.20.3 99s asyncio: mode=Mode.STRICT 99s collected 167 items 99s 99s tests/clients/test_django/test_oauth_client.py ............. [ 7%] 99s tests/clients/test_flask/test_oauth_client.py .................... [ 19%] 99s tests/clients/test_flask/test_user_mixin.py ..... [ 22%] 99s tests/clients/test_httpx/test_assertion_client.py .. [ 23%] 99s tests/clients/test_httpx/test_async_assertion_client.py F. [ 25%] 104s tests/clients/test_httpx/test_async_oauth1_client.py FFFFFFF [ 29%] 111s tests/clients/test_httpx/test_async_oauth2_client.py FFFFFFss...FFFFFFF. [ 40%] 112s FFFFF. [ 44%] 112s tests/clients/test_httpx/test_oauth1_client.py ....... [ 48%] 113s tests/clients/test_httpx/test_oauth2_client.py ...................... [ 61%] 113s tests/clients/test_requests/test_assertion_session.py .. [ 62%] 113s tests/clients/test_requests/test_oauth1_session.py ................ [ 72%] 113s tests/clients/test_requests/test_oauth2_session.py ..................... [ 85%] 113s ......... [ 90%] 115s tests/clients/test_starlette/test_oauth_client.py ...FF.FFFF.F [ 97%] 115s tests/clients/test_starlette/test_user_mixin.py F..F [100%] 115s 115s =================================== FAILURES =================================== 115s ______________________________ test_refresh_token ______________________________ 115s 115s @contextlib.contextmanager 115s def map_httpcore_exceptions() -> typing.Iterator[None]: 115s try: 115s > yield 115s 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:69: 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:373: in handle_async_request 115s resp = await self._pool.handle_async_request(req) 115s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:216: in handle_async_request 115s raise exc from None 115s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:196: in handle_async_request 115s response = await connection.handle_async_request( 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s 115s self = 115s request = 115s 115s async def handle_async_request(self, request: Request) -> Response: 115s timeouts = request.extensions.get("timeout", {}) 115s timeout = timeouts.get("connect", None) 115s 115s async with self._connect_lock: 115s if not self._connected: 115s target = b"%b:%d" % (self._remote_origin.host, self._remote_origin.port) 115s 115s connect_url = URL( 115s scheme=self._proxy_origin.scheme, 115s host=self._proxy_origin.host, 115s port=self._proxy_origin.port, 115s target=target, 115s ) 115s connect_headers = merge_headers( 115s [(b"Host", target), (b"Accept", b"*/*")], self._proxy_headers 115s ) 115s connect_request = Request( 115s method=b"CONNECT", 115s url=connect_url, 115s headers=connect_headers, 115s extensions=request.extensions, 115s ) 115s connect_response = await self._connection.handle_async_request( 115s connect_request 115s ) 115s 115s if connect_response.status < 200 or connect_response.status > 299: 115s reason_bytes = connect_response.extensions.get("reason_phrase", b"") 115s reason_str = reason_bytes.decode("ascii", errors="ignore") 115s msg = "%d %s" % (connect_response.status, reason_str) 115s await self._connection.aclose() 115s > raise ProxyError(msg) 115s E httpcore.ProxyError: 503 Service Unavailable 115s 115s /usr/lib/python3/dist-packages/httpcore/_async/http_proxy.py:298: ProxyError 115s 115s The above exception was the direct cause of the following exception: 115s 115s @pytest.mark.asyncio 115s async def test_refresh_token(): 115s async def verifier(request): 115s content = await request.body() 115s if str(request.url) == 'https://i.b/token': 115s assert b'assertion=' in content 115s 115s async with AsyncAssertionClient( 115s 'https://i.b/token', 115s grant_type=AsyncAssertionClient.JWT_BEARER_GRANT_TYPE, 115s issuer='foo', 115s subject='foo', 115s audience='foo', 115s alg='HS256', 115s key='secret', 115s app=AsyncMockDispatch(default_token, assert_func=verifier) 115s ) as client: 115s > await client.get('https://i.b') 115s 115s tests/clients/test_httpx/test_async_assertion_client.py:33: 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s /usr/lib/python3/dist-packages/httpx/_client.py:1801: in get 115s return await self.request( 115s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/assertion_client.py:38: in request 115s await self.refresh_token() 115s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/assertion_client.py:45: in _refresh_token 115s resp = await self.request( 115s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/assertion_client.py:41: in request 115s return await super().request( 115s /usr/lib/python3/dist-packages/httpx/_client.py:1574: in request 115s return await self.send(request, auth=auth, follow_redirects=follow_redirects) 115s /usr/lib/python3/dist-packages/httpx/_client.py:1661: in send 115s response = await self._send_handling_auth( 115s /usr/lib/python3/dist-packages/httpx/_client.py:1689: in _send_handling_auth 115s response = await self._send_handling_redirects( 115s /usr/lib/python3/dist-packages/httpx/_client.py:1726: in _send_handling_redirects 115s response = await self._send_single_request(request) 115s /usr/lib/python3/dist-packages/httpx/_client.py:1763: in _send_single_request 115s response = await transport.handle_async_request(request) 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:372: in handle_async_request 115s with map_httpcore_exceptions(): 115s /usr/lib/python3.12/contextlib.py:158: in __exit__ 115s self.gen.throw(value) 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s 115s @contextlib.contextmanager 115s def map_httpcore_exceptions() -> typing.Iterator[None]: 115s try: 115s yield 115s except Exception as exc: 115s mapped_exc = None 115s 115s for from_exc, to_exc in HTTPCORE_EXC_MAP.items(): 115s if not isinstance(exc, from_exc): 115s continue 115s # We want to map to the most specific exception we can find. 115s # Eg if `exc` is an `httpcore.ReadTimeout`, we want to map to 115s # `httpx.ReadTimeout`, not just `httpx.TimeoutException`. 115s if mapped_exc is None or issubclass(to_exc, mapped_exc): 115s mapped_exc = to_exc 115s 115s if mapped_exc is None: # pragma: no cover 115s raise 115s 115s message = str(exc) 115s > raise mapped_exc(message) from exc 115s E httpx.ProxyError: 503 Service Unavailable 115s 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:86: ProxyError 115s _____________________ test_fetch_request_token_via_header ______________________ 115s 115s @pytest.mark.asyncio 115s async def test_fetch_request_token_via_header(): 115s request_token = {'oauth_token': '1', 'oauth_token_secret': '2'} 115s 115s async def assert_func(request): 115s auth_header = request.headers.get('authorization') 115s assert 'oauth_consumer_key="id"' in auth_header 115s assert 'oauth_signature=' in auth_header 115s 115s app = AsyncMockDispatch(request_token, assert_func=assert_func) 115s async with AsyncOAuth1Client('id', 'secret', app=app) as client: 115s > response = await client.fetch_request_token(oauth_url) 115s 115s tests/clients/test_httpx/test_async_oauth1_client.py:24: 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth1_client.py:70: in _fetch_token 115s token = self.parse_response_token(resp.status_code, to_unicode(text)) 115s /usr/lib/python3/dist-packages/authlib/oauth1/client.py:152: in parse_response_token 115s self.handle_error('fetch_token_denied', message) 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s 115s error_type = 'fetch_token_denied' 115s error_description = 'Token request failed with code 404, response was \'\n\n\t\t\n\t\n\n\'.' 115s 115s @staticmethod 115s def handle_error(error_type, error_description): 115s > raise OAuthError(error_type, error_description) 115s E authlib.integrations.base_client.errors.OAuthError: fetch_token_denied: Token request failed with code 404, response was ' 115s E 115s E 115s E 115s E 404 - Not Found 115s E 115s E 115s E

404 - Not Found

115s E 115s E 115s E 115s E '. 115s 115s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth1_client.py:76: OAuthError 115s ______________________ test_fetch_request_token_via_body _______________________ 115s 115s @pytest.mark.asyncio 115s async def test_fetch_request_token_via_body(): 115s request_token = {'oauth_token': '1', 'oauth_token_secret': '2'} 115s 115s async def assert_func(request): 115s auth_header = request.headers.get('authorization') 115s assert auth_header is None 115s 115s content = await request.body() 115s assert b'oauth_consumer_key=id' in content 115s assert b'&oauth_signature=' in content 115s 115s mock_response = AsyncMockDispatch(request_token, assert_func=assert_func) 115s 115s async with AsyncOAuth1Client( 115s 'id', 'secret', signature_type=SIGNATURE_TYPE_BODY, 115s app=mock_response, 115s ) as client: 115s > response = await client.fetch_request_token(oauth_url) 115s 115s tests/clients/test_httpx/test_async_oauth1_client.py:47: 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth1_client.py:70: in _fetch_token 115s token = self.parse_response_token(resp.status_code, to_unicode(text)) 115s /usr/lib/python3/dist-packages/authlib/oauth1/client.py:152: in parse_response_token 115s self.handle_error('fetch_token_denied', message) 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s 115s error_type = 'fetch_token_denied' 115s error_description = 'Token request failed with code 404, response was \'\n\n\t\t\n\t\n\n\'.' 115s 115s @staticmethod 115s def handle_error(error_type, error_description): 115s > raise OAuthError(error_type, error_description) 115s E authlib.integrations.base_client.errors.OAuthError: fetch_token_denied: Token request failed with code 404, response was ' 115s E 115s E 115s E 115s E 404 - Not Found 115s E 115s E 115s E

404 - Not Found

115s E 115s E 115s E 115s E '. 115s 115s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth1_client.py:76: OAuthError 115s ______________________ test_fetch_request_token_via_query ______________________ 115s 115s @pytest.mark.asyncio 115s async def test_fetch_request_token_via_query(): 115s request_token = {'oauth_token': '1', 'oauth_token_secret': '2'} 115s 115s async def assert_func(request): 115s auth_header = request.headers.get('authorization') 115s assert auth_header is None 115s 115s url = str(request.url) 115s assert 'oauth_consumer_key=id' in url 115s assert '&oauth_signature=' in url 115s 115s mock_response = AsyncMockDispatch(request_token, assert_func=assert_func) 115s 115s async with AsyncOAuth1Client( 115s 'id', 'secret', signature_type=SIGNATURE_TYPE_QUERY, 115s app=mock_response, 115s ) as client: 115s > response = await client.fetch_request_token(oauth_url) 115s 115s tests/clients/test_httpx/test_async_oauth1_client.py:70: 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth1_client.py:70: in _fetch_token 115s token = self.parse_response_token(resp.status_code, to_unicode(text)) 115s /usr/lib/python3/dist-packages/authlib/oauth1/client.py:152: in parse_response_token 115s self.handle_error('fetch_token_denied', message) 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s 115s error_type = 'fetch_token_denied' 115s error_description = 'Token request failed with code 404, response was \'\n\n\t\t\n\t\n\n\'.' 115s 115s @staticmethod 115s def handle_error(error_type, error_description): 115s > raise OAuthError(error_type, error_description) 115s E authlib.integrations.base_client.errors.OAuthError: fetch_token_denied: Token request failed with code 404, response was ' 115s E 115s E 115s E 115s E 404 - Not Found 115s E 115s E 115s E

404 - Not Found

115s E 115s E 115s E 115s E '. 115s 115s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth1_client.py:76: OAuthError 115s ___________________________ test_fetch_access_token ____________________________ 115s 115s @pytest.mark.asyncio 115s async def test_fetch_access_token(): 115s request_token = {'oauth_token': '1', 'oauth_token_secret': '2'} 115s 115s async def assert_func(request): 115s auth_header = request.headers.get('authorization') 115s assert 'oauth_verifier="d"' in auth_header 115s assert 'oauth_token="foo"' in auth_header 115s assert 'oauth_consumer_key="id"' in auth_header 115s assert 'oauth_signature=' in auth_header 115s 115s mock_response = AsyncMockDispatch(request_token, assert_func=assert_func) 115s async with AsyncOAuth1Client( 115s 'id', 'secret', token='foo', token_secret='bar', 115s app=mock_response, 115s ) as client: 115s with pytest.raises(OAuthError): 115s await client.fetch_access_token(oauth_url) 115s 115s > response = await client.fetch_access_token(oauth_url, verifier='d') 115s 115s tests/clients/test_httpx/test_async_oauth1_client.py:94: 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth1_client.py:63: in fetch_access_token 115s token = await self._fetch_token(url, **kwargs) 115s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth1_client.py:70: in _fetch_token 115s token = self.parse_response_token(resp.status_code, to_unicode(text)) 115s /usr/lib/python3/dist-packages/authlib/oauth1/client.py:152: in parse_response_token 115s self.handle_error('fetch_token_denied', message) 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s 115s error_type = 'fetch_token_denied' 115s error_description = 'Token request failed with code 404, response was \'\n\n\t\t\n\t\n\n\'.' 115s 115s @staticmethod 115s def handle_error(error_type, error_description): 115s > raise OAuthError(error_type, error_description) 115s E authlib.integrations.base_client.errors.OAuthError: fetch_token_denied: Token request failed with code 404, response was ' 115s E 115s E 115s E 115s E 404 - Not Found 115s E 115s E 115s E

404 - Not Found

115s E 115s E 115s E 115s E '. 115s 115s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth1_client.py:76: OAuthError 115s _____________________________ test_get_via_header ______________________________ 115s 115s @pytest.mark.asyncio 115s async def test_get_via_header(): 115s mock_response = AsyncMockDispatch(b'hello') 115s async with AsyncOAuth1Client( 115s 'id', 'secret', token='foo', token_secret='bar', 115s app=mock_response, 115s ) as client: 115s response = await client.get('https://example.com/') 115s 115s > assert response.content == b'hello' 115s E AssertionError: assert b'\n\n' == b'hello' 115s E At index 0 diff: b'<' != b'h' 115s E Use -v to get more diff 115s 115s tests/clients/test_httpx/test_async_oauth1_client.py:108: AssertionError 115s ______________________________ test_get_via_body _______________________________ 115s 115s @pytest.mark.asyncio 115s async def test_get_via_body(): 115s async def assert_func(request): 115s content = await request.body() 115s assert b'oauth_token=foo' in content 115s assert b'oauth_consumer_key=id' in content 115s assert b'oauth_signature=' in content 115s 115s mock_response = AsyncMockDispatch(b'hello', assert_func=assert_func) 115s async with AsyncOAuth1Client( 115s 'id', 'secret', token='foo', token_secret='bar', 115s signature_type=SIGNATURE_TYPE_BODY, 115s app=mock_response, 115s ) as client: 115s response = await client.post('https://example.com/') 115s 115s > assert response.content == b'hello' 115s E AssertionError: assert b'\n\n' == b'hello' 115s E At index 0 diff: b'<' != b'h' 115s E Use -v to get more diff 115s 115s tests/clients/test_httpx/test_async_oauth1_client.py:132: AssertionError 115s ______________________________ test_get_via_query ______________________________ 115s 115s @pytest.mark.asyncio 115s async def test_get_via_query(): 115s mock_response = AsyncMockDispatch(b'hello') 115s async with AsyncOAuth1Client( 115s 'id', 'secret', token='foo', token_secret='bar', 115s signature_type=SIGNATURE_TYPE_QUERY, 115s app=mock_response, 115s ) as client: 115s response = await client.get('https://example.com/') 115s 115s > assert response.content == b'hello' 115s E AssertionError: assert b'\n\n' == b'hello' 115s E At index 0 diff: b'<' != b'h' 115s E Use -v to get more diff 115s 115s tests/clients/test_httpx/test_async_oauth1_client.py:149: AssertionError 115s __________ test_add_token_get_request[assert_token_in_header-header] ___________ 115s 115s @contextlib.contextmanager 115s def map_httpcore_exceptions() -> typing.Iterator[None]: 115s try: 115s > yield 115s 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:69: 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:373: in handle_async_request 115s resp = await self._pool.handle_async_request(req) 115s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:216: in handle_async_request 115s raise exc from None 115s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:196: in handle_async_request 115s response = await connection.handle_async_request( 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s 115s self = 115s request = 115s 115s async def handle_async_request(self, request: Request) -> Response: 115s timeouts = request.extensions.get("timeout", {}) 115s timeout = timeouts.get("connect", None) 115s 115s async with self._connect_lock: 115s if not self._connected: 115s target = b"%b:%d" % (self._remote_origin.host, self._remote_origin.port) 115s 115s connect_url = URL( 115s scheme=self._proxy_origin.scheme, 115s host=self._proxy_origin.host, 115s port=self._proxy_origin.port, 115s target=target, 115s ) 115s connect_headers = merge_headers( 115s [(b"Host", target), (b"Accept", b"*/*")], self._proxy_headers 115s ) 115s connect_request = Request( 115s method=b"CONNECT", 115s url=connect_url, 115s headers=connect_headers, 115s extensions=request.extensions, 115s ) 115s connect_response = await self._connection.handle_async_request( 115s connect_request 115s ) 115s 115s if connect_response.status < 200 or connect_response.status > 299: 115s reason_bytes = connect_response.extensions.get("reason_phrase", b"") 115s reason_str = reason_bytes.decode("ascii", errors="ignore") 115s msg = "%d %s" % (connect_response.status, reason_str) 115s await self._connection.aclose() 115s > raise ProxyError(msg) 115s E httpcore.ProxyError: 503 Service Unavailable 115s 115s /usr/lib/python3/dist-packages/httpcore/_async/http_proxy.py:298: ProxyError 115s 115s The above exception was the direct cause of the following exception: 115s 115s assert_func = 115s token_placement = 'header' 115s 115s @pytest.mark.asyncio 115s @pytest.mark.parametrize( 115s "assert_func, token_placement", 115s [ 115s (assert_token_in_header, "header"), 115s (assert_token_in_body, "body"), 115s (assert_token_in_uri, "uri") 115s ] 115s ) 115s async def test_add_token_get_request(assert_func, token_placement): 115s mock_response = AsyncMockDispatch({'a': 'a'}, assert_func=assert_func) 115s async with AsyncOAuth2Client( 115s 'foo', 115s token=default_token, 115s token_placement=token_placement, 115s app=mock_response 115s ) as client: 115s > resp = await client.get('https://i.b') 115s 115s tests/clients/test_httpx/test_async_oauth2_client.py:62: 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s /usr/lib/python3/dist-packages/httpx/_client.py:1801: in get 115s return await self.request( 115s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:90: in request 115s return await super().request( 115s /usr/lib/python3/dist-packages/httpx/_client.py:1574: in request 115s return await self.send(request, auth=auth, follow_redirects=follow_redirects) 115s /usr/lib/python3/dist-packages/httpx/_client.py:1661: in send 115s response = await self._send_handling_auth( 115s /usr/lib/python3/dist-packages/httpx/_client.py:1689: in _send_handling_auth 115s response = await self._send_handling_redirects( 115s /usr/lib/python3/dist-packages/httpx/_client.py:1726: in _send_handling_redirects 115s response = await self._send_single_request(request) 115s /usr/lib/python3/dist-packages/httpx/_client.py:1763: in _send_single_request 115s response = await transport.handle_async_request(request) 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:372: in handle_async_request 115s with map_httpcore_exceptions(): 115s /usr/lib/python3.12/contextlib.py:158: in __exit__ 115s self.gen.throw(value) 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s 115s @contextlib.contextmanager 115s def map_httpcore_exceptions() -> typing.Iterator[None]: 115s try: 115s yield 115s except Exception as exc: 115s mapped_exc = None 115s 115s for from_exc, to_exc in HTTPCORE_EXC_MAP.items(): 115s if not isinstance(exc, from_exc): 115s continue 115s # We want to map to the most specific exception we can find. 115s # Eg if `exc` is an `httpcore.ReadTimeout`, we want to map to 115s # `httpx.ReadTimeout`, not just `httpx.TimeoutException`. 115s if mapped_exc is None or issubclass(to_exc, mapped_exc): 115s mapped_exc = to_exc 115s 115s if mapped_exc is None: # pragma: no cover 115s raise 115s 115s message = str(exc) 115s > raise mapped_exc(message) from exc 115s E httpx.ProxyError: 503 Service Unavailable 115s 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:86: ProxyError 115s ____________ test_add_token_get_request[assert_token_in_body-body] _____________ 115s 115s @contextlib.contextmanager 115s def map_httpcore_exceptions() -> typing.Iterator[None]: 115s try: 115s > yield 115s 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:69: 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:373: in handle_async_request 115s resp = await self._pool.handle_async_request(req) 115s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:216: in handle_async_request 115s raise exc from None 115s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:196: in handle_async_request 115s response = await connection.handle_async_request( 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s 115s self = 115s request = 115s 115s async def handle_async_request(self, request: Request) -> Response: 115s timeouts = request.extensions.get("timeout", {}) 115s timeout = timeouts.get("connect", None) 115s 115s async with self._connect_lock: 115s if not self._connected: 115s target = b"%b:%d" % (self._remote_origin.host, self._remote_origin.port) 115s 115s connect_url = URL( 115s scheme=self._proxy_origin.scheme, 115s host=self._proxy_origin.host, 115s port=self._proxy_origin.port, 115s target=target, 115s ) 115s connect_headers = merge_headers( 115s [(b"Host", target), (b"Accept", b"*/*")], self._proxy_headers 115s ) 115s connect_request = Request( 115s method=b"CONNECT", 115s url=connect_url, 115s headers=connect_headers, 115s extensions=request.extensions, 115s ) 115s connect_response = await self._connection.handle_async_request( 115s connect_request 115s ) 115s 115s if connect_response.status < 200 or connect_response.status > 299: 115s reason_bytes = connect_response.extensions.get("reason_phrase", b"") 115s reason_str = reason_bytes.decode("ascii", errors="ignore") 115s msg = "%d %s" % (connect_response.status, reason_str) 115s await self._connection.aclose() 115s > raise ProxyError(msg) 115s E httpcore.ProxyError: 503 Service Unavailable 115s 115s /usr/lib/python3/dist-packages/httpcore/_async/http_proxy.py:298: ProxyError 115s 115s The above exception was the direct cause of the following exception: 115s 115s assert_func = 115s token_placement = 'body' 115s 115s @pytest.mark.asyncio 115s @pytest.mark.parametrize( 115s "assert_func, token_placement", 115s [ 115s (assert_token_in_header, "header"), 115s (assert_token_in_body, "body"), 115s (assert_token_in_uri, "uri") 115s ] 115s ) 115s async def test_add_token_get_request(assert_func, token_placement): 115s mock_response = AsyncMockDispatch({'a': 'a'}, assert_func=assert_func) 115s async with AsyncOAuth2Client( 115s 'foo', 115s token=default_token, 115s token_placement=token_placement, 115s app=mock_response 115s ) as client: 115s > resp = await client.get('https://i.b') 115s 115s tests/clients/test_httpx/test_async_oauth2_client.py:62: 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s /usr/lib/python3/dist-packages/httpx/_client.py:1801: in get 115s return await self.request( 115s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:90: in request 115s return await super().request( 115s /usr/lib/python3/dist-packages/httpx/_client.py:1574: in request 115s return await self.send(request, auth=auth, follow_redirects=follow_redirects) 115s /usr/lib/python3/dist-packages/httpx/_client.py:1661: in send 115s response = await self._send_handling_auth( 115s /usr/lib/python3/dist-packages/httpx/_client.py:1689: in _send_handling_auth 115s response = await self._send_handling_redirects( 115s /usr/lib/python3/dist-packages/httpx/_client.py:1726: in _send_handling_redirects 115s response = await self._send_single_request(request) 115s /usr/lib/python3/dist-packages/httpx/_client.py:1763: in _send_single_request 115s response = await transport.handle_async_request(request) 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:372: in handle_async_request 115s with map_httpcore_exceptions(): 115s /usr/lib/python3.12/contextlib.py:158: in __exit__ 115s self.gen.throw(value) 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s 115s @contextlib.contextmanager 115s def map_httpcore_exceptions() -> typing.Iterator[None]: 115s try: 115s yield 115s except Exception as exc: 115s mapped_exc = None 115s 115s for from_exc, to_exc in HTTPCORE_EXC_MAP.items(): 115s if not isinstance(exc, from_exc): 115s continue 115s # We want to map to the most specific exception we can find. 115s # Eg if `exc` is an `httpcore.ReadTimeout`, we want to map to 115s # `httpx.ReadTimeout`, not just `httpx.TimeoutException`. 115s if mapped_exc is None or issubclass(to_exc, mapped_exc): 115s mapped_exc = to_exc 115s 115s if mapped_exc is None: # pragma: no cover 115s raise 115s 115s message = str(exc) 115s > raise mapped_exc(message) from exc 115s E httpx.ProxyError: 503 Service Unavailable 115s 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:86: ProxyError 115s _____________ test_add_token_get_request[assert_token_in_uri-uri] ______________ 115s 115s @contextlib.contextmanager 115s def map_httpcore_exceptions() -> typing.Iterator[None]: 115s try: 115s > yield 115s 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:69: 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:373: in handle_async_request 115s resp = await self._pool.handle_async_request(req) 115s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:216: in handle_async_request 115s raise exc from None 115s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:196: in handle_async_request 115s response = await connection.handle_async_request( 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s 115s self = 115s request = 115s 115s async def handle_async_request(self, request: Request) -> Response: 115s timeouts = request.extensions.get("timeout", {}) 115s timeout = timeouts.get("connect", None) 115s 115s async with self._connect_lock: 115s if not self._connected: 115s target = b"%b:%d" % (self._remote_origin.host, self._remote_origin.port) 115s 115s connect_url = URL( 115s scheme=self._proxy_origin.scheme, 115s host=self._proxy_origin.host, 115s port=self._proxy_origin.port, 115s target=target, 115s ) 115s connect_headers = merge_headers( 115s [(b"Host", target), (b"Accept", b"*/*")], self._proxy_headers 115s ) 115s connect_request = Request( 115s method=b"CONNECT", 115s url=connect_url, 115s headers=connect_headers, 115s extensions=request.extensions, 115s ) 115s connect_response = await self._connection.handle_async_request( 115s connect_request 115s ) 115s 115s if connect_response.status < 200 or connect_response.status > 299: 115s reason_bytes = connect_response.extensions.get("reason_phrase", b"") 115s reason_str = reason_bytes.decode("ascii", errors="ignore") 115s msg = "%d %s" % (connect_response.status, reason_str) 115s await self._connection.aclose() 115s > raise ProxyError(msg) 115s E httpcore.ProxyError: 503 Service Unavailable 115s 115s /usr/lib/python3/dist-packages/httpcore/_async/http_proxy.py:298: ProxyError 115s 115s The above exception was the direct cause of the following exception: 115s 115s assert_func = 115s token_placement = 'uri' 115s 115s @pytest.mark.asyncio 115s @pytest.mark.parametrize( 115s "assert_func, token_placement", 115s [ 115s (assert_token_in_header, "header"), 115s (assert_token_in_body, "body"), 115s (assert_token_in_uri, "uri") 115s ] 115s ) 115s async def test_add_token_get_request(assert_func, token_placement): 115s mock_response = AsyncMockDispatch({'a': 'a'}, assert_func=assert_func) 115s async with AsyncOAuth2Client( 115s 'foo', 115s token=default_token, 115s token_placement=token_placement, 115s app=mock_response 115s ) as client: 115s > resp = await client.get('https://i.b') 115s 115s tests/clients/test_httpx/test_async_oauth2_client.py:62: 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s /usr/lib/python3/dist-packages/httpx/_client.py:1801: in get 115s return await self.request( 115s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:90: in request 115s return await super().request( 115s /usr/lib/python3/dist-packages/httpx/_client.py:1574: in request 115s return await self.send(request, auth=auth, follow_redirects=follow_redirects) 115s /usr/lib/python3/dist-packages/httpx/_client.py:1661: in send 115s response = await self._send_handling_auth( 115s /usr/lib/python3/dist-packages/httpx/_client.py:1689: in _send_handling_auth 115s response = await self._send_handling_redirects( 115s /usr/lib/python3/dist-packages/httpx/_client.py:1726: in _send_handling_redirects 115s response = await self._send_single_request(request) 115s /usr/lib/python3/dist-packages/httpx/_client.py:1763: in _send_single_request 115s response = await transport.handle_async_request(request) 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:372: in handle_async_request 115s with map_httpcore_exceptions(): 115s /usr/lib/python3.12/contextlib.py:158: in __exit__ 115s self.gen.throw(value) 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s 115s @contextlib.contextmanager 115s def map_httpcore_exceptions() -> typing.Iterator[None]: 115s try: 115s yield 115s except Exception as exc: 115s mapped_exc = None 115s 115s for from_exc, to_exc in HTTPCORE_EXC_MAP.items(): 115s if not isinstance(exc, from_exc): 115s continue 115s # We want to map to the most specific exception we can find. 115s # Eg if `exc` is an `httpcore.ReadTimeout`, we want to map to 115s # `httpx.ReadTimeout`, not just `httpx.TimeoutException`. 115s if mapped_exc is None or issubclass(to_exc, mapped_exc): 115s mapped_exc = to_exc 115s 115s if mapped_exc is None: # pragma: no cover 115s raise 115s 115s message = str(exc) 115s > raise mapped_exc(message) from exc 115s E httpx.ProxyError: 503 Service Unavailable 115s 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:86: ProxyError 115s ______ test_add_token_to_streaming_request[assert_token_in_header-header] ______ 115s 115s @contextlib.contextmanager 115s def map_httpcore_exceptions() -> typing.Iterator[None]: 115s try: 115s > yield 115s 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:69: 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:373: in handle_async_request 115s resp = await self._pool.handle_async_request(req) 115s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:216: in handle_async_request 115s raise exc from None 115s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:196: in handle_async_request 115s response = await connection.handle_async_request( 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s 115s self = 115s request = 115s 115s async def handle_async_request(self, request: Request) -> Response: 115s timeouts = request.extensions.get("timeout", {}) 115s timeout = timeouts.get("connect", None) 115s 115s async with self._connect_lock: 115s if not self._connected: 115s target = b"%b:%d" % (self._remote_origin.host, self._remote_origin.port) 115s 115s connect_url = URL( 115s scheme=self._proxy_origin.scheme, 115s host=self._proxy_origin.host, 115s port=self._proxy_origin.port, 115s target=target, 115s ) 115s connect_headers = merge_headers( 115s [(b"Host", target), (b"Accept", b"*/*")], self._proxy_headers 115s ) 115s connect_request = Request( 115s method=b"CONNECT", 115s url=connect_url, 115s headers=connect_headers, 115s extensions=request.extensions, 115s ) 115s connect_response = await self._connection.handle_async_request( 115s connect_request 115s ) 115s 115s if connect_response.status < 200 or connect_response.status > 299: 115s reason_bytes = connect_response.extensions.get("reason_phrase", b"") 115s reason_str = reason_bytes.decode("ascii", errors="ignore") 115s msg = "%d %s" % (connect_response.status, reason_str) 115s await self._connection.aclose() 115s > raise ProxyError(msg) 115s E httpcore.ProxyError: 503 Service Unavailable 115s 115s /usr/lib/python3/dist-packages/httpcore/_async/http_proxy.py:298: ProxyError 115s 115s The above exception was the direct cause of the following exception: 115s 115s assert_func = 115s token_placement = 'header' 115s 115s @pytest.mark.asyncio 115s @pytest.mark.parametrize( 115s "assert_func, token_placement", 115s [ 115s (assert_token_in_header, "header"), 115s (assert_token_in_body, "body"), 115s (assert_token_in_uri, "uri") 115s ] 115s ) 115s async def test_add_token_to_streaming_request(assert_func, token_placement): 115s mock_response = AsyncMockDispatch({'a': 'a'}, assert_func=assert_func) 115s async with AsyncOAuth2Client( 115s 'foo', 115s token=default_token, 115s token_placement=token_placement, 115s app=mock_response 115s ) as client: 115s > async with client.stream("GET", 'https://i.b') as stream: 115s 115s tests/clients/test_httpx/test_async_oauth2_client.py:85: 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s /usr/lib/python3.12/contextlib.py:210: in __aenter__ 115s return await anext(self.gen) 115s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:103: in stream 115s async with super().stream( 115s /usr/lib/python3.12/contextlib.py:210: in __aenter__ 115s return await anext(self.gen) 115s /usr/lib/python3/dist-packages/httpx/_client.py:1617: in stream 115s response = await self.send( 115s /usr/lib/python3/dist-packages/httpx/_client.py:1661: in send 115s response = await self._send_handling_auth( 115s /usr/lib/python3/dist-packages/httpx/_client.py:1689: in _send_handling_auth 115s response = await self._send_handling_redirects( 115s /usr/lib/python3/dist-packages/httpx/_client.py:1726: in _send_handling_redirects 115s response = await self._send_single_request(request) 115s /usr/lib/python3/dist-packages/httpx/_client.py:1763: in _send_single_request 115s response = await transport.handle_async_request(request) 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:372: in handle_async_request 115s with map_httpcore_exceptions(): 115s /usr/lib/python3.12/contextlib.py:158: in __exit__ 115s self.gen.throw(value) 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s 115s @contextlib.contextmanager 115s def map_httpcore_exceptions() -> typing.Iterator[None]: 115s try: 115s yield 115s except Exception as exc: 115s mapped_exc = None 115s 115s for from_exc, to_exc in HTTPCORE_EXC_MAP.items(): 115s if not isinstance(exc, from_exc): 115s continue 115s # We want to map to the most specific exception we can find. 115s # Eg if `exc` is an `httpcore.ReadTimeout`, we want to map to 115s # `httpx.ReadTimeout`, not just `httpx.TimeoutException`. 115s if mapped_exc is None or issubclass(to_exc, mapped_exc): 115s mapped_exc = to_exc 115s 115s if mapped_exc is None: # pragma: no cover 115s raise 115s 115s message = str(exc) 115s > raise mapped_exc(message) from exc 115s E httpx.ProxyError: 503 Service Unavailable 115s 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:86: ProxyError 115s ________ test_add_token_to_streaming_request[assert_token_in_body-body] ________ 115s 115s @contextlib.contextmanager 115s def map_httpcore_exceptions() -> typing.Iterator[None]: 115s try: 115s > yield 115s 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:69: 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:373: in handle_async_request 115s resp = await self._pool.handle_async_request(req) 115s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:216: in handle_async_request 115s raise exc from None 115s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:196: in handle_async_request 115s response = await connection.handle_async_request( 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s 115s self = 115s request = 115s 115s async def handle_async_request(self, request: Request) -> Response: 115s timeouts = request.extensions.get("timeout", {}) 115s timeout = timeouts.get("connect", None) 115s 115s async with self._connect_lock: 115s if not self._connected: 115s target = b"%b:%d" % (self._remote_origin.host, self._remote_origin.port) 115s 115s connect_url = URL( 115s scheme=self._proxy_origin.scheme, 115s host=self._proxy_origin.host, 115s port=self._proxy_origin.port, 115s target=target, 115s ) 115s connect_headers = merge_headers( 115s [(b"Host", target), (b"Accept", b"*/*")], self._proxy_headers 115s ) 115s connect_request = Request( 115s method=b"CONNECT", 115s url=connect_url, 115s headers=connect_headers, 115s extensions=request.extensions, 115s ) 115s connect_response = await self._connection.handle_async_request( 115s connect_request 115s ) 115s 115s if connect_response.status < 200 or connect_response.status > 299: 115s reason_bytes = connect_response.extensions.get("reason_phrase", b"") 115s reason_str = reason_bytes.decode("ascii", errors="ignore") 115s msg = "%d %s" % (connect_response.status, reason_str) 115s await self._connection.aclose() 115s > raise ProxyError(msg) 115s E httpcore.ProxyError: 503 Service Unavailable 115s 115s /usr/lib/python3/dist-packages/httpcore/_async/http_proxy.py:298: ProxyError 115s 115s The above exception was the direct cause of the following exception: 115s 115s assert_func = 115s token_placement = 'body' 115s 115s @pytest.mark.asyncio 115s @pytest.mark.parametrize( 115s "assert_func, token_placement", 115s [ 115s (assert_token_in_header, "header"), 115s (assert_token_in_body, "body"), 115s (assert_token_in_uri, "uri") 115s ] 115s ) 115s async def test_add_token_to_streaming_request(assert_func, token_placement): 115s mock_response = AsyncMockDispatch({'a': 'a'}, assert_func=assert_func) 115s async with AsyncOAuth2Client( 115s 'foo', 115s token=default_token, 115s token_placement=token_placement, 115s app=mock_response 115s ) as client: 115s > async with client.stream("GET", 'https://i.b') as stream: 115s 115s tests/clients/test_httpx/test_async_oauth2_client.py:85: 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s /usr/lib/python3.12/contextlib.py:210: in __aenter__ 115s return await anext(self.gen) 115s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:103: in stream 115s async with super().stream( 115s /usr/lib/python3.12/contextlib.py:210: in __aenter__ 115s return await anext(self.gen) 115s /usr/lib/python3/dist-packages/httpx/_client.py:1617: in stream 115s response = await self.send( 115s /usr/lib/python3/dist-packages/httpx/_client.py:1661: in send 115s response = await self._send_handling_auth( 115s /usr/lib/python3/dist-packages/httpx/_client.py:1689: in _send_handling_auth 115s response = await self._send_handling_redirects( 115s /usr/lib/python3/dist-packages/httpx/_client.py:1726: in _send_handling_redirects 115s response = await self._send_single_request(request) 115s /usr/lib/python3/dist-packages/httpx/_client.py:1763: in _send_single_request 115s response = await transport.handle_async_request(request) 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:372: in handle_async_request 115s with map_httpcore_exceptions(): 115s /usr/lib/python3.12/contextlib.py:158: in __exit__ 115s self.gen.throw(value) 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s 115s @contextlib.contextmanager 115s def map_httpcore_exceptions() -> typing.Iterator[None]: 115s try: 115s yield 115s except Exception as exc: 115s mapped_exc = None 115s 115s for from_exc, to_exc in HTTPCORE_EXC_MAP.items(): 115s if not isinstance(exc, from_exc): 115s continue 115s # We want to map to the most specific exception we can find. 115s # Eg if `exc` is an `httpcore.ReadTimeout`, we want to map to 115s # `httpx.ReadTimeout`, not just `httpx.TimeoutException`. 115s if mapped_exc is None or issubclass(to_exc, mapped_exc): 115s mapped_exc = to_exc 115s 115s if mapped_exc is None: # pragma: no cover 115s raise 115s 115s message = str(exc) 115s > raise mapped_exc(message) from exc 115s E httpx.ProxyError: 503 Service Unavailable 115s 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:86: ProxyError 115s _________ test_add_token_to_streaming_request[assert_token_in_uri-uri] _________ 115s 115s @contextlib.contextmanager 115s def map_httpcore_exceptions() -> typing.Iterator[None]: 115s try: 115s > yield 115s 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:69: 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:373: in handle_async_request 115s resp = await self._pool.handle_async_request(req) 115s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:216: in handle_async_request 115s raise exc from None 115s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:196: in handle_async_request 115s response = await connection.handle_async_request( 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s 115s self = 115s request = 115s 115s async def handle_async_request(self, request: Request) -> Response: 115s timeouts = request.extensions.get("timeout", {}) 115s timeout = timeouts.get("connect", None) 115s 115s async with self._connect_lock: 115s if not self._connected: 115s target = b"%b:%d" % (self._remote_origin.host, self._remote_origin.port) 115s 115s connect_url = URL( 115s scheme=self._proxy_origin.scheme, 115s host=self._proxy_origin.host, 115s port=self._proxy_origin.port, 115s target=target, 115s ) 115s connect_headers = merge_headers( 115s [(b"Host", target), (b"Accept", b"*/*")], self._proxy_headers 115s ) 115s connect_request = Request( 115s method=b"CONNECT", 115s url=connect_url, 115s headers=connect_headers, 115s extensions=request.extensions, 115s ) 115s connect_response = await self._connection.handle_async_request( 115s connect_request 115s ) 115s 115s if connect_response.status < 200 or connect_response.status > 299: 115s reason_bytes = connect_response.extensions.get("reason_phrase", b"") 115s reason_str = reason_bytes.decode("ascii", errors="ignore") 115s msg = "%d %s" % (connect_response.status, reason_str) 115s await self._connection.aclose() 115s > raise ProxyError(msg) 115s E httpcore.ProxyError: 503 Service Unavailable 115s 115s /usr/lib/python3/dist-packages/httpcore/_async/http_proxy.py:298: ProxyError 115s 115s The above exception was the direct cause of the following exception: 115s 115s assert_func = 115s token_placement = 'uri' 115s 115s @pytest.mark.asyncio 115s @pytest.mark.parametrize( 115s "assert_func, token_placement", 115s [ 115s (assert_token_in_header, "header"), 115s (assert_token_in_body, "body"), 115s (assert_token_in_uri, "uri") 115s ] 115s ) 115s async def test_add_token_to_streaming_request(assert_func, token_placement): 115s mock_response = AsyncMockDispatch({'a': 'a'}, assert_func=assert_func) 115s async with AsyncOAuth2Client( 115s 'foo', 115s token=default_token, 115s token_placement=token_placement, 115s app=mock_response 115s ) as client: 115s > async with client.stream("GET", 'https://i.b') as stream: 115s 115s tests/clients/test_httpx/test_async_oauth2_client.py:85: 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s /usr/lib/python3.12/contextlib.py:210: in __aenter__ 115s return await anext(self.gen) 115s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:103: in stream 115s async with super().stream( 115s /usr/lib/python3.12/contextlib.py:210: in __aenter__ 115s return await anext(self.gen) 115s /usr/lib/python3/dist-packages/httpx/_client.py:1617: in stream 115s response = await self.send( 115s /usr/lib/python3/dist-packages/httpx/_client.py:1661: in send 115s response = await self._send_handling_auth( 115s /usr/lib/python3/dist-packages/httpx/_client.py:1689: in _send_handling_auth 115s response = await self._send_handling_redirects( 115s /usr/lib/python3/dist-packages/httpx/_client.py:1726: in _send_handling_redirects 115s response = await self._send_single_request(request) 115s /usr/lib/python3/dist-packages/httpx/_client.py:1763: in _send_single_request 115s response = await transport.handle_async_request(request) 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:372: in handle_async_request 115s with map_httpcore_exceptions(): 115s /usr/lib/python3.12/contextlib.py:158: in __exit__ 115s self.gen.throw(value) 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s 115s @contextlib.contextmanager 115s def map_httpcore_exceptions() -> typing.Iterator[None]: 115s try: 115s yield 115s except Exception as exc: 115s mapped_exc = None 115s 115s for from_exc, to_exc in HTTPCORE_EXC_MAP.items(): 115s if not isinstance(exc, from_exc): 115s continue 115s # We want to map to the most specific exception we can find. 115s # Eg if `exc` is an `httpcore.ReadTimeout`, we want to map to 115s # `httpx.ReadTimeout`, not just `httpx.TimeoutException`. 115s if mapped_exc is None or issubclass(to_exc, mapped_exc): 115s mapped_exc = to_exc 115s 115s if mapped_exc is None: # pragma: no cover 115s raise 115s 115s message = str(exc) 115s > raise mapped_exc(message) from exc 115s E httpx.ProxyError: 503 Service Unavailable 115s 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:86: ProxyError 115s ____________________________ test_fetch_token_post _____________________________ 115s 115s @pytest.mark.asyncio 115s async def test_fetch_token_post(): 115s url = 'https://example.com/token' 115s 115s async def assert_func(request): 115s content = await request.body() 115s content = content.decode() 115s assert 'code=v' in content 115s assert 'client_id=' in content 115s assert 'grant_type=authorization_code' in content 115s 115s mock_response = AsyncMockDispatch(default_token, assert_func=assert_func) 115s async with AsyncOAuth2Client('foo', app=mock_response) as client: 115s > token = await client.fetch_token(url, authorization_response='https://i.b/?code=v') 115s 115s tests/clients/test_httpx/test_async_oauth2_client.py:156: 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:138: in _fetch_token 115s return self.parse_response_token(resp) 115s /usr/lib/python3/dist-packages/authlib/oauth2/client.py:342: in parse_response_token 115s token = resp.json() 115s /usr/lib/python3/dist-packages/httpx/_models.py:764: in json 115s return jsonlib.loads(self.content, **kwargs) 115s /usr/lib/python3.12/json/__init__.py:346: in loads 115s return _default_decoder.decode(s) 115s /usr/lib/python3.12/json/decoder.py:337: in decode 115s obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s 115s self = 115s s = '\n\n\t\t\n\t\n\n' 115s idx = 0 115s 115s def raw_decode(self, s, idx=0): 115s """Decode a JSON document from ``s`` (a ``str`` beginning with 115s a JSON document) and return a 2-tuple of the Python 115s representation and the index in ``s`` where the document ended. 115s 115s This can be used to decode a JSON document from a string that may 115s have extraneous data at the end. 115s 115s """ 115s try: 115s obj, end = self.scan_once(s, idx) 115s except StopIteration as err: 115s > raise JSONDecodeError("Expecting value", s, err.value) from None 115s E json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) 115s 115s /usr/lib/python3.12/json/decoder.py:355: JSONDecodeError 115s _____________________________ test_fetch_token_get _____________________________ 115s 115s @pytest.mark.asyncio 115s async def test_fetch_token_get(): 115s url = 'https://example.com/token' 115s 115s async def assert_func(request): 115s url = str(request.url) 115s assert 'code=v' in url 115s assert 'client_id=' in url 115s assert 'grant_type=authorization_code' in url 115s 115s mock_response = AsyncMockDispatch(default_token, assert_func=assert_func) 115s async with AsyncOAuth2Client('foo', app=mock_response) as client: 115s authorization_response = 'https://i.b/?code=v' 115s > token = await client.fetch_token( 115s url, authorization_response=authorization_response, method='GET') 115s 115s tests/clients/test_httpx/test_async_oauth2_client.py:186: 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:138: in _fetch_token 115s return self.parse_response_token(resp) 115s /usr/lib/python3/dist-packages/authlib/oauth2/client.py:342: in parse_response_token 115s token = resp.json() 115s /usr/lib/python3/dist-packages/httpx/_models.py:764: in json 115s return jsonlib.loads(self.content, **kwargs) 115s /usr/lib/python3.12/json/__init__.py:346: in loads 115s return _default_decoder.decode(s) 115s /usr/lib/python3.12/json/decoder.py:337: in decode 115s obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s 115s self = 115s s = '\n\n\n Example Domain\n\n \n \n

More information...

\n\n\n\n' 115s idx = 0 115s 115s def raw_decode(self, s, idx=0): 115s """Decode a JSON document from ``s`` (a ``str`` beginning with 115s a JSON document) and return a 2-tuple of the Python 115s representation and the index in ``s`` where the document ended. 115s 115s This can be used to decode a JSON document from a string that may 115s have extraneous data at the end. 115s 115s """ 115s try: 115s obj, end = self.scan_once(s, idx) 115s except StopIteration as err: 115s > raise JSONDecodeError("Expecting value", s, err.value) from None 115s E json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) 115s 115s /usr/lib/python3.12/json/decoder.py:355: JSONDecodeError 115s __________________ test_token_auth_method_client_secret_post ___________________ 115s 115s @pytest.mark.asyncio 115s async def test_token_auth_method_client_secret_post(): 115s url = 'https://example.com/token' 115s 115s async def assert_func(request): 115s content = await request.body() 115s content = content.decode() 115s assert 'code=v' in content 115s assert 'client_id=' in content 115s assert 'client_secret=bar' in content 115s assert 'grant_type=authorization_code' in content 115s 115s mock_response = AsyncMockDispatch(default_token, assert_func=assert_func) 115s async with AsyncOAuth2Client( 115s 'foo', 'bar', 115s token_endpoint_auth_method='client_secret_post', 115s app=mock_response 115s ) as client: 115s > token = await client.fetch_token(url, code='v') 115s 115s tests/clients/test_httpx/test_async_oauth2_client.py:220: 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:138: in _fetch_token 115s return self.parse_response_token(resp) 115s /usr/lib/python3/dist-packages/authlib/oauth2/client.py:342: in parse_response_token 115s token = resp.json() 115s /usr/lib/python3/dist-packages/httpx/_models.py:764: in json 115s return jsonlib.loads(self.content, **kwargs) 115s /usr/lib/python3.12/json/__init__.py:346: in loads 115s return _default_decoder.decode(s) 115s /usr/lib/python3.12/json/decoder.py:337: in decode 115s obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s 115s self = 115s s = '\n\n\t\t\n\t\n\n' 115s idx = 0 115s 115s def raw_decode(self, s, idx=0): 115s """Decode a JSON document from ``s`` (a ``str`` beginning with 115s a JSON document) and return a 2-tuple of the Python 115s representation and the index in ``s`` where the document ended. 115s 115s This can be used to decode a JSON document from a string that may 115s have extraneous data at the end. 115s 115s """ 115s try: 115s obj, end = self.scan_once(s, idx) 115s except StopIteration as err: 115s > raise JSONDecodeError("Expecting value", s, err.value) from None 115s E json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) 115s 115s /usr/lib/python3.12/json/decoder.py:355: JSONDecodeError 115s _______________________ test_access_token_response_hook ________________________ 115s 115s @pytest.mark.asyncio 115s async def test_access_token_response_hook(): 115s url = 'https://example.com/token' 115s 115s def _access_token_response_hook(resp): 115s assert resp.json() == default_token 115s return resp 115s 115s access_token_response_hook = mock.Mock(side_effect=_access_token_response_hook) 115s app = AsyncMockDispatch(default_token) 115s async with AsyncOAuth2Client('foo', token=default_token, app=app) as sess: 115s sess.register_compliance_hook( 115s 'access_token_response', 115s access_token_response_hook 115s ) 115s > assert await sess.fetch_token(url) == default_token 115s 115s tests/clients/test_httpx/test_async_oauth2_client.py:240: 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:136: in _fetch_token 115s resp = hook(resp) 115s /usr/lib/python3.12/unittest/mock.py:1134: in __call__ 115s return self._mock_call(*args, **kwargs) 115s /usr/lib/python3.12/unittest/mock.py:1138: in _mock_call 115s return self._execute_mock_call(*args, **kwargs) 115s /usr/lib/python3.12/unittest/mock.py:1199: in _execute_mock_call 115s result = effect(*args, **kwargs) 115s tests/clients/test_httpx/test_async_oauth2_client.py:230: in _access_token_response_hook 115s assert resp.json() == default_token 115s /usr/lib/python3/dist-packages/httpx/_models.py:764: in json 115s return jsonlib.loads(self.content, **kwargs) 115s /usr/lib/python3.12/json/__init__.py:346: in loads 115s return _default_decoder.decode(s) 115s /usr/lib/python3.12/json/decoder.py:337: in decode 115s obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s 115s self = 115s s = '\n\n\t\t\n\t\n\n' 115s idx = 0 115s 115s def raw_decode(self, s, idx=0): 115s """Decode a JSON document from ``s`` (a ``str`` beginning with 115s a JSON document) and return a 2-tuple of the Python 115s representation and the index in ``s`` where the document ended. 115s 115s This can be used to decode a JSON document from a string that may 115s have extraneous data at the end. 115s 115s """ 115s try: 115s obj, end = self.scan_once(s, idx) 115s except StopIteration as err: 115s > raise JSONDecodeError("Expecting value", s, err.value) from None 115s E json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) 115s 115s /usr/lib/python3.12/json/decoder.py:355: JSONDecodeError 115s ___________________________ test_password_grant_type ___________________________ 115s 115s @pytest.mark.asyncio 115s async def test_password_grant_type(): 115s url = 'https://example.com/token' 115s 115s async def assert_func(request): 115s content = await request.body() 115s content = content.decode() 115s assert 'username=v' in content 115s assert 'scope=profile' in content 115s assert 'grant_type=password' in content 115s 115s app = AsyncMockDispatch(default_token, assert_func=assert_func) 115s async with AsyncOAuth2Client('foo', scope='profile', app=app) as sess: 115s > token = await sess.fetch_token(url, username='v', password='v') 115s 115s tests/clients/test_httpx/test_async_oauth2_client.py:257: 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:138: in _fetch_token 115s return self.parse_response_token(resp) 115s /usr/lib/python3/dist-packages/authlib/oauth2/client.py:342: in parse_response_token 115s token = resp.json() 115s /usr/lib/python3/dist-packages/httpx/_models.py:764: in json 115s return jsonlib.loads(self.content, **kwargs) 115s /usr/lib/python3.12/json/__init__.py:346: in loads 115s return _default_decoder.decode(s) 115s /usr/lib/python3.12/json/decoder.py:337: in decode 115s obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s 115s self = 115s s = '\n\n\t\t\n\t\n\n' 115s idx = 0 115s 115s def raw_decode(self, s, idx=0): 115s """Decode a JSON document from ``s`` (a ``str`` beginning with 115s a JSON document) and return a 2-tuple of the Python 115s representation and the index in ``s`` where the document ended. 115s 115s This can be used to decode a JSON document from a string that may 115s have extraneous data at the end. 115s 115s """ 115s try: 115s obj, end = self.scan_once(s, idx) 115s except StopIteration as err: 115s > raise JSONDecodeError("Expecting value", s, err.value) from None 115s E json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) 115s 115s /usr/lib/python3.12/json/decoder.py:355: JSONDecodeError 115s _________________________ test_client_credentials_type _________________________ 115s 115s @pytest.mark.asyncio 115s async def test_client_credentials_type(): 115s url = 'https://example.com/token' 115s 115s async def assert_func(request): 115s content = await request.body() 115s content = content.decode() 115s assert 'scope=profile' in content 115s assert 'grant_type=client_credentials' in content 115s 115s app = AsyncMockDispatch(default_token, assert_func=assert_func) 115s async with AsyncOAuth2Client('foo', scope='profile', app=app) as sess: 115s > token = await sess.fetch_token(url) 115s 115s tests/clients/test_httpx/test_async_oauth2_client.py:277: 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:138: in _fetch_token 115s return self.parse_response_token(resp) 115s /usr/lib/python3/dist-packages/authlib/oauth2/client.py:342: in parse_response_token 115s token = resp.json() 115s /usr/lib/python3/dist-packages/httpx/_models.py:764: in json 115s return jsonlib.loads(self.content, **kwargs) 115s /usr/lib/python3.12/json/__init__.py:346: in loads 115s return _default_decoder.decode(s) 115s /usr/lib/python3.12/json/decoder.py:337: in decode 115s obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s 115s self = 115s s = '\n\n\t\t\n\t\n\n' 115s idx = 0 115s 115s def raw_decode(self, s, idx=0): 115s """Decode a JSON document from ``s`` (a ``str`` beginning with 115s a JSON document) and return a 2-tuple of the Python 115s representation and the index in ``s`` where the document ended. 115s 115s This can be used to decode a JSON document from a string that may 115s have extraneous data at the end. 115s 115s """ 115s try: 115s obj, end = self.scan_once(s, idx) 115s except StopIteration as err: 115s > raise JSONDecodeError("Expecting value", s, err.value) from None 115s E json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) 115s 115s /usr/lib/python3.12/json/decoder.py:355: JSONDecodeError 115s ______________ test_cleans_previous_token_before_fetching_new_one ______________ 115s 115s @pytest.mark.asyncio 115s async def test_cleans_previous_token_before_fetching_new_one(): 115s now = int(time.time()) 115s new_token = deepcopy(default_token) 115s past = now - 7200 115s default_token['expires_at'] = past 115s new_token['expires_at'] = now + 3600 115s url = 'https://example.com/token' 115s 115s app = AsyncMockDispatch(new_token) 115s with mock.patch('time.time', lambda: now): 115s async with AsyncOAuth2Client('foo', token=default_token, app=app) as sess: 115s > assert await sess.fetch_token(url) == new_token 115s 115s tests/clients/test_httpx/test_async_oauth2_client.py:296: 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:138: in _fetch_token 115s return self.parse_response_token(resp) 115s /usr/lib/python3/dist-packages/authlib/oauth2/client.py:342: in parse_response_token 115s token = resp.json() 115s /usr/lib/python3/dist-packages/httpx/_models.py:764: in json 115s return jsonlib.loads(self.content, **kwargs) 115s /usr/lib/python3.12/json/__init__.py:346: in loads 115s return _default_decoder.decode(s) 115s /usr/lib/python3.12/json/decoder.py:337: in decode 115s obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s 115s self = 115s s = '\n\n\t\t\n\t\n\n' 115s idx = 0 115s 115s def raw_decode(self, s, idx=0): 115s """Decode a JSON document from ``s`` (a ``str`` beginning with 115s a JSON document) and return a 2-tuple of the Python 115s representation and the index in ``s`` where the document ended. 115s 115s This can be used to decode a JSON document from a string that may 115s have extraneous data at the end. 115s 115s """ 115s try: 115s obj, end = self.scan_once(s, idx) 115s except StopIteration as err: 115s > raise JSONDecodeError("Expecting value", s, err.value) from None 115s E json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) 115s 115s /usr/lib/python3.12/json/decoder.py:355: JSONDecodeError 115s ___________________________ test_auto_refresh_token ____________________________ 115s 115s @contextlib.contextmanager 115s def map_httpcore_exceptions() -> typing.Iterator[None]: 115s try: 115s > yield 115s 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:69: 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:373: in handle_async_request 115s resp = await self._pool.handle_async_request(req) 115s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:216: in handle_async_request 115s raise exc from None 115s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:196: in handle_async_request 115s response = await connection.handle_async_request( 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s 115s self = 115s request = 115s 115s async def handle_async_request(self, request: Request) -> Response: 115s timeouts = request.extensions.get("timeout", {}) 115s timeout = timeouts.get("connect", None) 115s 115s async with self._connect_lock: 115s if not self._connected: 115s target = b"%b:%d" % (self._remote_origin.host, self._remote_origin.port) 115s 115s connect_url = URL( 115s scheme=self._proxy_origin.scheme, 115s host=self._proxy_origin.host, 115s port=self._proxy_origin.port, 115s target=target, 115s ) 115s connect_headers = merge_headers( 115s [(b"Host", target), (b"Accept", b"*/*")], self._proxy_headers 115s ) 115s connect_request = Request( 115s method=b"CONNECT", 115s url=connect_url, 115s headers=connect_headers, 115s extensions=request.extensions, 115s ) 115s connect_response = await self._connection.handle_async_request( 115s connect_request 115s ) 115s 115s if connect_response.status < 200 or connect_response.status > 299: 115s reason_bytes = connect_response.extensions.get("reason_phrase", b"") 115s reason_str = reason_bytes.decode("ascii", errors="ignore") 115s msg = "%d %s" % (connect_response.status, reason_str) 115s await self._connection.aclose() 115s > raise ProxyError(msg) 115s E httpcore.ProxyError: 503 Service Unavailable 115s 115s /usr/lib/python3/dist-packages/httpcore/_async/http_proxy.py:298: ProxyError 115s 115s The above exception was the direct cause of the following exception: 115s 115s @pytest.mark.asyncio 115s async def test_auto_refresh_token(): 115s 115s async def _update_token(token, refresh_token=None, access_token=None): 115s assert refresh_token == 'b' 115s assert token == default_token 115s 115s update_token = mock.Mock(side_effect=_update_token) 115s 115s old_token = dict( 115s access_token='a', refresh_token='b', 115s token_type='bearer', expires_at=100 115s ) 115s 115s app = AsyncMockDispatch(default_token) 115s async with AsyncOAuth2Client( 115s 'foo', token=old_token, token_endpoint='https://i.b/token', 115s update_token=update_token, app=app 115s ) as sess: 115s > await sess.get('https://i.b/user') 115s 115s tests/clients/test_httpx/test_async_oauth2_client.py:324: 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s /usr/lib/python3/dist-packages/httpx/_client.py:1801: in get 115s return await self.request( 115s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:86: in request 115s await self.ensure_active_token(self.token) 115s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:113: in ensure_active_token 115s await self.refresh_token(url, refresh_token=refresh_token) 115s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:142: in _refresh_token 115s resp = await self.post( 115s /usr/lib/python3/dist-packages/httpx/_client.py:1892: in post 115s return await self.request( 115s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:90: in request 115s return await super().request( 115s /usr/lib/python3/dist-packages/httpx/_client.py:1574: in request 115s return await self.send(request, auth=auth, follow_redirects=follow_redirects) 115s /usr/lib/python3/dist-packages/httpx/_client.py:1661: in send 115s response = await self._send_handling_auth( 115s /usr/lib/python3/dist-packages/httpx/_client.py:1689: in _send_handling_auth 115s response = await self._send_handling_redirects( 115s /usr/lib/python3/dist-packages/httpx/_client.py:1726: in _send_handling_redirects 115s response = await self._send_single_request(request) 115s /usr/lib/python3/dist-packages/httpx/_client.py:1763: in _send_single_request 115s response = await transport.handle_async_request(request) 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:372: in handle_async_request 115s with map_httpcore_exceptions(): 115s /usr/lib/python3.12/contextlib.py:158: in __exit__ 115s self.gen.throw(value) 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s 115s @contextlib.contextmanager 115s def map_httpcore_exceptions() -> typing.Iterator[None]: 115s try: 115s yield 115s except Exception as exc: 115s mapped_exc = None 115s 115s for from_exc, to_exc in HTTPCORE_EXC_MAP.items(): 115s if not isinstance(exc, from_exc): 115s continue 115s # We want to map to the most specific exception we can find. 115s # Eg if `exc` is an `httpcore.ReadTimeout`, we want to map to 115s # `httpx.ReadTimeout`, not just `httpx.TimeoutException`. 115s if mapped_exc is None or issubclass(to_exc, mapped_exc): 115s mapped_exc = to_exc 115s 115s if mapped_exc is None: # pragma: no cover 115s raise 115s 115s message = str(exc) 115s > raise mapped_exc(message) from exc 115s E httpx.ProxyError: 503 Service Unavailable 115s 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:86: ProxyError 115s ___________________________ test_auto_refresh_token2 ___________________________ 115s 115s @contextlib.contextmanager 115s def map_httpcore_exceptions() -> typing.Iterator[None]: 115s try: 115s > yield 115s 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:69: 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:373: in handle_async_request 115s resp = await self._pool.handle_async_request(req) 115s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:216: in handle_async_request 115s raise exc from None 115s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:196: in handle_async_request 115s response = await connection.handle_async_request( 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s 115s self = 115s request = 115s 115s async def handle_async_request(self, request: Request) -> Response: 115s timeouts = request.extensions.get("timeout", {}) 115s timeout = timeouts.get("connect", None) 115s 115s async with self._connect_lock: 115s if not self._connected: 115s target = b"%b:%d" % (self._remote_origin.host, self._remote_origin.port) 115s 115s connect_url = URL( 115s scheme=self._proxy_origin.scheme, 115s host=self._proxy_origin.host, 115s port=self._proxy_origin.port, 115s target=target, 115s ) 115s connect_headers = merge_headers( 115s [(b"Host", target), (b"Accept", b"*/*")], self._proxy_headers 115s ) 115s connect_request = Request( 115s method=b"CONNECT", 115s url=connect_url, 115s headers=connect_headers, 115s extensions=request.extensions, 115s ) 115s connect_response = await self._connection.handle_async_request( 115s connect_request 115s ) 115s 115s if connect_response.status < 200 or connect_response.status > 299: 115s reason_bytes = connect_response.extensions.get("reason_phrase", b"") 115s reason_str = reason_bytes.decode("ascii", errors="ignore") 115s msg = "%d %s" % (connect_response.status, reason_str) 115s await self._connection.aclose() 115s > raise ProxyError(msg) 115s E httpcore.ProxyError: 503 Service Unavailable 115s 115s /usr/lib/python3/dist-packages/httpcore/_async/http_proxy.py:298: ProxyError 115s 115s The above exception was the direct cause of the following exception: 115s 115s @pytest.mark.asyncio 115s async def test_auto_refresh_token2(): 115s 115s async def _update_token(token, refresh_token=None, access_token=None): 115s assert access_token == 'a' 115s assert token == default_token 115s 115s update_token = mock.Mock(side_effect=_update_token) 115s 115s old_token = dict( 115s access_token='a', 115s token_type='bearer', 115s expires_at=100 115s ) 115s 115s app = AsyncMockDispatch(default_token) 115s 115s async with AsyncOAuth2Client( 115s 'foo', token=old_token, 115s token_endpoint='https://i.b/token', 115s grant_type='client_credentials', 115s app=app, 115s ) as client: 115s > await client.get('https://i.b/user') 115s 115s tests/clients/test_httpx/test_async_oauth2_client.py:363: 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s /usr/lib/python3/dist-packages/httpx/_client.py:1801: in get 115s return await self.request( 115s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:86: in request 115s await self.ensure_active_token(self.token) 115s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:116: in ensure_active_token 115s new_token = await self.fetch_token(url, grant_type='client_credentials') 115s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:125: in _fetch_token 115s resp = await self.post( 115s /usr/lib/python3/dist-packages/httpx/_client.py:1892: in post 115s return await self.request( 115s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:90: in request 115s return await super().request( 115s /usr/lib/python3/dist-packages/httpx/_client.py:1574: in request 115s return await self.send(request, auth=auth, follow_redirects=follow_redirects) 115s /usr/lib/python3/dist-packages/httpx/_client.py:1661: in send 115s response = await self._send_handling_auth( 115s /usr/lib/python3/dist-packages/httpx/_client.py:1689: in _send_handling_auth 115s response = await self._send_handling_redirects( 115s /usr/lib/python3/dist-packages/httpx/_client.py:1726: in _send_handling_redirects 115s response = await self._send_single_request(request) 115s /usr/lib/python3/dist-packages/httpx/_client.py:1763: in _send_single_request 115s response = await transport.handle_async_request(request) 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:372: in handle_async_request 115s with map_httpcore_exceptions(): 115s /usr/lib/python3.12/contextlib.py:158: in __exit__ 115s self.gen.throw(value) 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s 115s @contextlib.contextmanager 115s def map_httpcore_exceptions() -> typing.Iterator[None]: 115s try: 115s yield 115s except Exception as exc: 115s mapped_exc = None 115s 115s for from_exc, to_exc in HTTPCORE_EXC_MAP.items(): 115s if not isinstance(exc, from_exc): 115s continue 115s # We want to map to the most specific exception we can find. 115s # Eg if `exc` is an `httpcore.ReadTimeout`, we want to map to 115s # `httpx.ReadTimeout`, not just `httpx.TimeoutException`. 115s if mapped_exc is None or issubclass(to_exc, mapped_exc): 115s mapped_exc = to_exc 115s 115s if mapped_exc is None: # pragma: no cover 115s raise 115s 115s message = str(exc) 115s > raise mapped_exc(message) from exc 115s E httpx.ProxyError: 503 Service Unavailable 115s 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:86: ProxyError 115s ___________________________ test_auto_refresh_token3 ___________________________ 115s 115s @contextlib.contextmanager 115s def map_httpcore_exceptions() -> typing.Iterator[None]: 115s try: 115s > yield 115s 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:69: 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:373: in handle_async_request 115s resp = await self._pool.handle_async_request(req) 115s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:216: in handle_async_request 115s raise exc from None 115s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:196: in handle_async_request 115s response = await connection.handle_async_request( 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s 115s self = 115s request = 115s 115s async def handle_async_request(self, request: Request) -> Response: 115s timeouts = request.extensions.get("timeout", {}) 115s timeout = timeouts.get("connect", None) 115s 115s async with self._connect_lock: 115s if not self._connected: 115s target = b"%b:%d" % (self._remote_origin.host, self._remote_origin.port) 115s 115s connect_url = URL( 115s scheme=self._proxy_origin.scheme, 115s host=self._proxy_origin.host, 115s port=self._proxy_origin.port, 115s target=target, 115s ) 115s connect_headers = merge_headers( 115s [(b"Host", target), (b"Accept", b"*/*")], self._proxy_headers 115s ) 115s connect_request = Request( 115s method=b"CONNECT", 115s url=connect_url, 115s headers=connect_headers, 115s extensions=request.extensions, 115s ) 115s connect_response = await self._connection.handle_async_request( 115s connect_request 115s ) 115s 115s if connect_response.status < 200 or connect_response.status > 299: 115s reason_bytes = connect_response.extensions.get("reason_phrase", b"") 115s reason_str = reason_bytes.decode("ascii", errors="ignore") 115s msg = "%d %s" % (connect_response.status, reason_str) 115s await self._connection.aclose() 115s > raise ProxyError(msg) 115s E httpcore.ProxyError: 503 Service Unavailable 115s 115s /usr/lib/python3/dist-packages/httpcore/_async/http_proxy.py:298: ProxyError 115s 115s The above exception was the direct cause of the following exception: 115s 115s @pytest.mark.asyncio 115s async def test_auto_refresh_token3(): 115s async def _update_token(token, refresh_token=None, access_token=None): 115s assert access_token == 'a' 115s assert token == default_token 115s 115s update_token = mock.Mock(side_effect=_update_token) 115s 115s old_token = dict( 115s access_token='a', 115s token_type='bearer', 115s expires_at=100 115s ) 115s 115s app = AsyncMockDispatch(default_token) 115s 115s async with AsyncOAuth2Client( 115s 'foo', token=old_token, token_endpoint='https://i.b/token', 115s update_token=update_token, grant_type='client_credentials', 115s app=app, 115s ) as client: 115s > await client.post('https://i.b/user', json={'foo': 'bar'}) 115s 115s tests/clients/test_httpx/test_async_oauth2_client.py:396: 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s /usr/lib/python3/dist-packages/httpx/_client.py:1892: in post 115s return await self.request( 115s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:86: in request 115s await self.ensure_active_token(self.token) 115s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:116: in ensure_active_token 115s new_token = await self.fetch_token(url, grant_type='client_credentials') 115s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:125: in _fetch_token 115s resp = await self.post( 115s /usr/lib/python3/dist-packages/httpx/_client.py:1892: in post 115s return await self.request( 115s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:90: in request 115s return await super().request( 115s /usr/lib/python3/dist-packages/httpx/_client.py:1574: in request 115s return await self.send(request, auth=auth, follow_redirects=follow_redirects) 115s /usr/lib/python3/dist-packages/httpx/_client.py:1661: in send 115s response = await self._send_handling_auth( 115s /usr/lib/python3/dist-packages/httpx/_client.py:1689: in _send_handling_auth 115s response = await self._send_handling_redirects( 115s /usr/lib/python3/dist-packages/httpx/_client.py:1726: in _send_handling_redirects 115s response = await self._send_single_request(request) 115s /usr/lib/python3/dist-packages/httpx/_client.py:1763: in _send_single_request 115s response = await transport.handle_async_request(request) 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:372: in handle_async_request 115s with map_httpcore_exceptions(): 115s /usr/lib/python3.12/contextlib.py:158: in __exit__ 115s self.gen.throw(value) 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s 115s @contextlib.contextmanager 115s def map_httpcore_exceptions() -> typing.Iterator[None]: 115s try: 115s yield 115s except Exception as exc: 115s mapped_exc = None 115s 115s for from_exc, to_exc in HTTPCORE_EXC_MAP.items(): 115s if not isinstance(exc, from_exc): 115s continue 115s # We want to map to the most specific exception we can find. 115s # Eg if `exc` is an `httpcore.ReadTimeout`, we want to map to 115s # `httpx.ReadTimeout`, not just `httpx.TimeoutException`. 115s if mapped_exc is None or issubclass(to_exc, mapped_exc): 115s mapped_exc = to_exc 115s 115s if mapped_exc is None: # pragma: no cover 115s raise 115s 115s message = str(exc) 115s > raise mapped_exc(message) from exc 115s E httpx.ProxyError: 503 Service Unavailable 115s 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:86: ProxyError 115s ___________________________ test_auto_refresh_token4 ___________________________ 115s 115s @contextlib.contextmanager 115s def map_httpcore_exceptions() -> typing.Iterator[None]: 115s try: 115s > yield 115s 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:69: 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:373: in handle_async_request 115s resp = await self._pool.handle_async_request(req) 115s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:216: in handle_async_request 115s raise exc from None 115s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:196: in handle_async_request 115s response = await connection.handle_async_request( 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s 115s self = 115s request = 115s 115s async def handle_async_request(self, request: Request) -> Response: 115s timeouts = request.extensions.get("timeout", {}) 115s timeout = timeouts.get("connect", None) 115s 115s async with self._connect_lock: 115s if not self._connected: 115s target = b"%b:%d" % (self._remote_origin.host, self._remote_origin.port) 115s 115s connect_url = URL( 115s scheme=self._proxy_origin.scheme, 115s host=self._proxy_origin.host, 115s port=self._proxy_origin.port, 115s target=target, 115s ) 115s connect_headers = merge_headers( 115s [(b"Host", target), (b"Accept", b"*/*")], self._proxy_headers 115s ) 115s connect_request = Request( 115s method=b"CONNECT", 115s url=connect_url, 115s headers=connect_headers, 115s extensions=request.extensions, 115s ) 115s connect_response = await self._connection.handle_async_request( 115s connect_request 115s ) 115s 115s if connect_response.status < 200 or connect_response.status > 299: 115s reason_bytes = connect_response.extensions.get("reason_phrase", b"") 115s reason_str = reason_bytes.decode("ascii", errors="ignore") 115s msg = "%d %s" % (connect_response.status, reason_str) 115s await self._connection.aclose() 115s > raise ProxyError(msg) 115s E httpcore.ProxyError: 503 Service Unavailable 115s 115s /usr/lib/python3/dist-packages/httpcore/_async/http_proxy.py:298: ProxyError 115s 115s The above exception was the direct cause of the following exception: 115s 115s @pytest.mark.asyncio 115s async def test_auto_refresh_token4(): 115s async def _update_token(token, refresh_token=None, access_token=None): 115s # This test only makes sense if the expired token is refreshed 115s token["expires_at"] = int(time.time()) + 3600 115s # artificial sleep to force other coroutines to wake 115s await asyncio.sleep(0.1) 115s 115s update_token = mock.Mock(side_effect=_update_token) 115s 115s old_token = dict( 115s access_token='old', 115s token_type='bearer', 115s expires_at=100 115s ) 115s 115s app = AsyncMockDispatch(default_token) 115s 115s async with AsyncOAuth2Client( 115s 'foo', token=old_token, token_endpoint='https://i.b/token', 115s update_token=update_token, grant_type='client_credentials', 115s app=app, 115s ) as client: 115s coroutines = [client.get('https://i.b/user') for x in range(10)] 115s > await asyncio.gather(*coroutines) 115s 115s tests/clients/test_httpx/test_async_oauth2_client.py:423: 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s /usr/lib/python3/dist-packages/httpx/_client.py:1801: in get 115s return await self.request( 115s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:86: in request 115s await self.ensure_active_token(self.token) 115s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:116: in ensure_active_token 115s new_token = await self.fetch_token(url, grant_type='client_credentials') 115s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:125: in _fetch_token 115s resp = await self.post( 115s /usr/lib/python3/dist-packages/httpx/_client.py:1892: in post 115s return await self.request( 115s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:90: in request 115s return await super().request( 115s /usr/lib/python3/dist-packages/httpx/_client.py:1574: in request 115s return await self.send(request, auth=auth, follow_redirects=follow_redirects) 115s /usr/lib/python3/dist-packages/httpx/_client.py:1661: in send 115s response = await self._send_handling_auth( 115s /usr/lib/python3/dist-packages/httpx/_client.py:1689: in _send_handling_auth 115s response = await self._send_handling_redirects( 115s /usr/lib/python3/dist-packages/httpx/_client.py:1726: in _send_handling_redirects 115s response = await self._send_single_request(request) 115s /usr/lib/python3/dist-packages/httpx/_client.py:1763: in _send_single_request 115s response = await transport.handle_async_request(request) 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:372: in handle_async_request 115s with map_httpcore_exceptions(): 115s /usr/lib/python3.12/contextlib.py:158: in __exit__ 115s self.gen.throw(value) 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s 115s @contextlib.contextmanager 115s def map_httpcore_exceptions() -> typing.Iterator[None]: 115s try: 115s yield 115s except Exception as exc: 115s mapped_exc = None 115s 115s for from_exc, to_exc in HTTPCORE_EXC_MAP.items(): 115s if not isinstance(exc, from_exc): 115s continue 115s # We want to map to the most specific exception we can find. 115s # Eg if `exc` is an `httpcore.ReadTimeout`, we want to map to 115s # `httpx.ReadTimeout`, not just `httpx.TimeoutException`. 115s if mapped_exc is None or issubclass(to_exc, mapped_exc): 115s mapped_exc = to_exc 115s 115s if mapped_exc is None: # pragma: no cover 115s raise 115s 115s message = str(exc) 115s > raise mapped_exc(message) from exc 115s E httpx.ProxyError: 503 Service Unavailable 115s 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:86: ProxyError 115s ______________________________ test_revoke_token _______________________________ 115s 115s @contextlib.contextmanager 115s def map_httpcore_exceptions() -> typing.Iterator[None]: 115s try: 115s > yield 115s 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:69: 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:373: in handle_async_request 115s resp = await self._pool.handle_async_request(req) 115s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:216: in handle_async_request 115s raise exc from None 115s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:196: in handle_async_request 115s response = await connection.handle_async_request( 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s 115s self = 115s request = 115s 115s async def handle_async_request(self, request: Request) -> Response: 115s timeouts = request.extensions.get("timeout", {}) 115s timeout = timeouts.get("connect", None) 115s 115s async with self._connect_lock: 115s if not self._connected: 115s target = b"%b:%d" % (self._remote_origin.host, self._remote_origin.port) 115s 115s connect_url = URL( 115s scheme=self._proxy_origin.scheme, 115s host=self._proxy_origin.host, 115s port=self._proxy_origin.port, 115s target=target, 115s ) 115s connect_headers = merge_headers( 115s [(b"Host", target), (b"Accept", b"*/*")], self._proxy_headers 115s ) 115s connect_request = Request( 115s method=b"CONNECT", 115s url=connect_url, 115s headers=connect_headers, 115s extensions=request.extensions, 115s ) 115s connect_response = await self._connection.handle_async_request( 115s connect_request 115s ) 115s 115s if connect_response.status < 200 or connect_response.status > 299: 115s reason_bytes = connect_response.extensions.get("reason_phrase", b"") 115s reason_str = reason_bytes.decode("ascii", errors="ignore") 115s msg = "%d %s" % (connect_response.status, reason_str) 115s await self._connection.aclose() 115s > raise ProxyError(msg) 115s E httpcore.ProxyError: 503 Service Unavailable 115s 115s /usr/lib/python3/dist-packages/httpcore/_async/http_proxy.py:298: ProxyError 115s 115s The above exception was the direct cause of the following exception: 115s 115s @pytest.mark.asyncio 115s async def test_revoke_token(): 115s answer = {'status': 'ok'} 115s app = AsyncMockDispatch(answer) 115s 115s async with AsyncOAuth2Client('a', app=app) as sess: 115s > resp = await sess.revoke_token('https://i.b/token', 'hi') 115s 115s tests/clients/test_httpx/test_async_oauth2_client.py:432: 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s /usr/lib/python3/dist-packages/httpx/_client.py:1892: in post 115s return await self.request( 115s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:90: in request 115s return await super().request( 115s /usr/lib/python3/dist-packages/httpx/_client.py:1574: in request 115s return await self.send(request, auth=auth, follow_redirects=follow_redirects) 115s /usr/lib/python3/dist-packages/httpx/_client.py:1661: in send 115s response = await self._send_handling_auth( 115s /usr/lib/python3/dist-packages/httpx/_client.py:1689: in _send_handling_auth 115s response = await self._send_handling_redirects( 115s /usr/lib/python3/dist-packages/httpx/_client.py:1726: in _send_handling_redirects 115s response = await self._send_single_request(request) 115s /usr/lib/python3/dist-packages/httpx/_client.py:1763: in _send_single_request 115s response = await transport.handle_async_request(request) 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:372: in handle_async_request 115s with map_httpcore_exceptions(): 115s /usr/lib/python3.12/contextlib.py:158: in __exit__ 115s self.gen.throw(value) 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s 115s @contextlib.contextmanager 115s def map_httpcore_exceptions() -> typing.Iterator[None]: 115s try: 115s yield 115s except Exception as exc: 115s mapped_exc = None 115s 115s for from_exc, to_exc in HTTPCORE_EXC_MAP.items(): 115s if not isinstance(exc, from_exc): 115s continue 115s # We want to map to the most specific exception we can find. 115s # Eg if `exc` is an `httpcore.ReadTimeout`, we want to map to 115s # `httpx.ReadTimeout`, not just `httpx.TimeoutException`. 115s if mapped_exc is None or issubclass(to_exc, mapped_exc): 115s mapped_exc = to_exc 115s 115s if mapped_exc is None: # pragma: no cover 115s raise 115s 115s message = str(exc) 115s > raise mapped_exc(message) from exc 115s E httpx.ProxyError: 503 Service Unavailable 115s 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:86: ProxyError 115s ____________________________ test_oauth1_authorize _____________________________ 115s 115s @contextlib.contextmanager 115s def map_httpcore_exceptions() -> typing.Iterator[None]: 115s try: 115s > yield 115s 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:69: 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:373: in handle_async_request 115s resp = await self._pool.handle_async_request(req) 115s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:216: in handle_async_request 115s raise exc from None 115s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:196: in handle_async_request 115s response = await connection.handle_async_request( 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s 115s self = 115s request = 115s 115s async def handle_async_request(self, request: Request) -> Response: 115s timeouts = request.extensions.get("timeout", {}) 115s timeout = timeouts.get("connect", None) 115s 115s async with self._connect_lock: 115s if not self._connected: 115s target = b"%b:%d" % (self._remote_origin.host, self._remote_origin.port) 115s 115s connect_url = URL( 115s scheme=self._proxy_origin.scheme, 115s host=self._proxy_origin.host, 115s port=self._proxy_origin.port, 115s target=target, 115s ) 115s connect_headers = merge_headers( 115s [(b"Host", target), (b"Accept", b"*/*")], self._proxy_headers 115s ) 115s connect_request = Request( 115s method=b"CONNECT", 115s url=connect_url, 115s headers=connect_headers, 115s extensions=request.extensions, 115s ) 115s connect_response = await self._connection.handle_async_request( 115s connect_request 115s ) 115s 115s if connect_response.status < 200 or connect_response.status > 299: 115s reason_bytes = connect_response.extensions.get("reason_phrase", b"") 115s reason_str = reason_bytes.decode("ascii", errors="ignore") 115s msg = "%d %s" % (connect_response.status, reason_str) 115s await self._connection.aclose() 115s > raise ProxyError(msg) 115s E httpcore.ProxyError: 503 Service Unavailable 115s 115s /usr/lib/python3/dist-packages/httpcore/_async/http_proxy.py:298: ProxyError 115s 115s The above exception was the direct cause of the following exception: 115s 115s @pytest.mark.asyncio 115s async def test_oauth1_authorize(): 115s oauth = OAuth() 115s app = AsyncPathMapDispatch({ 115s '/request-token': {'body': 'oauth_token=foo&oauth_verifier=baz'}, 115s '/token': {'body': 'oauth_token=a&oauth_token_secret=b'}, 115s }) 115s client = oauth.register( 115s 'dev', 115s client_id='dev', 115s client_secret='dev', 115s request_token_url='https://i.b/request-token', 115s api_base_url='https://i.b/api', 115s access_token_url='https://i.b/token', 115s authorize_url='https://i.b/authorize', 115s client_kwargs={ 115s 'app': app, 115s } 115s ) 115s 115s req_scope = {'type': 'http', 'session': {}} 115s req = Request(req_scope) 115s > resp = await client.authorize_redirect(req, 'https://b.com/bar') 115s 115s tests/clients/test_starlette/test_oauth_client.py:62: 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s /usr/lib/python3/dist-packages/authlib/integrations/starlette_client/apps.py:34: in authorize_redirect 115s rv = await self.create_authorization_url(redirect_uri, **kwargs) 115s /usr/lib/python3/dist-packages/authlib/integrations/base_client/async_app.py:38: in create_authorization_url 115s request_token = await client.fetch_request_token(self.request_token_url, **params) 115s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth1_client.py:68: in _fetch_token 115s resp = await self.post(url, **kwargs) 115s /usr/lib/python3/dist-packages/httpx/_client.py:1892: in post 115s return await self.request( 115s /usr/lib/python3/dist-packages/httpx/_client.py:1574: in request 115s return await self.send(request, auth=auth, follow_redirects=follow_redirects) 115s /usr/lib/python3/dist-packages/httpx/_client.py:1661: in send 115s response = await self._send_handling_auth( 115s /usr/lib/python3/dist-packages/httpx/_client.py:1689: in _send_handling_auth 115s response = await self._send_handling_redirects( 115s /usr/lib/python3/dist-packages/httpx/_client.py:1726: in _send_handling_redirects 115s response = await self._send_single_request(request) 115s /usr/lib/python3/dist-packages/httpx/_client.py:1763: in _send_single_request 115s response = await transport.handle_async_request(request) 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:372: in handle_async_request 115s with map_httpcore_exceptions(): 115s /usr/lib/python3.12/contextlib.py:158: in __exit__ 115s self.gen.throw(value) 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s 115s @contextlib.contextmanager 115s def map_httpcore_exceptions() -> typing.Iterator[None]: 115s try: 115s yield 115s except Exception as exc: 115s mapped_exc = None 115s 115s for from_exc, to_exc in HTTPCORE_EXC_MAP.items(): 115s if not isinstance(exc, from_exc): 115s continue 115s # We want to map to the most specific exception we can find. 115s # Eg if `exc` is an `httpcore.ReadTimeout`, we want to map to 115s # `httpx.ReadTimeout`, not just `httpx.TimeoutException`. 115s if mapped_exc is None or issubclass(to_exc, mapped_exc): 115s mapped_exc = to_exc 115s 115s if mapped_exc is None: # pragma: no cover 115s raise 115s 115s message = str(exc) 115s > raise mapped_exc(message) from exc 115s E httpx.ProxyError: 503 Service Unavailable 115s 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:86: ProxyError 115s ____________________________ test_oauth2_authorize _____________________________ 115s 115s @contextlib.contextmanager 115s def map_httpcore_exceptions() -> typing.Iterator[None]: 115s try: 115s > yield 115s 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:69: 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:373: in handle_async_request 115s resp = await self._pool.handle_async_request(req) 115s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:216: in handle_async_request 115s raise exc from None 115s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:196: in handle_async_request 115s response = await connection.handle_async_request( 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s 115s self = 115s request = 115s 115s async def handle_async_request(self, request: Request) -> Response: 115s timeouts = request.extensions.get("timeout", {}) 115s timeout = timeouts.get("connect", None) 115s 115s async with self._connect_lock: 115s if not self._connected: 115s target = b"%b:%d" % (self._remote_origin.host, self._remote_origin.port) 115s 115s connect_url = URL( 115s scheme=self._proxy_origin.scheme, 115s host=self._proxy_origin.host, 115s port=self._proxy_origin.port, 115s target=target, 115s ) 115s connect_headers = merge_headers( 115s [(b"Host", target), (b"Accept", b"*/*")], self._proxy_headers 115s ) 115s connect_request = Request( 115s method=b"CONNECT", 115s url=connect_url, 115s headers=connect_headers, 115s extensions=request.extensions, 115s ) 115s connect_response = await self._connection.handle_async_request( 115s connect_request 115s ) 115s 115s if connect_response.status < 200 or connect_response.status > 299: 115s reason_bytes = connect_response.extensions.get("reason_phrase", b"") 115s reason_str = reason_bytes.decode("ascii", errors="ignore") 115s msg = "%d %s" % (connect_response.status, reason_str) 115s await self._connection.aclose() 115s > raise ProxyError(msg) 115s E httpcore.ProxyError: 503 Service Unavailable 115s 115s /usr/lib/python3/dist-packages/httpcore/_async/http_proxy.py:298: ProxyError 115s 115s The above exception was the direct cause of the following exception: 115s 115s @pytest.mark.asyncio 115s async def test_oauth2_authorize(): 115s oauth = OAuth() 115s app = AsyncPathMapDispatch({ 115s '/token': {'body': get_bearer_token()} 115s }) 115s client = oauth.register( 115s 'dev', 115s client_id='dev', 115s client_secret='dev', 115s api_base_url='https://i.b/api', 115s access_token_url='https://i.b/token', 115s authorize_url='https://i.b/authorize', 115s client_kwargs={ 115s 'app': app, 115s } 115s ) 115s 115s req_scope = {'type': 'http', 'session': {}} 115s req = Request(req_scope) 115s resp = await client.authorize_redirect(req, 'https://b.com/bar') 115s assert resp.status_code == 302 115s url = resp.headers.get('Location') 115s assert 'state=' in url 115s state = dict(url_decode(urlparse.urlparse(url).query))['state'] 115s 115s assert f'_state_dev_{state}' in req.session 115s 115s req_scope.update( 115s { 115s 'path': '/', 115s 'query_string': f'code=a&state={state}', 115s 'session': req.session, 115s } 115s ) 115s req = Request(req_scope) 115s > token = await client.authorize_access_token(req) 115s 115s tests/clients/test_starlette/test_oauth_client.py:108: 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s /usr/lib/python3/dist-packages/authlib/integrations/starlette_client/apps.py:81: in authorize_access_token 115s token = await self.fetch_access_token(**params, **kwargs) 115s /usr/lib/python3/dist-packages/authlib/integrations/base_client/async_app.py:125: in fetch_access_token 115s token = await client.fetch_token(token_endpoint, **params) 115s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:125: in _fetch_token 115s resp = await self.post( 115s /usr/lib/python3/dist-packages/httpx/_client.py:1892: in post 115s return await self.request( 115s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:90: in request 115s return await super().request( 115s /usr/lib/python3/dist-packages/httpx/_client.py:1574: in request 115s return await self.send(request, auth=auth, follow_redirects=follow_redirects) 115s /usr/lib/python3/dist-packages/httpx/_client.py:1661: in send 115s response = await self._send_handling_auth( 115s /usr/lib/python3/dist-packages/httpx/_client.py:1689: in _send_handling_auth 115s response = await self._send_handling_redirects( 115s /usr/lib/python3/dist-packages/httpx/_client.py:1726: in _send_handling_redirects 115s response = await self._send_single_request(request) 115s /usr/lib/python3/dist-packages/httpx/_client.py:1763: in _send_single_request 115s response = await transport.handle_async_request(request) 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:372: in handle_async_request 115s with map_httpcore_exceptions(): 115s /usr/lib/python3.12/contextlib.py:158: in __exit__ 115s self.gen.throw(value) 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s 115s @contextlib.contextmanager 115s def map_httpcore_exceptions() -> typing.Iterator[None]: 115s try: 115s yield 115s except Exception as exc: 115s mapped_exc = None 115s 115s for from_exc, to_exc in HTTPCORE_EXC_MAP.items(): 115s if not isinstance(exc, from_exc): 115s continue 115s # We want to map to the most specific exception we can find. 115s # Eg if `exc` is an `httpcore.ReadTimeout`, we want to map to 115s # `httpx.ReadTimeout`, not just `httpx.TimeoutException`. 115s if mapped_exc is None or issubclass(to_exc, mapped_exc): 115s mapped_exc = to_exc 115s 115s if mapped_exc is None: # pragma: no cover 115s raise 115s 115s message = str(exc) 115s > raise mapped_exc(message) from exc 115s E httpx.ProxyError: 503 Service Unavailable 115s 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:86: ProxyError 115s _____________________ test_oauth2_authorize_code_challenge _____________________ 115s 115s @contextlib.contextmanager 115s def map_httpcore_exceptions() -> typing.Iterator[None]: 115s try: 115s > yield 115s 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:69: 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:373: in handle_async_request 115s resp = await self._pool.handle_async_request(req) 115s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:216: in handle_async_request 115s raise exc from None 115s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:196: in handle_async_request 115s response = await connection.handle_async_request( 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s 115s self = 115s request = 115s 115s async def handle_async_request(self, request: Request) -> Response: 115s timeouts = request.extensions.get("timeout", {}) 115s timeout = timeouts.get("connect", None) 115s 115s async with self._connect_lock: 115s if not self._connected: 115s target = b"%b:%d" % (self._remote_origin.host, self._remote_origin.port) 115s 115s connect_url = URL( 115s scheme=self._proxy_origin.scheme, 115s host=self._proxy_origin.host, 115s port=self._proxy_origin.port, 115s target=target, 115s ) 115s connect_headers = merge_headers( 115s [(b"Host", target), (b"Accept", b"*/*")], self._proxy_headers 115s ) 115s connect_request = Request( 115s method=b"CONNECT", 115s url=connect_url, 115s headers=connect_headers, 115s extensions=request.extensions, 115s ) 115s connect_response = await self._connection.handle_async_request( 115s connect_request 115s ) 115s 115s if connect_response.status < 200 or connect_response.status > 299: 115s reason_bytes = connect_response.extensions.get("reason_phrase", b"") 115s reason_str = reason_bytes.decode("ascii", errors="ignore") 115s msg = "%d %s" % (connect_response.status, reason_str) 115s await self._connection.aclose() 115s > raise ProxyError(msg) 115s E httpcore.ProxyError: 503 Service Unavailable 115s 115s /usr/lib/python3/dist-packages/httpcore/_async/http_proxy.py:298: ProxyError 115s 115s The above exception was the direct cause of the following exception: 115s 115s @pytest.mark.asyncio 115s async def test_oauth2_authorize_code_challenge(): 115s app = AsyncPathMapDispatch({ 115s '/token': {'body': get_bearer_token()} 115s }) 115s oauth = OAuth() 115s client = oauth.register( 115s 'dev', 115s client_id='dev', 115s api_base_url='https://i.b/api', 115s access_token_url='https://i.b/token', 115s authorize_url='https://i.b/authorize', 115s client_kwargs={ 115s 'code_challenge_method': 'S256', 115s 'app': app, 115s }, 115s ) 115s 115s req_scope = {'type': 'http', 'session': {}} 115s req = Request(req_scope) 115s 115s resp = await client.authorize_redirect(req, redirect_uri='https://b.com/bar') 115s assert resp.status_code == 302 115s 115s url = resp.headers.get('Location') 115s assert 'code_challenge=' in url 115s assert 'code_challenge_method=S256' in url 115s 115s state = dict(url_decode(urlparse.urlparse(url).query))['state'] 115s state_data = req.session[f'_state_dev_{state}']['data'] 115s 115s verifier = state_data['code_verifier'] 115s assert verifier is not None 115s 115s req_scope.update( 115s { 115s 'path': '/', 115s 'query_string': f'code=a&state={state}'.encode(), 115s 'session': req.session, 115s } 115s ) 115s req = Request(req_scope) 115s 115s > token = await client.authorize_access_token(req) 115s 115s tests/clients/test_starlette/test_oauth_client.py:183: 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s /usr/lib/python3/dist-packages/authlib/integrations/starlette_client/apps.py:81: in authorize_access_token 115s token = await self.fetch_access_token(**params, **kwargs) 115s /usr/lib/python3/dist-packages/authlib/integrations/base_client/async_app.py:125: in fetch_access_token 115s token = await client.fetch_token(token_endpoint, **params) 115s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:125: in _fetch_token 115s resp = await self.post( 115s /usr/lib/python3/dist-packages/httpx/_client.py:1892: in post 115s return await self.request( 115s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:90: in request 115s return await super().request( 115s /usr/lib/python3/dist-packages/httpx/_client.py:1574: in request 115s return await self.send(request, auth=auth, follow_redirects=follow_redirects) 115s /usr/lib/python3/dist-packages/httpx/_client.py:1661: in send 115s response = await self._send_handling_auth( 115s /usr/lib/python3/dist-packages/httpx/_client.py:1689: in _send_handling_auth 115s response = await self._send_handling_redirects( 115s /usr/lib/python3/dist-packages/httpx/_client.py:1726: in _send_handling_redirects 115s response = await self._send_single_request(request) 115s /usr/lib/python3/dist-packages/httpx/_client.py:1763: in _send_single_request 115s response = await transport.handle_async_request(request) 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:372: in handle_async_request 115s with map_httpcore_exceptions(): 115s /usr/lib/python3.12/contextlib.py:158: in __exit__ 115s self.gen.throw(value) 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s 115s @contextlib.contextmanager 115s def map_httpcore_exceptions() -> typing.Iterator[None]: 115s try: 115s yield 115s except Exception as exc: 115s mapped_exc = None 115s 115s for from_exc, to_exc in HTTPCORE_EXC_MAP.items(): 115s if not isinstance(exc, from_exc): 115s continue 115s # We want to map to the most specific exception we can find. 115s # Eg if `exc` is an `httpcore.ReadTimeout`, we want to map to 115s # `httpx.ReadTimeout`, not just `httpx.TimeoutException`. 115s if mapped_exc is None or issubclass(to_exc, mapped_exc): 115s mapped_exc = to_exc 115s 115s if mapped_exc is None: # pragma: no cover 115s raise 115s 115s message = str(exc) 115s > raise mapped_exc(message) from exc 115s E httpx.ProxyError: 503 Service Unavailable 115s 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:86: ProxyError 115s ______________________ test_with_fetch_token_in_register _______________________ 115s 115s @contextlib.contextmanager 115s def map_httpcore_exceptions() -> typing.Iterator[None]: 115s try: 115s > yield 115s 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:69: 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:373: in handle_async_request 115s resp = await self._pool.handle_async_request(req) 115s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:216: in handle_async_request 115s raise exc from None 115s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:196: in handle_async_request 115s response = await connection.handle_async_request( 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s 115s self = 115s request = 115s 115s async def handle_async_request(self, request: Request) -> Response: 115s timeouts = request.extensions.get("timeout", {}) 115s timeout = timeouts.get("connect", None) 115s 115s async with self._connect_lock: 115s if not self._connected: 115s target = b"%b:%d" % (self._remote_origin.host, self._remote_origin.port) 115s 115s connect_url = URL( 115s scheme=self._proxy_origin.scheme, 115s host=self._proxy_origin.host, 115s port=self._proxy_origin.port, 115s target=target, 115s ) 115s connect_headers = merge_headers( 115s [(b"Host", target), (b"Accept", b"*/*")], self._proxy_headers 115s ) 115s connect_request = Request( 115s method=b"CONNECT", 115s url=connect_url, 115s headers=connect_headers, 115s extensions=request.extensions, 115s ) 115s connect_response = await self._connection.handle_async_request( 115s connect_request 115s ) 115s 115s if connect_response.status < 200 or connect_response.status > 299: 115s reason_bytes = connect_response.extensions.get("reason_phrase", b"") 115s reason_str = reason_bytes.decode("ascii", errors="ignore") 115s msg = "%d %s" % (connect_response.status, reason_str) 115s await self._connection.aclose() 115s > raise ProxyError(msg) 115s E httpcore.ProxyError: 503 Service Unavailable 115s 115s /usr/lib/python3/dist-packages/httpcore/_async/http_proxy.py:298: ProxyError 115s 115s The above exception was the direct cause of the following exception: 115s 115s @pytest.mark.asyncio 115s async def test_with_fetch_token_in_register(): 115s async def fetch_token(request): 115s return {'access_token': 'dev', 'token_type': 'bearer'} 115s 115s app = AsyncPathMapDispatch({ 115s '/user': {'body': {'sub': '123'}} 115s }) 115s oauth = OAuth() 115s client = oauth.register( 115s 'dev', 115s client_id='dev', 115s client_secret='dev', 115s api_base_url='https://i.b/api', 115s access_token_url='https://i.b/token', 115s authorize_url='https://i.b/authorize', 115s fetch_token=fetch_token, 115s client_kwargs={ 115s 'app': app, 115s } 115s ) 115s 115s req_scope = {'type': 'http', 'session': {}} 115s req = Request(req_scope) 115s > resp = await client.get('/user', request=req) 115s 115s tests/clients/test_starlette/test_oauth_client.py:211: 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s /usr/lib/python3/dist-packages/authlib/integrations/base_client/async_app.py:86: in request 115s return await _http_request(self, session, method, url, token, kwargs) 115s /usr/lib/python3/dist-packages/authlib/integrations/base_client/async_app.py:144: in _http_request 115s return await session.request(method, url, **kwargs) 115s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:90: in request 115s return await super().request( 115s /usr/lib/python3/dist-packages/httpx/_client.py:1574: in request 115s return await self.send(request, auth=auth, follow_redirects=follow_redirects) 115s /usr/lib/python3/dist-packages/httpx/_client.py:1661: in send 115s response = await self._send_handling_auth( 115s /usr/lib/python3/dist-packages/httpx/_client.py:1689: in _send_handling_auth 115s response = await self._send_handling_redirects( 115s /usr/lib/python3/dist-packages/httpx/_client.py:1726: in _send_handling_redirects 115s response = await self._send_single_request(request) 115s /usr/lib/python3/dist-packages/httpx/_client.py:1763: in _send_single_request 115s response = await transport.handle_async_request(request) 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:372: in handle_async_request 115s with map_httpcore_exceptions(): 115s /usr/lib/python3.12/contextlib.py:158: in __exit__ 115s self.gen.throw(value) 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s 115s @contextlib.contextmanager 115s def map_httpcore_exceptions() -> typing.Iterator[None]: 115s try: 115s yield 115s except Exception as exc: 115s mapped_exc = None 115s 115s for from_exc, to_exc in HTTPCORE_EXC_MAP.items(): 115s if not isinstance(exc, from_exc): 115s continue 115s # We want to map to the most specific exception we can find. 115s # Eg if `exc` is an `httpcore.ReadTimeout`, we want to map to 115s # `httpx.ReadTimeout`, not just `httpx.TimeoutException`. 115s if mapped_exc is None or issubclass(to_exc, mapped_exc): 115s mapped_exc = to_exc 115s 115s if mapped_exc is None: # pragma: no cover 115s raise 115s 115s message = str(exc) 115s > raise mapped_exc(message) from exc 115s E httpx.ProxyError: 503 Service Unavailable 115s 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:86: ProxyError 115s ________________________ test_with_fetch_token_in_oauth ________________________ 115s 115s @contextlib.contextmanager 115s def map_httpcore_exceptions() -> typing.Iterator[None]: 115s try: 115s > yield 115s 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:69: 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:373: in handle_async_request 115s resp = await self._pool.handle_async_request(req) 115s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:216: in handle_async_request 115s raise exc from None 115s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:196: in handle_async_request 115s response = await connection.handle_async_request( 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s 115s self = 115s request = 115s 115s async def handle_async_request(self, request: Request) -> Response: 115s timeouts = request.extensions.get("timeout", {}) 115s timeout = timeouts.get("connect", None) 115s 115s async with self._connect_lock: 115s if not self._connected: 115s target = b"%b:%d" % (self._remote_origin.host, self._remote_origin.port) 115s 115s connect_url = URL( 115s scheme=self._proxy_origin.scheme, 115s host=self._proxy_origin.host, 115s port=self._proxy_origin.port, 115s target=target, 115s ) 115s connect_headers = merge_headers( 115s [(b"Host", target), (b"Accept", b"*/*")], self._proxy_headers 115s ) 115s connect_request = Request( 115s method=b"CONNECT", 115s url=connect_url, 115s headers=connect_headers, 115s extensions=request.extensions, 115s ) 115s connect_response = await self._connection.handle_async_request( 115s connect_request 115s ) 115s 115s if connect_response.status < 200 or connect_response.status > 299: 115s reason_bytes = connect_response.extensions.get("reason_phrase", b"") 115s reason_str = reason_bytes.decode("ascii", errors="ignore") 115s msg = "%d %s" % (connect_response.status, reason_str) 115s await self._connection.aclose() 115s > raise ProxyError(msg) 115s E httpcore.ProxyError: 503 Service Unavailable 115s 115s /usr/lib/python3/dist-packages/httpcore/_async/http_proxy.py:298: ProxyError 115s 115s The above exception was the direct cause of the following exception: 115s 115s @pytest.mark.asyncio 115s async def test_with_fetch_token_in_oauth(): 115s async def fetch_token(name, request): 115s return {'access_token': 'dev', 'token_type': 'bearer'} 115s 115s app = AsyncPathMapDispatch({ 115s '/user': {'body': {'sub': '123'}} 115s }) 115s oauth = OAuth(fetch_token=fetch_token) 115s client = oauth.register( 115s 'dev', 115s client_id='dev', 115s client_secret='dev', 115s api_base_url='https://i.b/api', 115s access_token_url='https://i.b/token', 115s authorize_url='https://i.b/authorize', 115s client_kwargs={ 115s 'app': app, 115s } 115s ) 115s 115s req_scope = {'type': 'http', 'session': {}} 115s req = Request(req_scope) 115s > resp = await client.get('/user', request=req) 115s 115s tests/clients/test_starlette/test_oauth_client.py:238: 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s /usr/lib/python3/dist-packages/authlib/integrations/base_client/async_app.py:86: in request 115s return await _http_request(self, session, method, url, token, kwargs) 115s /usr/lib/python3/dist-packages/authlib/integrations/base_client/async_app.py:144: in _http_request 115s return await session.request(method, url, **kwargs) 115s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:90: in request 115s return await super().request( 115s /usr/lib/python3/dist-packages/httpx/_client.py:1574: in request 115s return await self.send(request, auth=auth, follow_redirects=follow_redirects) 115s /usr/lib/python3/dist-packages/httpx/_client.py:1661: in send 115s response = await self._send_handling_auth( 115s /usr/lib/python3/dist-packages/httpx/_client.py:1689: in _send_handling_auth 115s response = await self._send_handling_redirects( 115s /usr/lib/python3/dist-packages/httpx/_client.py:1726: in _send_handling_redirects 115s response = await self._send_single_request(request) 115s /usr/lib/python3/dist-packages/httpx/_client.py:1763: in _send_single_request 115s response = await transport.handle_async_request(request) 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:372: in handle_async_request 115s with map_httpcore_exceptions(): 115s /usr/lib/python3.12/contextlib.py:158: in __exit__ 115s self.gen.throw(value) 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s 115s @contextlib.contextmanager 115s def map_httpcore_exceptions() -> typing.Iterator[None]: 115s try: 115s yield 115s except Exception as exc: 115s mapped_exc = None 115s 115s for from_exc, to_exc in HTTPCORE_EXC_MAP.items(): 115s if not isinstance(exc, from_exc): 115s continue 115s # We want to map to the most specific exception we can find. 115s # Eg if `exc` is an `httpcore.ReadTimeout`, we want to map to 115s # `httpx.ReadTimeout`, not just `httpx.TimeoutException`. 115s if mapped_exc is None or issubclass(to_exc, mapped_exc): 115s mapped_exc = to_exc 115s 115s if mapped_exc is None: # pragma: no cover 115s raise 115s 115s message = str(exc) 115s > raise mapped_exc(message) from exc 115s E httpx.ProxyError: 503 Service Unavailable 115s 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:86: ProxyError 115s _________________________ test_request_withhold_token __________________________ 115s 115s @contextlib.contextmanager 115s def map_httpcore_exceptions() -> typing.Iterator[None]: 115s try: 115s > yield 115s 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:69: 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:373: in handle_async_request 115s resp = await self._pool.handle_async_request(req) 115s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:216: in handle_async_request 115s raise exc from None 115s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:196: in handle_async_request 115s response = await connection.handle_async_request( 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s 115s self = 115s request = 115s 115s async def handle_async_request(self, request: Request) -> Response: 115s timeouts = request.extensions.get("timeout", {}) 115s timeout = timeouts.get("connect", None) 115s 115s async with self._connect_lock: 115s if not self._connected: 115s target = b"%b:%d" % (self._remote_origin.host, self._remote_origin.port) 115s 115s connect_url = URL( 115s scheme=self._proxy_origin.scheme, 115s host=self._proxy_origin.host, 115s port=self._proxy_origin.port, 115s target=target, 115s ) 115s connect_headers = merge_headers( 115s [(b"Host", target), (b"Accept", b"*/*")], self._proxy_headers 115s ) 115s connect_request = Request( 115s method=b"CONNECT", 115s url=connect_url, 115s headers=connect_headers, 115s extensions=request.extensions, 115s ) 115s connect_response = await self._connection.handle_async_request( 115s connect_request 115s ) 115s 115s if connect_response.status < 200 or connect_response.status > 299: 115s reason_bytes = connect_response.extensions.get("reason_phrase", b"") 115s reason_str = reason_bytes.decode("ascii", errors="ignore") 115s msg = "%d %s" % (connect_response.status, reason_str) 115s await self._connection.aclose() 115s > raise ProxyError(msg) 115s E httpcore.ProxyError: 503 Service Unavailable 115s 115s /usr/lib/python3/dist-packages/httpcore/_async/http_proxy.py:298: ProxyError 115s 115s The above exception was the direct cause of the following exception: 115s 115s @pytest.mark.asyncio 115s async def test_request_withhold_token(): 115s oauth = OAuth() 115s app = AsyncPathMapDispatch({ 115s '/user': {'body': {'sub': '123'}} 115s }) 115s client = oauth.register( 115s "dev", 115s client_id="dev", 115s client_secret="dev", 115s api_base_url="https://i.b/api", 115s access_token_url="https://i.b/token", 115s authorize_url="https://i.b/authorize", 115s client_kwargs={ 115s 'app': app, 115s } 115s ) 115s req_scope = {'type': 'http', 'session': {}} 115s req = Request(req_scope) 115s > resp = await client.get('/user', request=req, withhold_token=True) 115s 115s tests/clients/test_starlette/test_oauth_client.py:261: 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s /usr/lib/python3/dist-packages/authlib/integrations/base_client/async_app.py:86: in request 115s return await _http_request(self, session, method, url, token, kwargs) 115s /usr/lib/python3/dist-packages/authlib/integrations/base_client/async_app.py:136: in _http_request 115s return await session.request(method, url, **kwargs) 115s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:90: in request 115s return await super().request( 115s /usr/lib/python3/dist-packages/httpx/_client.py:1574: in request 115s return await self.send(request, auth=auth, follow_redirects=follow_redirects) 115s /usr/lib/python3/dist-packages/httpx/_client.py:1661: in send 115s response = await self._send_handling_auth( 115s /usr/lib/python3/dist-packages/httpx/_client.py:1689: in _send_handling_auth 115s response = await self._send_handling_redirects( 115s /usr/lib/python3/dist-packages/httpx/_client.py:1726: in _send_handling_redirects 115s response = await self._send_single_request(request) 115s /usr/lib/python3/dist-packages/httpx/_client.py:1763: in _send_single_request 115s response = await transport.handle_async_request(request) 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:372: in handle_async_request 115s with map_httpcore_exceptions(): 115s /usr/lib/python3.12/contextlib.py:158: in __exit__ 115s self.gen.throw(value) 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s 115s @contextlib.contextmanager 115s def map_httpcore_exceptions() -> typing.Iterator[None]: 115s try: 115s yield 115s except Exception as exc: 115s mapped_exc = None 115s 115s for from_exc, to_exc in HTTPCORE_EXC_MAP.items(): 115s if not isinstance(exc, from_exc): 115s continue 115s # We want to map to the most specific exception we can find. 115s # Eg if `exc` is an `httpcore.ReadTimeout`, we want to map to 115s # `httpx.ReadTimeout`, not just `httpx.TimeoutException`. 115s if mapped_exc is None or issubclass(to_exc, mapped_exc): 115s mapped_exc = to_exc 115s 115s if mapped_exc is None: # pragma: no cover 115s raise 115s 115s message = str(exc) 115s > raise mapped_exc(message) from exc 115s E httpx.ProxyError: 503 Service Unavailable 115s 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:86: ProxyError 115s _____________________ test_oauth2_authorize_with_metadata ______________________ 115s 115s @contextlib.contextmanager 115s def map_httpcore_exceptions() -> typing.Iterator[None]: 115s try: 115s > yield 115s 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:69: 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:373: in handle_async_request 115s resp = await self._pool.handle_async_request(req) 115s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:216: in handle_async_request 115s raise exc from None 115s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:196: in handle_async_request 115s response = await connection.handle_async_request( 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s 115s self = 115s request = 115s 115s async def handle_async_request(self, request: Request) -> Response: 115s timeouts = request.extensions.get("timeout", {}) 115s timeout = timeouts.get("connect", None) 115s 115s async with self._connect_lock: 115s if not self._connected: 115s target = b"%b:%d" % (self._remote_origin.host, self._remote_origin.port) 115s 115s connect_url = URL( 115s scheme=self._proxy_origin.scheme, 115s host=self._proxy_origin.host, 115s port=self._proxy_origin.port, 115s target=target, 115s ) 115s connect_headers = merge_headers( 115s [(b"Host", target), (b"Accept", b"*/*")], self._proxy_headers 115s ) 115s connect_request = Request( 115s method=b"CONNECT", 115s url=connect_url, 115s headers=connect_headers, 115s extensions=request.extensions, 115s ) 115s connect_response = await self._connection.handle_async_request( 115s connect_request 115s ) 115s 115s if connect_response.status < 200 or connect_response.status > 299: 115s reason_bytes = connect_response.extensions.get("reason_phrase", b"") 115s reason_str = reason_bytes.decode("ascii", errors="ignore") 115s msg = "%d %s" % (connect_response.status, reason_str) 115s await self._connection.aclose() 115s > raise ProxyError(msg) 115s E httpcore.ProxyError: 503 Service Unavailable 115s 115s /usr/lib/python3/dist-packages/httpcore/_async/http_proxy.py:298: ProxyError 115s 115s The above exception was the direct cause of the following exception: 115s 115s @pytest.mark.asyncio 115s async def test_oauth2_authorize_with_metadata(): 115s oauth = OAuth() 115s app = AsyncPathMapDispatch({ 115s '/.well-known/openid-configuration': {'body': { 115s 'authorization_endpoint': 'https://i.b/authorize' 115s }} 115s }) 115s client = oauth.register( 115s 'dev', 115s client_id='dev', 115s client_secret='dev', 115s api_base_url='https://i.b/api', 115s access_token_url='https://i.b/token', 115s server_metadata_url='https://i.b/.well-known/openid-configuration', 115s client_kwargs={ 115s 'app': app, 115s } 115s ) 115s req_scope = {'type': 'http', 'session': {}} 115s req = Request(req_scope) 115s > resp = await client.authorize_redirect(req, 'https://b.com/bar') 115s 115s tests/clients/test_starlette/test_oauth_client.py:302: 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s /usr/lib/python3/dist-packages/authlib/integrations/starlette_client/apps.py:34: in authorize_redirect 115s rv = await self.create_authorization_url(redirect_uri, **kwargs) 115s /usr/lib/python3/dist-packages/authlib/integrations/base_client/async_app.py:95: in create_authorization_url 115s metadata = await self.load_server_metadata() 115s /usr/lib/python3/dist-packages/authlib/integrations/base_client/async_app.py:76: in load_server_metadata 115s resp = await client.request('GET', self._server_metadata_url, withhold_token=True) 115s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:90: in request 115s return await super().request( 115s /usr/lib/python3/dist-packages/httpx/_client.py:1574: in request 115s return await self.send(request, auth=auth, follow_redirects=follow_redirects) 115s /usr/lib/python3/dist-packages/httpx/_client.py:1661: in send 115s response = await self._send_handling_auth( 115s /usr/lib/python3/dist-packages/httpx/_client.py:1689: in _send_handling_auth 115s response = await self._send_handling_redirects( 115s /usr/lib/python3/dist-packages/httpx/_client.py:1726: in _send_handling_redirects 115s response = await self._send_single_request(request) 115s /usr/lib/python3/dist-packages/httpx/_client.py:1763: in _send_single_request 115s response = await transport.handle_async_request(request) 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:372: in handle_async_request 115s with map_httpcore_exceptions(): 115s /usr/lib/python3.12/contextlib.py:158: in __exit__ 115s self.gen.throw(value) 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s 115s @contextlib.contextmanager 115s def map_httpcore_exceptions() -> typing.Iterator[None]: 115s try: 115s yield 115s except Exception as exc: 115s mapped_exc = None 115s 115s for from_exc, to_exc in HTTPCORE_EXC_MAP.items(): 115s if not isinstance(exc, from_exc): 115s continue 115s # We want to map to the most specific exception we can find. 115s # Eg if `exc` is an `httpcore.ReadTimeout`, we want to map to 115s # `httpx.ReadTimeout`, not just `httpx.TimeoutException`. 115s if mapped_exc is None or issubclass(to_exc, mapped_exc): 115s mapped_exc = to_exc 115s 115s if mapped_exc is None: # pragma: no cover 115s raise 115s 115s message = str(exc) 115s > raise mapped_exc(message) from exc 115s E httpx.ProxyError: 503 Service Unavailable 115s 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:86: ProxyError 115s _____________________________ test_fetch_userinfo ______________________________ 115s 115s @contextlib.contextmanager 115s def map_httpcore_exceptions() -> typing.Iterator[None]: 115s try: 115s > yield 115s 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:69: 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:373: in handle_async_request 115s resp = await self._pool.handle_async_request(req) 115s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:216: in handle_async_request 115s raise exc from None 115s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:196: in handle_async_request 115s response = await connection.handle_async_request( 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s 115s self = 115s request = 115s 115s async def handle_async_request(self, request: Request) -> Response: 115s timeouts = request.extensions.get("timeout", {}) 115s timeout = timeouts.get("connect", None) 115s 115s async with self._connect_lock: 115s if not self._connected: 115s target = b"%b:%d" % (self._remote_origin.host, self._remote_origin.port) 115s 115s connect_url = URL( 115s scheme=self._proxy_origin.scheme, 115s host=self._proxy_origin.host, 115s port=self._proxy_origin.port, 115s target=target, 115s ) 115s connect_headers = merge_headers( 115s [(b"Host", target), (b"Accept", b"*/*")], self._proxy_headers 115s ) 115s connect_request = Request( 115s method=b"CONNECT", 115s url=connect_url, 115s headers=connect_headers, 115s extensions=request.extensions, 115s ) 115s connect_response = await self._connection.handle_async_request( 115s connect_request 115s ) 115s 115s if connect_response.status < 200 or connect_response.status > 299: 115s reason_bytes = connect_response.extensions.get("reason_phrase", b"") 115s reason_str = reason_bytes.decode("ascii", errors="ignore") 115s msg = "%d %s" % (connect_response.status, reason_str) 115s await self._connection.aclose() 115s > raise ProxyError(msg) 115s E httpcore.ProxyError: 503 Service Unavailable 115s 115s /usr/lib/python3/dist-packages/httpcore/_async/http_proxy.py:298: ProxyError 115s 115s The above exception was the direct cause of the following exception: 115s 115s @pytest.mark.asyncio 115s async def test_fetch_userinfo(): 115s > await run_fetch_userinfo({'sub': '123'}) 115s 115s tests/clients/test_starlette/test_user_mixin.py:42: 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s tests/clients/test_starlette/test_user_mixin.py:36: in run_fetch_userinfo 115s user = await client.userinfo(request=req) 115s /usr/lib/python3/dist-packages/authlib/integrations/base_client/async_openid.py:29: in userinfo 115s resp = await self.get(metadata['userinfo_endpoint'], **kwargs) 115s /usr/lib/python3/dist-packages/authlib/integrations/base_client/async_app.py:86: in request 115s return await _http_request(self, session, method, url, token, kwargs) 115s /usr/lib/python3/dist-packages/authlib/integrations/base_client/async_app.py:144: in _http_request 115s return await session.request(method, url, **kwargs) 115s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:90: in request 115s return await super().request( 115s /usr/lib/python3/dist-packages/httpx/_client.py:1574: in request 115s return await self.send(request, auth=auth, follow_redirects=follow_redirects) 115s /usr/lib/python3/dist-packages/httpx/_client.py:1661: in send 115s response = await self._send_handling_auth( 115s /usr/lib/python3/dist-packages/httpx/_client.py:1689: in _send_handling_auth 115s response = await self._send_handling_redirects( 115s /usr/lib/python3/dist-packages/httpx/_client.py:1726: in _send_handling_redirects 115s response = await self._send_single_request(request) 115s /usr/lib/python3/dist-packages/httpx/_client.py:1763: in _send_single_request 115s response = await transport.handle_async_request(request) 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:372: in handle_async_request 115s with map_httpcore_exceptions(): 115s /usr/lib/python3.12/contextlib.py:158: in __exit__ 115s self.gen.throw(value) 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s 115s @contextlib.contextmanager 115s def map_httpcore_exceptions() -> typing.Iterator[None]: 115s try: 115s yield 115s except Exception as exc: 115s mapped_exc = None 115s 115s for from_exc, to_exc in HTTPCORE_EXC_MAP.items(): 115s if not isinstance(exc, from_exc): 115s continue 115s # We want to map to the most specific exception we can find. 115s # Eg if `exc` is an `httpcore.ReadTimeout`, we want to map to 115s # `httpx.ReadTimeout`, not just `httpx.TimeoutException`. 115s if mapped_exc is None or issubclass(to_exc, mapped_exc): 115s mapped_exc = to_exc 115s 115s if mapped_exc is None: # pragma: no cover 115s raise 115s 115s message = str(exc) 115s > raise mapped_exc(message) from exc 115s E httpx.ProxyError: 503 Service Unavailable 115s 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:86: ProxyError 115s __________________________ test_force_fetch_jwks_uri ___________________________ 115s 115s @contextlib.contextmanager 115s def map_httpcore_exceptions() -> typing.Iterator[None]: 115s try: 115s > yield 115s 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:69: 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:373: in handle_async_request 115s resp = await self._pool.handle_async_request(req) 115s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:216: in handle_async_request 115s raise exc from None 115s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:196: in handle_async_request 115s response = await connection.handle_async_request( 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s 115s self = 115s request = 115s 115s async def handle_async_request(self, request: Request) -> Response: 115s timeouts = request.extensions.get("timeout", {}) 115s timeout = timeouts.get("connect", None) 115s 115s async with self._connect_lock: 115s if not self._connected: 115s target = b"%b:%d" % (self._remote_origin.host, self._remote_origin.port) 115s 115s connect_url = URL( 115s scheme=self._proxy_origin.scheme, 115s host=self._proxy_origin.host, 115s port=self._proxy_origin.port, 115s target=target, 115s ) 115s connect_headers = merge_headers( 115s [(b"Host", target), (b"Accept", b"*/*")], self._proxy_headers 115s ) 115s connect_request = Request( 115s method=b"CONNECT", 115s url=connect_url, 115s headers=connect_headers, 115s extensions=request.extensions, 115s ) 115s connect_response = await self._connection.handle_async_request( 115s connect_request 115s ) 115s 115s if connect_response.status < 200 or connect_response.status > 299: 115s reason_bytes = connect_response.extensions.get("reason_phrase", b"") 115s reason_str = reason_bytes.decode("ascii", errors="ignore") 115s msg = "%d %s" % (connect_response.status, reason_str) 115s await self._connection.aclose() 115s > raise ProxyError(msg) 115s E httpcore.ProxyError: 503 Service Unavailable 115s 115s /usr/lib/python3/dist-packages/httpcore/_async/http_proxy.py:298: ProxyError 115s 115s The above exception was the direct cause of the following exception: 115s 115s @pytest.mark.asyncio 115s async def test_force_fetch_jwks_uri(): 115s secret_keys = read_key_file('jwks_private.json') 115s token = get_bearer_token() 115s id_token = generate_id_token( 115s token, {'sub': '123'}, secret_keys, 115s alg='RS256', iss='https://i.b', 115s aud='dev', exp=3600, nonce='n', 115s ) 115s token['id_token'] = id_token 115s 115s app = AsyncPathMapDispatch({ 115s '/jwks': {'body': read_key_file('jwks_public.json')} 115s }) 115s 115s oauth = OAuth() 115s client = oauth.register( 115s 'dev', 115s client_id='dev', 115s client_secret='dev', 115s fetch_token=get_bearer_token, 115s jwks_uri='https://i.b/jwks', 115s issuer='https://i.b', 115s client_kwargs={ 115s 'app': app, 115s } 115s ) 115s > user = await client.parse_id_token(token, nonce='n') 115s 115s tests/clients/test_starlette/test_user_mixin.py:129: 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s /usr/lib/python3/dist-packages/authlib/integrations/base_client/async_openid.py:56: in parse_id_token 115s jwk_set = await self.fetch_jwk_set() 115s /usr/lib/python3/dist-packages/authlib/integrations/base_client/async_openid.py:19: in fetch_jwk_set 115s resp = await client.request('GET', uri, withhold_token=True) 115s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:90: in request 115s return await super().request( 115s /usr/lib/python3/dist-packages/httpx/_client.py:1574: in request 115s return await self.send(request, auth=auth, follow_redirects=follow_redirects) 115s /usr/lib/python3/dist-packages/httpx/_client.py:1661: in send 115s response = await self._send_handling_auth( 115s /usr/lib/python3/dist-packages/httpx/_client.py:1689: in _send_handling_auth 115s response = await self._send_handling_redirects( 115s /usr/lib/python3/dist-packages/httpx/_client.py:1726: in _send_handling_redirects 115s response = await self._send_single_request(request) 115s /usr/lib/python3/dist-packages/httpx/_client.py:1763: in _send_single_request 115s response = await transport.handle_async_request(request) 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:372: in handle_async_request 115s with map_httpcore_exceptions(): 115s /usr/lib/python3.12/contextlib.py:158: in __exit__ 115s self.gen.throw(value) 115s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115s 115s @contextlib.contextmanager 115s def map_httpcore_exceptions() -> typing.Iterator[None]: 115s try: 115s yield 115s except Exception as exc: 115s mapped_exc = None 115s 115s for from_exc, to_exc in HTTPCORE_EXC_MAP.items(): 115s if not isinstance(exc, from_exc): 115s continue 115s # We want to map to the most specific exception we can find. 115s # Eg if `exc` is an `httpcore.ReadTimeout`, we want to map to 115s # `httpx.ReadTimeout`, not just `httpx.TimeoutException`. 115s if mapped_exc is None or issubclass(to_exc, mapped_exc): 115s mapped_exc = to_exc 115s 115s if mapped_exc is None: # pragma: no cover 115s raise 115s 115s message = str(exc) 115s > raise mapped_exc(message) from exc 115s E httpx.ProxyError: 503 Service Unavailable 115s 115s /usr/lib/python3/dist-packages/httpx/_transports/default.py:86: ProxyError 115s =============================== warnings summary =============================== 115s ../../../usr/lib/python3/dist-packages/httpx/_client.py:1426: 2 warnings 115s tests/clients/test_httpx/test_async_assertion_client.py: 2 warnings 115s tests/clients/test_httpx/test_async_oauth1_client.py: 7 warnings 115s tests/clients/test_httpx/test_async_oauth2_client.py: 19 warnings 115s tests/clients/test_starlette/test_oauth_client.py: 9 warnings 115s tests/clients/test_starlette/test_user_mixin.py: 2 warnings 115s /usr/lib/python3/dist-packages/httpx/_client.py:1426: DeprecationWarning: The 'app' shortcut is now deprecated. Use the explicit style 'transport=ASGITransport(app=...)' instead. 115s warnings.warn(message, DeprecationWarning) 115s 115s tests/clients/test_flask/test_oauth_client.py::FlaskOAuthTest::test_openid_authorize 115s /usr/lib/python3/dist-packages/authlib/jose/jwk.py:14: AuthlibDeprecationWarning: Please use ``JsonWebKey`` directly. 115s deprecate('Please use ``JsonWebKey`` directly.') 115s 115s tests/clients/test_httpx/test_assertion_client.py: 3 warnings 115s tests/clients/test_httpx/test_oauth1_client.py: 7 warnings 115s tests/clients/test_httpx/test_oauth2_client.py: 23 warnings 115s /usr/lib/python3/dist-packages/httpx/_client.py:680: DeprecationWarning: The 'app' shortcut is now deprecated. Use the explicit style 'transport=WSGITransport(app=...)' instead. 115s warnings.warn(message, DeprecationWarning) 115s 115s tests/clients/test_httpx/test_async_oauth2_client.py::test_httpx_client_stream_match[client0] 115s tests/clients/test_httpx/test_async_oauth2_client.py::test_httpx_client_stream_match[client1] 115s /usr/lib/python3/dist-packages/_pytest/python.py:183: PytestUnhandledCoroutineWarning: async def functions are not natively supported and have been skipped. 115s You need to install a suitable plugin for your async framework, for example: 115s - anyio 115s - pytest-asyncio 115s - pytest-tornasync 115s - pytest-trio 115s - pytest-twisted 115s warnings.warn(PytestUnhandledCoroutineWarning(msg.format(nodeid))) 115s 115s -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html 115s =========================== short test summary info ============================ 115s FAILED tests/clients/test_httpx/test_async_assertion_client.py::test_refresh_token 115s FAILED tests/clients/test_httpx/test_async_oauth1_client.py::test_fetch_request_token_via_header 115s FAILED tests/clients/test_httpx/test_async_oauth1_client.py::test_fetch_request_token_via_body 115s FAILED tests/clients/test_httpx/test_async_oauth1_client.py::test_fetch_request_token_via_query 115s FAILED tests/clients/test_httpx/test_async_oauth1_client.py::test_fetch_access_token 115s FAILED tests/clients/test_httpx/test_async_oauth1_client.py::test_get_via_header 115s FAILED tests/clients/test_httpx/test_async_oauth1_client.py::test_get_via_body 115s FAILED tests/clients/test_httpx/test_async_oauth1_client.py::test_get_via_query 115s FAILED tests/clients/test_httpx/test_async_oauth2_client.py::test_add_token_get_request[assert_token_in_header-header] 115s FAILED tests/clients/test_httpx/test_async_oauth2_client.py::test_add_token_get_request[assert_token_in_body-body] 115s FAILED tests/clients/test_httpx/test_async_oauth2_client.py::test_add_token_get_request[assert_token_in_uri-uri] 115s FAILED tests/clients/test_httpx/test_async_oauth2_client.py::test_add_token_to_streaming_request[assert_token_in_header-header] 115s FAILED tests/clients/test_httpx/test_async_oauth2_client.py::test_add_token_to_streaming_request[assert_token_in_body-body] 115s FAILED tests/clients/test_httpx/test_async_oauth2_client.py::test_add_token_to_streaming_request[assert_token_in_uri-uri] 115s FAILED tests/clients/test_httpx/test_async_oauth2_client.py::test_fetch_token_post 115s FAILED tests/clients/test_httpx/test_async_oauth2_client.py::test_fetch_token_get 115s FAILED tests/clients/test_httpx/test_async_oauth2_client.py::test_token_auth_method_client_secret_post 115s FAILED tests/clients/test_httpx/test_async_oauth2_client.py::test_access_token_response_hook 115s FAILED tests/clients/test_httpx/test_async_oauth2_client.py::test_password_grant_type 115s FAILED tests/clients/test_httpx/test_async_oauth2_client.py::test_client_credentials_type 115s FAILED tests/clients/test_httpx/test_async_oauth2_client.py::test_cleans_previous_token_before_fetching_new_one 115s FAILED tests/clients/test_httpx/test_async_oauth2_client.py::test_auto_refresh_token 115s FAILED tests/clients/test_httpx/test_async_oauth2_client.py::test_auto_refresh_token2 115s FAILED tests/clients/test_httpx/test_async_oauth2_client.py::test_auto_refresh_token3 115s FAILED tests/clients/test_httpx/test_async_oauth2_client.py::test_auto_refresh_token4 115s FAILED tests/clients/test_httpx/test_async_oauth2_client.py::test_revoke_token 115s FAILED tests/clients/test_starlette/test_oauth_client.py::test_oauth1_authorize 115s FAILED tests/clients/test_starlette/test_oauth_client.py::test_oauth2_authorize 115s FAILED tests/clients/test_starlette/test_oauth_client.py::test_oauth2_authorize_code_challenge 115s FAILED tests/clients/test_starlette/test_oauth_client.py::test_with_fetch_token_in_register 115s FAILED tests/clients/test_starlette/test_oauth_client.py::test_with_fetch_token_in_oauth 115s FAILED tests/clients/test_starlette/test_oauth_client.py::test_request_withhold_token 115s FAILED tests/clients/test_starlette/test_oauth_client.py::test_oauth2_authorize_with_metadata 115s FAILED tests/clients/test_starlette/test_user_mixin.py::test_fetch_userinfo 115s FAILED tests/clients/test_starlette/test_user_mixin.py::test_force_fetch_jwks_uri 115s =========== 35 failed, 130 passed, 2 skipped, 77 warnings in 17.28s ============ 115s autopkgtest [10:48:01]: test unittests3: -----------------------] 116s unittests3 FAIL non-zero exit status 1 116s autopkgtest [10:48:02]: test unittests3: - - - - - - - - - - results - - - - - - - - - - 116s autopkgtest [10:48:02]: @@@@@@@@@@@@@@@@@@@@ summary 116s unittests3 FAIL non-zero exit status 1 126s nova [W] Skipping flock for amd64 126s Creating nova instance adt-oracular-i386-python-authlib-20240616-102151-juju-7f2275-prod-proposed-migration-environment-2-eeb49c2b-8806-44ee-b3fc-f6ce9b0832b4 from image adt/ubuntu-oracular-amd64-server-20240615.img (UUID 94fd7b6f-4495-4684-bd31-1d1deeaa1788)...