I: pbuilder: network access will be disabled during build I: Current time: Fri Mar 13 21:54:51 -12 2026 I: pbuilder-time-stamp: 1773482091 I: Building the build Environment I: extracting base tarball [/var/cache/pbuilder/unstable-reproducible-base.tgz] I: copying local configuration W: --override-config is not set; not updating apt.conf Read the manpage for details. I: mounting /proc filesystem I: mounting /sys filesystem I: creating /{dev,run}/shm I: mounting /dev/pts filesystem I: redirecting /dev/ptmx to /dev/pts/ptmx I: policy-rc.d already exists I: using eatmydata during job I: Copying source file I: copying [python-aiowithings_3.0.3-2.dsc] I: copying [./python-aiowithings_3.0.3.orig.tar.xz] I: copying [./python-aiowithings_3.0.3-2.debian.tar.xz] I: Extracting source dpkg-source: warning: cannot verify inline signature for ./python-aiowithings_3.0.3-2.dsc: unsupported subcommand dpkg-source: info: extracting python-aiowithings in python-aiowithings-3.0.3 dpkg-source: info: unpacking python-aiowithings_3.0.3.orig.tar.xz dpkg-source: info: unpacking python-aiowithings_3.0.3-2.debian.tar.xz I: using fakeroot in build. I: Installing the build-deps I: user script /srv/workspace/pbuilder/37560/tmp/hooks/D02_print_environment starting I: set BUILDDIR='/build/reproducible-path' BUILDUSERGECOS='first user,first room,first work-phone,first home-phone,first other' BUILDUSERNAME='pbuilder1' BUILD_ARCH='i386' DEBIAN_FRONTEND='noninteractive' DEB_BUILD_OPTIONS='buildinfo=+all reproducible=+all parallel=22 ' DISTRIBUTION='unstable' HOME='/root' HOST_ARCH='i386' IFS=' ' INVOCATION_ID='059d4891420d4e27876191afd2168605' LANG='C' LANGUAGE='en_US:en' LC_ALL='C' LD_LIBRARY_PATH='/usr/lib/libeatmydata' LD_PRELOAD='libeatmydata.so' MAIL='/var/mail/root' OPTIND='1' PATH='/usr/sbin:/usr/bin:/sbin:/bin:/usr/games' PBCURRENTCOMMANDLINEOPERATION='build' PBUILDER_OPERATION='build' PBUILDER_PKGDATADIR='/usr/share/pbuilder' PBUILDER_PKGLIBDIR='/usr/lib/pbuilder' PBUILDER_SYSCONFDIR='/etc' PPID='37560' PS1='# ' PS2='> ' PS4='+ ' PWD='/' SHELL='/bin/bash' SHLVL='2' SUDO_COMMAND='/usr/bin/timeout -k 18.1h 18h /usr/bin/ionice -c 3 /usr/bin/nice /usr/sbin/pbuilder --build --configfile /srv/reproducible-results/rbuild-debian/r-b-build.VP5h9tVl/pbuilderrc_e4nN --distribution unstable --hookdir /etc/pbuilder/first-build-hooks --debbuildopts -b --basetgz /var/cache/pbuilder/unstable-reproducible-base.tgz --buildresult /srv/reproducible-results/rbuild-debian/r-b-build.VP5h9tVl/b1 --logfile b1/build.log python-aiowithings_3.0.3-2.dsc' SUDO_GID='112' SUDO_UID='107' SUDO_USER='jenkins' TERM='unknown' TZ='/usr/share/zoneinfo/Etc/GMT+12' USER='root' _='/usr/bin/systemd-run' http_proxy='http://213.165.73.152:3128' I: uname -a Linux ionos6-i386 6.1.0-30-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.124-1 (2025-01-12) x86_64 GNU/Linux I: ls -l /bin lrwxrwxrwx 1 root root 7 Nov 22 2024 /bin -> usr/bin I: user script /srv/workspace/pbuilder/37560/tmp/hooks/D02_print_environment finished -> Attempting to satisfy build-dependencies -> Creating pbuilder-satisfydepends-dummy package Package: pbuilder-satisfydepends-dummy Version: 0.invalid.0 Architecture: i386 Maintainer: Debian Pbuilder Team Description: Dummy package to satisfy dependencies with aptitude - created by pbuilder This package was created automatically by pbuilder to satisfy the build-dependencies of the package being currently built. Depends: debhelper-compat (= 11), dh-python, openstack-pkg-tools, pybuild-plugin-pyproject, python3-all, python3-poetry-core, python3-setuptools, python3-aiohttp, python3-aioresponses, python3-covdefaults, python3-pytest, python3-pytest-asyncio, python3-pytest-cov, python3-syrupy, python3-yarl dpkg-deb: building package 'pbuilder-satisfydepends-dummy' in '/tmp/satisfydepends-aptitude/pbuilder-satisfydepends-dummy.deb'. Selecting previously unselected package pbuilder-satisfydepends-dummy. (Reading database ... 19792 files and directories currently installed.) Preparing to unpack .../pbuilder-satisfydepends-dummy.deb ... Unpacking pbuilder-satisfydepends-dummy (0.invalid.0) ... dpkg: pbuilder-satisfydepends-dummy: dependency problems, but configuring anyway as you requested: pbuilder-satisfydepends-dummy depends on debhelper-compat (= 11); however: Package debhelper-compat is not installed. pbuilder-satisfydepends-dummy depends on dh-python; however: Package dh-python is not installed. pbuilder-satisfydepends-dummy depends on openstack-pkg-tools; however: Package openstack-pkg-tools is not installed. pbuilder-satisfydepends-dummy depends on pybuild-plugin-pyproject; however: Package pybuild-plugin-pyproject is not installed. pbuilder-satisfydepends-dummy depends on python3-all; however: Package python3-all is not installed. pbuilder-satisfydepends-dummy depends on python3-poetry-core; however: Package python3-poetry-core is not installed. pbuilder-satisfydepends-dummy depends on python3-setuptools; however: Package python3-setuptools is not installed. pbuilder-satisfydepends-dummy depends on python3-aiohttp; however: Package python3-aiohttp is not installed. pbuilder-satisfydepends-dummy depends on python3-aioresponses; however: Package python3-aioresponses is not installed. pbuilder-satisfydepends-dummy depends on python3-covdefaults; however: Package python3-covdefaults is not installed. pbuilder-satisfydepends-dummy depends on python3-pytest; however: Package python3-pytest is not installed. pbuilder-satisfydepends-dummy depends on python3-pytest-asyncio; however: Package python3-pytest-asyncio is not installed. pbuilder-satisfydepends-dummy depends on python3-pytest-cov; however: Package python3-pytest-cov is not installed. pbuilder-satisfydepends-dummy depends on python3-syrupy; however: Package python3-syrupy is not installed. pbuilder-satisfydepends-dummy depends on python3-yarl; however: Package python3-yarl is not installed. Setting up pbuilder-satisfydepends-dummy (0.invalid.0) ... Reading package lists... Building dependency tree... Reading state information... Initializing package states... Writing extended state information... Building tag database... pbuilder-satisfydepends-dummy is already installed at the requested version (0.invalid.0) pbuilder-satisfydepends-dummy is already installed at the requested version (0.invalid.0) The following NEW packages will be installed: autoconf{a} automake{a} autopoint{a} autotools-dev{a} bsdextrautils{a} ca-certificates{a} debhelper{a} dh-autoreconf{a} dh-python{a} dh-strip-nondeterminism{a} dwz{a} file{a} gettext{a} gettext-base{a} groff-base{a} intltool-debian{a} jq{a} libarchive-zip-perl{a} libcom-err2{a} libdebhelper-perl{a} libelf1t64{a} libexpat1{a} libffi8{a} libfile-stripnondeterminism-perl{a} libgssapi-krb5-2{a} libicu72{a} libjq1{a} libjs-jquery{a} libjs-jquery-hotkeys{a} libjs-jquery-isonscreen{a} libjs-jquery-metadata{a} libjs-jquery-tablesorter{a} libjs-jquery-throttle-debounce{a} libk5crypto3{a} libkeyutils1{a} libkrb5-3{a} libkrb5support0{a} libmagic-mgc{a} libmagic1t64{a} libnsl2{a} libonig5{a} libpipeline1{a} libpython3-stdlib{a} libpython3.12-minimal{a} libpython3.12-stdlib{a} libpython3.13-minimal{a} libpython3.13-stdlib{a} libreadline8t64{a} libtirpc-common{a} libtirpc3t64{a} libtool{a} libuchardet0{a} libunistring5{a} libxml2{a} m4{a} man-db{a} media-types{a} netbase{a} openssl{a} openstack-pkg-tools{a} po-debconf{a} pybuild-plugin-pyproject{a} python3{a} python3-aiohappyeyeballs{a} python3-aiohttp{a} python3-aioresponses{a} python3-aiosignal{a} python3-all{a} python3-async-generator{a} python3-async-timeout{a} python3-attr{a} python3-autocommand{a} python3-build{a} python3-covdefaults{a} python3-coverage{a} python3-frozenlist{a} python3-idna{a} python3-inflect{a} python3-iniconfig{a} python3-installer{a} python3-jaraco.context{a} python3-jaraco.functools{a} python3-jaraco.text{a} python3-minimal{a} python3-more-itertools{a} python3-multidict{a} python3-packaging{a} python3-pip{a} python3-pkg-resources{a} python3-pluggy{a} python3-poetry-core{a} python3-pyproject-hooks{a} python3-pytest{a} python3-pytest-asyncio{a} python3-pytest-cov{a} python3-setuptools{a} python3-syrupy{a} python3-toml{a} python3-typeguard{a} python3-typing-extensions{a} python3-wheel{a} python3-yarl{a} python3-zipp{a} python3.12{a} python3.12-minimal{a} python3.13{a} python3.13-minimal{a} readline-common{a} sensible-utils{a} tzdata{a} The following packages are RECOMMENDED but will NOT be installed: autopkgtest curl javascript-common krb5-locales libarchive-cpio-perl libjs-sphinxdoc libltdl-dev libmail-sendmail-perl lynx madison-lite pristine-tar python3-aiodns python3-dev python3-pygments wget 0 packages upgraded, 110 newly installed, 0 to remove and 0 not upgraded. Need to get 41.1 MB of archives. After unpacking 161 MB will be used. Writing extended state information... Get: 1 http://deb.debian.org/debian unstable/main i386 libpython3.13-minimal i386 3.13.2-1 [859 kB] Get: 2 http://deb.debian.org/debian unstable/main i386 libexpat1 i386 2.6.4-1 [107 kB] Get: 3 http://deb.debian.org/debian unstable/main i386 python3.13-minimal i386 3.13.2-1 [2266 kB] Get: 4 http://deb.debian.org/debian unstable/main i386 python3-minimal i386 3.13.1-2 [27.0 kB] Get: 5 http://deb.debian.org/debian unstable/main i386 media-types all 11.0.0 [27.6 kB] Get: 6 http://deb.debian.org/debian unstable/main i386 netbase all 6.4 [12.8 kB] Get: 7 http://deb.debian.org/debian unstable/main i386 tzdata all 2025a-2 [259 kB] Get: 8 http://deb.debian.org/debian unstable/main i386 libffi8 i386 3.4.6-1 [21.2 kB] Get: 9 http://deb.debian.org/debian unstable/main i386 readline-common all 8.2-6 [69.4 kB] Get: 10 http://deb.debian.org/debian unstable/main i386 libreadline8t64 i386 8.2-6 [173 kB] Get: 11 http://deb.debian.org/debian unstable/main i386 libpython3.13-stdlib i386 3.13.2-1 [1985 kB] Get: 12 http://deb.debian.org/debian unstable/main i386 python3.13 i386 3.13.2-1 [745 kB] Get: 13 http://deb.debian.org/debian unstable/main i386 libpython3-stdlib i386 3.13.1-2 [9952 B] Get: 14 http://deb.debian.org/debian unstable/main i386 python3 i386 3.13.1-2 [28.0 kB] Get: 15 http://deb.debian.org/debian unstable/main i386 libpython3.12-minimal i386 3.12.9-1 [816 kB] Get: 16 http://deb.debian.org/debian unstable/main i386 python3.12-minimal i386 3.12.9-1 [2238 kB] Get: 17 http://deb.debian.org/debian unstable/main i386 sensible-utils all 0.0.24 [24.8 kB] Get: 18 http://deb.debian.org/debian unstable/main i386 openssl i386 3.4.0-2 [1427 kB] Get: 19 http://deb.debian.org/debian unstable/main i386 ca-certificates all 20241223 [164 kB] Get: 20 http://deb.debian.org/debian unstable/main i386 libmagic-mgc i386 1:5.45-3+b1 [314 kB] Get: 21 http://deb.debian.org/debian unstable/main i386 libmagic1t64 i386 1:5.45-3+b1 [115 kB] Get: 22 http://deb.debian.org/debian unstable/main i386 file i386 1:5.45-3+b1 [43.2 kB] Get: 23 http://deb.debian.org/debian unstable/main i386 gettext-base i386 0.23.1-1 [245 kB] Get: 24 http://deb.debian.org/debian unstable/main i386 libuchardet0 i386 0.0.8-1+b2 [69.2 kB] Get: 25 http://deb.debian.org/debian unstable/main i386 groff-base i386 1.23.0-7 [1199 kB] Get: 26 http://deb.debian.org/debian unstable/main i386 bsdextrautils i386 2.40.4-3 [96.2 kB] Get: 27 http://deb.debian.org/debian unstable/main i386 libpipeline1 i386 1.5.8-1 [41.2 kB] Get: 28 http://deb.debian.org/debian unstable/main i386 man-db i386 2.13.0-1 [1428 kB] Get: 29 http://deb.debian.org/debian unstable/main i386 m4 i386 1.4.19-5 [301 kB] Get: 30 http://deb.debian.org/debian unstable/main i386 autoconf all 2.72-3 [493 kB] Get: 31 http://deb.debian.org/debian unstable/main i386 autotools-dev all 20220109.1 [51.6 kB] Get: 32 http://deb.debian.org/debian unstable/main i386 automake all 1:1.17-3 [862 kB] Get: 33 http://deb.debian.org/debian unstable/main i386 autopoint all 0.23.1-1 [770 kB] Get: 34 http://deb.debian.org/debian unstable/main i386 libdebhelper-perl all 13.24.1 [90.9 kB] Get: 35 http://deb.debian.org/debian unstable/main i386 libtool all 2.5.4-3 [539 kB] Get: 36 http://deb.debian.org/debian unstable/main i386 dh-autoreconf all 20 [17.1 kB] Get: 37 http://deb.debian.org/debian unstable/main i386 libarchive-zip-perl all 1.68-1 [104 kB] Get: 38 http://deb.debian.org/debian unstable/main i386 libfile-stripnondeterminism-perl all 1.14.1-1 [19.6 kB] Get: 39 http://deb.debian.org/debian unstable/main i386 dh-strip-nondeterminism all 1.14.1-1 [8584 B] Get: 40 http://deb.debian.org/debian unstable/main i386 libelf1t64 i386 0.192-4 [195 kB] Get: 41 http://deb.debian.org/debian unstable/main i386 dwz i386 0.15-1+b1 [116 kB] Get: 42 http://deb.debian.org/debian unstable/main i386 libunistring5 i386 1.3-1 [458 kB] Get: 43 http://deb.debian.org/debian unstable/main i386 libicu72 i386 72.1-6 [9582 kB] Get: 44 http://deb.debian.org/debian unstable/main i386 libxml2 i386 2.12.7+dfsg+really2.9.14-0.2+b1 [734 kB] Get: 45 http://deb.debian.org/debian unstable/main i386 gettext i386 0.23.1-1 [1714 kB] Get: 46 http://deb.debian.org/debian unstable/main i386 intltool-debian all 0.35.0+20060710.6 [22.9 kB] Get: 47 http://deb.debian.org/debian unstable/main i386 po-debconf all 1.0.21+nmu1 [248 kB] Get: 48 http://deb.debian.org/debian unstable/main i386 debhelper all 13.24.1 [920 kB] Get: 49 http://deb.debian.org/debian unstable/main i386 python3-autocommand all 2.2.2-3 [13.6 kB] Get: 50 http://deb.debian.org/debian unstable/main i386 python3-more-itertools all 10.6.0-1 [65.3 kB] Get: 51 http://deb.debian.org/debian unstable/main i386 python3-typing-extensions all 4.12.2-2 [73.0 kB] Get: 52 http://deb.debian.org/debian unstable/main i386 python3-typeguard all 4.4.1-1 [37.0 kB] Get: 53 http://deb.debian.org/debian unstable/main i386 python3-inflect all 7.3.1-2 [32.4 kB] Get: 54 http://deb.debian.org/debian unstable/main i386 python3-jaraco.context all 6.0.0-1 [7984 B] Get: 55 http://deb.debian.org/debian unstable/main i386 python3-jaraco.functools all 4.1.0-1 [12.0 kB] Get: 56 http://deb.debian.org/debian unstable/main i386 python3-pkg-resources all 75.6.0-1 [222 kB] Get: 57 http://deb.debian.org/debian unstable/main i386 python3-jaraco.text all 4.0.0-1 [11.4 kB] Get: 58 http://deb.debian.org/debian unstable/main i386 python3-zipp all 3.21.0-1 [10.6 kB] Get: 59 http://deb.debian.org/debian unstable/main i386 python3-setuptools all 75.6.0-1 [720 kB] Get: 60 http://deb.debian.org/debian unstable/main i386 dh-python all 6.20250108 [113 kB] Get: 61 http://deb.debian.org/debian unstable/main i386 libonig5 i386 6.9.9-1+b1 [195 kB] Get: 62 http://deb.debian.org/debian unstable/main i386 libjq1 i386 1.7.1-3+b1 [198 kB] Get: 63 http://deb.debian.org/debian unstable/main i386 jq i386 1.7.1-3+b1 [79.2 kB] Get: 64 http://deb.debian.org/debian unstable/main i386 libcom-err2 i386 1.47.2-1 [24.3 kB] Get: 65 http://deb.debian.org/debian unstable/main i386 libkrb5support0 i386 1.21.3-4 [35.0 kB] Get: 66 http://deb.debian.org/debian unstable/main i386 libk5crypto3 i386 1.21.3-4 [83.7 kB] Get: 67 http://deb.debian.org/debian unstable/main i386 libkeyutils1 i386 1.6.3-4 [9600 B] Get: 68 http://deb.debian.org/debian unstable/main i386 libkrb5-3 i386 1.21.3-4 [354 kB] Get: 69 http://deb.debian.org/debian unstable/main i386 libgssapi-krb5-2 i386 1.21.3-4 [149 kB] Get: 70 http://deb.debian.org/debian unstable/main i386 libjs-jquery all 3.6.1+dfsg+~3.5.14-1 [326 kB] Get: 71 http://deb.debian.org/debian unstable/main i386 libjs-jquery-hotkeys all 0.2.0-1 [12.6 kB] Get: 72 http://deb.debian.org/debian unstable/main i386 libjs-jquery-isonscreen all 1.2.0-1.1 [3196 B] Get: 73 http://deb.debian.org/debian unstable/main i386 libjs-jquery-metadata all 12-4 [6532 B] Get: 74 http://deb.debian.org/debian unstable/main i386 libjs-jquery-tablesorter all 1:2.31.3+dfsg1-4 [184 kB] Get: 75 http://deb.debian.org/debian unstable/main i386 libjs-jquery-throttle-debounce all 1.1+dfsg.1-2 [12.2 kB] Get: 76 http://deb.debian.org/debian unstable/main i386 libtirpc-common all 1.3.4+ds-1.3 [10.9 kB] Get: 77 http://deb.debian.org/debian unstable/main i386 libtirpc3t64 i386 1.3.4+ds-1.3+b1 [90.5 kB] Get: 78 http://deb.debian.org/debian unstable/main i386 libnsl2 i386 1.3.0-3+b3 [42.7 kB] Get: 79 http://deb.debian.org/debian unstable/main i386 libpython3.12-stdlib i386 3.12.9-1 [1972 kB] Get: 80 http://deb.debian.org/debian unstable/main i386 python3-wheel all 0.45.1-1 [56.7 kB] Get: 81 http://deb.debian.org/debian unstable/main i386 python3-pip all 25.0+dfsg-1 [1454 kB] Get: 82 http://deb.debian.org/debian unstable/main i386 openstack-pkg-tools all 132 [96.6 kB] Get: 83 http://deb.debian.org/debian unstable/main i386 python3-packaging all 24.2-1 [55.3 kB] Get: 84 http://deb.debian.org/debian unstable/main i386 python3-pyproject-hooks all 1.2.0-1 [11.7 kB] Get: 85 http://deb.debian.org/debian unstable/main i386 python3-toml all 0.10.2-1 [16.2 kB] Get: 86 http://deb.debian.org/debian unstable/main i386 python3-build all 1.2.2-1 [36.0 kB] Get: 87 http://deb.debian.org/debian unstable/main i386 python3-installer all 0.7.0+dfsg1-3 [18.6 kB] Get: 88 http://deb.debian.org/debian unstable/main i386 pybuild-plugin-pyproject all 6.20250108 [11.6 kB] Get: 89 http://deb.debian.org/debian unstable/main i386 python3-aiohappyeyeballs all 2.4.6-1 [13.5 kB] Get: 90 http://deb.debian.org/debian unstable/main i386 python3-idna all 3.10-1 [42.0 kB] Get: 91 http://deb.debian.org/debian unstable/main i386 python3-multidict i386 6.1.0-1+b1 [40.5 kB] Get: 92 http://deb.debian.org/debian unstable/main i386 python3-yarl i386 1.13.1-1+b1 [119 kB] Get: 93 http://deb.debian.org/debian unstable/main i386 python3-async-timeout all 5.0.1-1 [8324 B] Get: 94 http://deb.debian.org/debian unstable/main i386 python3-frozenlist i386 1.5.0-1+b1 [57.8 kB] Get: 95 http://deb.debian.org/debian unstable/main i386 python3-aiosignal all 1.3.2-1 [6100 B] Get: 96 http://deb.debian.org/debian unstable/main i386 python3-attr all 25.1.0-1 [68.7 kB] Get: 97 http://deb.debian.org/debian unstable/main i386 python3-aiohttp i386 3.10.11-1 [366 kB] Get: 98 http://deb.debian.org/debian unstable/main i386 python3-aioresponses all 0.7.6-2 [10.9 kB] Get: 99 http://deb.debian.org/debian unstable/main i386 python3.12 i386 3.12.9-1 [681 kB] Get: 100 http://deb.debian.org/debian unstable/main i386 python3-all i386 3.13.1-2 [1052 B] Get: 101 http://deb.debian.org/debian unstable/main i386 python3-async-generator all 1.10-4 [17.4 kB] Get: 102 http://deb.debian.org/debian unstable/main i386 python3-coverage i386 7.6.0+dfsg1-2+b1 [177 kB] Get: 103 http://deb.debian.org/debian unstable/main i386 python3-covdefaults all 2.3.0-2 [7692 B] Get: 104 http://deb.debian.org/debian unstable/main i386 python3-iniconfig all 1.1.1-2 [6396 B] Get: 105 http://deb.debian.org/debian unstable/main i386 python3-pluggy all 1.5.0-1 [26.9 kB] Get: 106 http://deb.debian.org/debian unstable/main i386 python3-poetry-core all 2.0.1-2 [225 kB] Get: 107 http://deb.debian.org/debian unstable/main i386 python3-pytest all 8.3.4-1 [250 kB] Get: 108 http://deb.debian.org/debian unstable/main i386 python3-pytest-asyncio all 0.25.1-1 [16.7 kB] Get: 109 http://deb.debian.org/debian unstable/main i386 python3-pytest-cov all 5.0.0-1 [26.8 kB] Get: 110 http://deb.debian.org/debian unstable/main i386 python3-syrupy all 4.8.1-1 [54.2 kB] Fetched 41.1 MB in 0s (116 MB/s) Preconfiguring packages ... Selecting previously unselected package libpython3.13-minimal:i386. (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 ... 19792 files and directories currently installed.) Preparing to unpack .../libpython3.13-minimal_3.13.2-1_i386.deb ... Unpacking libpython3.13-minimal:i386 (3.13.2-1) ... Selecting previously unselected package libexpat1:i386. Preparing to unpack .../libexpat1_2.6.4-1_i386.deb ... Unpacking libexpat1:i386 (2.6.4-1) ... Selecting previously unselected package python3.13-minimal. Preparing to unpack .../python3.13-minimal_3.13.2-1_i386.deb ... Unpacking python3.13-minimal (3.13.2-1) ... Setting up libpython3.13-minimal:i386 (3.13.2-1) ... Setting up libexpat1:i386 (2.6.4-1) ... Setting up python3.13-minimal (3.13.2-1) ... Selecting previously unselected package python3-minimal. (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 ... 20126 files and directories currently installed.) Preparing to unpack .../0-python3-minimal_3.13.1-2_i386.deb ... Unpacking python3-minimal (3.13.1-2) ... Selecting previously unselected package media-types. Preparing to unpack .../1-media-types_11.0.0_all.deb ... Unpacking media-types (11.0.0) ... Selecting previously unselected package netbase. Preparing to unpack .../2-netbase_6.4_all.deb ... Unpacking netbase (6.4) ... Selecting previously unselected package tzdata. Preparing to unpack .../3-tzdata_2025a-2_all.deb ... Unpacking tzdata (2025a-2) ... Selecting previously unselected package libffi8:i386. Preparing to unpack .../4-libffi8_3.4.6-1_i386.deb ... Unpacking libffi8:i386 (3.4.6-1) ... Selecting previously unselected package readline-common. Preparing to unpack .../5-readline-common_8.2-6_all.deb ... Unpacking readline-common (8.2-6) ... Selecting previously unselected package libreadline8t64:i386. Preparing to unpack .../6-libreadline8t64_8.2-6_i386.deb ... Adding 'diversion of /lib/i386-linux-gnu/libhistory.so.8 to /lib/i386-linux-gnu/libhistory.so.8.usr-is-merged by libreadline8t64' Adding 'diversion of /lib/i386-linux-gnu/libhistory.so.8.2 to /lib/i386-linux-gnu/libhistory.so.8.2.usr-is-merged by libreadline8t64' Adding 'diversion of /lib/i386-linux-gnu/libreadline.so.8 to /lib/i386-linux-gnu/libreadline.so.8.usr-is-merged by libreadline8t64' Adding 'diversion of /lib/i386-linux-gnu/libreadline.so.8.2 to /lib/i386-linux-gnu/libreadline.so.8.2.usr-is-merged by libreadline8t64' Unpacking libreadline8t64:i386 (8.2-6) ... Selecting previously unselected package libpython3.13-stdlib:i386. Preparing to unpack .../7-libpython3.13-stdlib_3.13.2-1_i386.deb ... Unpacking libpython3.13-stdlib:i386 (3.13.2-1) ... Selecting previously unselected package python3.13. Preparing to unpack .../8-python3.13_3.13.2-1_i386.deb ... Unpacking python3.13 (3.13.2-1) ... Selecting previously unselected package libpython3-stdlib:i386. Preparing to unpack .../9-libpython3-stdlib_3.13.1-2_i386.deb ... Unpacking libpython3-stdlib:i386 (3.13.1-2) ... Setting up python3-minimal (3.13.1-2) ... Selecting previously unselected package python3. (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 ... 21136 files and directories currently installed.) Preparing to unpack .../00-python3_3.13.1-2_i386.deb ... Unpacking python3 (3.13.1-2) ... Selecting previously unselected package libpython3.12-minimal:i386. Preparing to unpack .../01-libpython3.12-minimal_3.12.9-1_i386.deb ... Unpacking libpython3.12-minimal:i386 (3.12.9-1) ... Selecting previously unselected package python3.12-minimal. Preparing to unpack .../02-python3.12-minimal_3.12.9-1_i386.deb ... Unpacking python3.12-minimal (3.12.9-1) ... Selecting previously unselected package sensible-utils. Preparing to unpack .../03-sensible-utils_0.0.24_all.deb ... Unpacking sensible-utils (0.0.24) ... Selecting previously unselected package openssl. Preparing to unpack .../04-openssl_3.4.0-2_i386.deb ... Unpacking openssl (3.4.0-2) ... Selecting previously unselected package ca-certificates. Preparing to unpack .../05-ca-certificates_20241223_all.deb ... Unpacking ca-certificates (20241223) ... Selecting previously unselected package libmagic-mgc. Preparing to unpack .../06-libmagic-mgc_1%3a5.45-3+b1_i386.deb ... Unpacking libmagic-mgc (1:5.45-3+b1) ... Selecting previously unselected package libmagic1t64:i386. Preparing to unpack .../07-libmagic1t64_1%3a5.45-3+b1_i386.deb ... Unpacking libmagic1t64:i386 (1:5.45-3+b1) ... Selecting previously unselected package file. Preparing to unpack .../08-file_1%3a5.45-3+b1_i386.deb ... Unpacking file (1:5.45-3+b1) ... Selecting previously unselected package gettext-base. Preparing to unpack .../09-gettext-base_0.23.1-1_i386.deb ... Unpacking gettext-base (0.23.1-1) ... Selecting previously unselected package libuchardet0:i386. Preparing to unpack .../10-libuchardet0_0.0.8-1+b2_i386.deb ... Unpacking libuchardet0:i386 (0.0.8-1+b2) ... Selecting previously unselected package groff-base. Preparing to unpack .../11-groff-base_1.23.0-7_i386.deb ... Unpacking groff-base (1.23.0-7) ... Selecting previously unselected package bsdextrautils. Preparing to unpack .../12-bsdextrautils_2.40.4-3_i386.deb ... Unpacking bsdextrautils (2.40.4-3) ... Selecting previously unselected package libpipeline1:i386. Preparing to unpack .../13-libpipeline1_1.5.8-1_i386.deb ... Unpacking libpipeline1:i386 (1.5.8-1) ... Selecting previously unselected package man-db. Preparing to unpack .../14-man-db_2.13.0-1_i386.deb ... Unpacking man-db (2.13.0-1) ... Selecting previously unselected package m4. Preparing to unpack .../15-m4_1.4.19-5_i386.deb ... Unpacking m4 (1.4.19-5) ... Selecting previously unselected package autoconf. Preparing to unpack .../16-autoconf_2.72-3_all.deb ... Unpacking autoconf (2.72-3) ... Selecting previously unselected package autotools-dev. Preparing to unpack .../17-autotools-dev_20220109.1_all.deb ... Unpacking autotools-dev (20220109.1) ... Selecting previously unselected package automake. Preparing to unpack .../18-automake_1%3a1.17-3_all.deb ... Unpacking automake (1:1.17-3) ... Selecting previously unselected package autopoint. Preparing to unpack .../19-autopoint_0.23.1-1_all.deb ... Unpacking autopoint (0.23.1-1) ... Selecting previously unselected package libdebhelper-perl. Preparing to unpack .../20-libdebhelper-perl_13.24.1_all.deb ... Unpacking libdebhelper-perl (13.24.1) ... Selecting previously unselected package libtool. Preparing to unpack .../21-libtool_2.5.4-3_all.deb ... Unpacking libtool (2.5.4-3) ... Selecting previously unselected package dh-autoreconf. Preparing to unpack .../22-dh-autoreconf_20_all.deb ... Unpacking dh-autoreconf (20) ... Selecting previously unselected package libarchive-zip-perl. Preparing to unpack .../23-libarchive-zip-perl_1.68-1_all.deb ... Unpacking libarchive-zip-perl (1.68-1) ... Selecting previously unselected package libfile-stripnondeterminism-perl. Preparing to unpack .../24-libfile-stripnondeterminism-perl_1.14.1-1_all.deb ... Unpacking libfile-stripnondeterminism-perl (1.14.1-1) ... Selecting previously unselected package dh-strip-nondeterminism. Preparing to unpack .../25-dh-strip-nondeterminism_1.14.1-1_all.deb ... Unpacking dh-strip-nondeterminism (1.14.1-1) ... Selecting previously unselected package libelf1t64:i386. Preparing to unpack .../26-libelf1t64_0.192-4_i386.deb ... Unpacking libelf1t64:i386 (0.192-4) ... Selecting previously unselected package dwz. Preparing to unpack .../27-dwz_0.15-1+b1_i386.deb ... Unpacking dwz (0.15-1+b1) ... Selecting previously unselected package libunistring5:i386. Preparing to unpack .../28-libunistring5_1.3-1_i386.deb ... Unpacking libunistring5:i386 (1.3-1) ... Selecting previously unselected package libicu72:i386. Preparing to unpack .../29-libicu72_72.1-6_i386.deb ... Unpacking libicu72:i386 (72.1-6) ... Selecting previously unselected package libxml2:i386. Preparing to unpack .../30-libxml2_2.12.7+dfsg+really2.9.14-0.2+b1_i386.deb ... Unpacking libxml2:i386 (2.12.7+dfsg+really2.9.14-0.2+b1) ... Selecting previously unselected package gettext. Preparing to unpack .../31-gettext_0.23.1-1_i386.deb ... Unpacking gettext (0.23.1-1) ... Selecting previously unselected package intltool-debian. Preparing to unpack .../32-intltool-debian_0.35.0+20060710.6_all.deb ... Unpacking intltool-debian (0.35.0+20060710.6) ... Selecting previously unselected package po-debconf. Preparing to unpack .../33-po-debconf_1.0.21+nmu1_all.deb ... Unpacking po-debconf (1.0.21+nmu1) ... Selecting previously unselected package debhelper. Preparing to unpack .../34-debhelper_13.24.1_all.deb ... Unpacking debhelper (13.24.1) ... Selecting previously unselected package python3-autocommand. Preparing to unpack .../35-python3-autocommand_2.2.2-3_all.deb ... Unpacking python3-autocommand (2.2.2-3) ... Selecting previously unselected package python3-more-itertools. Preparing to unpack .../36-python3-more-itertools_10.6.0-1_all.deb ... Unpacking python3-more-itertools (10.6.0-1) ... Selecting previously unselected package python3-typing-extensions. Preparing to unpack .../37-python3-typing-extensions_4.12.2-2_all.deb ... Unpacking python3-typing-extensions (4.12.2-2) ... Selecting previously unselected package python3-typeguard. Preparing to unpack .../38-python3-typeguard_4.4.1-1_all.deb ... Unpacking python3-typeguard (4.4.1-1) ... Selecting previously unselected package python3-inflect. Preparing to unpack .../39-python3-inflect_7.3.1-2_all.deb ... Unpacking python3-inflect (7.3.1-2) ... Selecting previously unselected package python3-jaraco.context. Preparing to unpack .../40-python3-jaraco.context_6.0.0-1_all.deb ... Unpacking python3-jaraco.context (6.0.0-1) ... Selecting previously unselected package python3-jaraco.functools. Preparing to unpack .../41-python3-jaraco.functools_4.1.0-1_all.deb ... Unpacking python3-jaraco.functools (4.1.0-1) ... Selecting previously unselected package python3-pkg-resources. Preparing to unpack .../42-python3-pkg-resources_75.6.0-1_all.deb ... Unpacking python3-pkg-resources (75.6.0-1) ... Selecting previously unselected package python3-jaraco.text. Preparing to unpack .../43-python3-jaraco.text_4.0.0-1_all.deb ... Unpacking python3-jaraco.text (4.0.0-1) ... Selecting previously unselected package python3-zipp. Preparing to unpack .../44-python3-zipp_3.21.0-1_all.deb ... Unpacking python3-zipp (3.21.0-1) ... Selecting previously unselected package python3-setuptools. Preparing to unpack .../45-python3-setuptools_75.6.0-1_all.deb ... Unpacking python3-setuptools (75.6.0-1) ... Selecting previously unselected package dh-python. Preparing to unpack .../46-dh-python_6.20250108_all.deb ... Unpacking dh-python (6.20250108) ... Selecting previously unselected package libonig5:i386. Preparing to unpack .../47-libonig5_6.9.9-1+b1_i386.deb ... Unpacking libonig5:i386 (6.9.9-1+b1) ... Selecting previously unselected package libjq1:i386. Preparing to unpack .../48-libjq1_1.7.1-3+b1_i386.deb ... Unpacking libjq1:i386 (1.7.1-3+b1) ... Selecting previously unselected package jq. Preparing to unpack .../49-jq_1.7.1-3+b1_i386.deb ... Unpacking jq (1.7.1-3+b1) ... Selecting previously unselected package libcom-err2:i386. Preparing to unpack .../50-libcom-err2_1.47.2-1_i386.deb ... Unpacking libcom-err2:i386 (1.47.2-1) ... Selecting previously unselected package libkrb5support0:i386. Preparing to unpack .../51-libkrb5support0_1.21.3-4_i386.deb ... Unpacking libkrb5support0:i386 (1.21.3-4) ... Selecting previously unselected package libk5crypto3:i386. Preparing to unpack .../52-libk5crypto3_1.21.3-4_i386.deb ... Unpacking libk5crypto3:i386 (1.21.3-4) ... Selecting previously unselected package libkeyutils1:i386. Preparing to unpack .../53-libkeyutils1_1.6.3-4_i386.deb ... Unpacking libkeyutils1:i386 (1.6.3-4) ... Selecting previously unselected package libkrb5-3:i386. Preparing to unpack .../54-libkrb5-3_1.21.3-4_i386.deb ... Unpacking libkrb5-3:i386 (1.21.3-4) ... Selecting previously unselected package libgssapi-krb5-2:i386. Preparing to unpack .../55-libgssapi-krb5-2_1.21.3-4_i386.deb ... Unpacking libgssapi-krb5-2:i386 (1.21.3-4) ... Selecting previously unselected package libjs-jquery. Preparing to unpack .../56-libjs-jquery_3.6.1+dfsg+~3.5.14-1_all.deb ... Unpacking libjs-jquery (3.6.1+dfsg+~3.5.14-1) ... Selecting previously unselected package libjs-jquery-hotkeys. Preparing to unpack .../57-libjs-jquery-hotkeys_0.2.0-1_all.deb ... Unpacking libjs-jquery-hotkeys (0.2.0-1) ... Selecting previously unselected package libjs-jquery-isonscreen. Preparing to unpack .../58-libjs-jquery-isonscreen_1.2.0-1.1_all.deb ... Unpacking libjs-jquery-isonscreen (1.2.0-1.1) ... Selecting previously unselected package libjs-jquery-metadata. Preparing to unpack .../59-libjs-jquery-metadata_12-4_all.deb ... Unpacking libjs-jquery-metadata (12-4) ... Selecting previously unselected package libjs-jquery-tablesorter. Preparing to unpack .../60-libjs-jquery-tablesorter_1%3a2.31.3+dfsg1-4_all.deb ... Unpacking libjs-jquery-tablesorter (1:2.31.3+dfsg1-4) ... Selecting previously unselected package libjs-jquery-throttle-debounce. Preparing to unpack .../61-libjs-jquery-throttle-debounce_1.1+dfsg.1-2_all.deb ... Unpacking libjs-jquery-throttle-debounce (1.1+dfsg.1-2) ... Selecting previously unselected package libtirpc-common. Preparing to unpack .../62-libtirpc-common_1.3.4+ds-1.3_all.deb ... Unpacking libtirpc-common (1.3.4+ds-1.3) ... Selecting previously unselected package libtirpc3t64:i386. Preparing to unpack .../63-libtirpc3t64_1.3.4+ds-1.3+b1_i386.deb ... Adding 'diversion of /lib/i386-linux-gnu/libtirpc.so.3 to /lib/i386-linux-gnu/libtirpc.so.3.usr-is-merged by libtirpc3t64' Adding 'diversion of /lib/i386-linux-gnu/libtirpc.so.3.0.0 to /lib/i386-linux-gnu/libtirpc.so.3.0.0.usr-is-merged by libtirpc3t64' Unpacking libtirpc3t64:i386 (1.3.4+ds-1.3+b1) ... Selecting previously unselected package libnsl2:i386. Preparing to unpack .../64-libnsl2_1.3.0-3+b3_i386.deb ... Unpacking libnsl2:i386 (1.3.0-3+b3) ... Selecting previously unselected package libpython3.12-stdlib:i386. Preparing to unpack .../65-libpython3.12-stdlib_3.12.9-1_i386.deb ... Unpacking libpython3.12-stdlib:i386 (3.12.9-1) ... Selecting previously unselected package python3-wheel. Preparing to unpack .../66-python3-wheel_0.45.1-1_all.deb ... Unpacking python3-wheel (0.45.1-1) ... Selecting previously unselected package python3-pip. Preparing to unpack .../67-python3-pip_25.0+dfsg-1_all.deb ... Unpacking python3-pip (25.0+dfsg-1) ... Selecting previously unselected package openstack-pkg-tools. Preparing to unpack .../68-openstack-pkg-tools_132_all.deb ... Unpacking openstack-pkg-tools (132) ... Selecting previously unselected package python3-packaging. Preparing to unpack .../69-python3-packaging_24.2-1_all.deb ... Unpacking python3-packaging (24.2-1) ... Selecting previously unselected package python3-pyproject-hooks. Preparing to unpack .../70-python3-pyproject-hooks_1.2.0-1_all.deb ... Unpacking python3-pyproject-hooks (1.2.0-1) ... Selecting previously unselected package python3-toml. Preparing to unpack .../71-python3-toml_0.10.2-1_all.deb ... Unpacking python3-toml (0.10.2-1) ... Selecting previously unselected package python3-build. Preparing to unpack .../72-python3-build_1.2.2-1_all.deb ... Unpacking python3-build (1.2.2-1) ... Selecting previously unselected package python3-installer. Preparing to unpack .../73-python3-installer_0.7.0+dfsg1-3_all.deb ... Unpacking python3-installer (0.7.0+dfsg1-3) ... Selecting previously unselected package pybuild-plugin-pyproject. Preparing to unpack .../74-pybuild-plugin-pyproject_6.20250108_all.deb ... Unpacking pybuild-plugin-pyproject (6.20250108) ... Selecting previously unselected package python3-aiohappyeyeballs. Preparing to unpack .../75-python3-aiohappyeyeballs_2.4.6-1_all.deb ... Unpacking python3-aiohappyeyeballs (2.4.6-1) ... Selecting previously unselected package python3-idna. Preparing to unpack .../76-python3-idna_3.10-1_all.deb ... Unpacking python3-idna (3.10-1) ... Selecting previously unselected package python3-multidict. Preparing to unpack .../77-python3-multidict_6.1.0-1+b1_i386.deb ... Unpacking python3-multidict (6.1.0-1+b1) ... Selecting previously unselected package python3-yarl. Preparing to unpack .../78-python3-yarl_1.13.1-1+b1_i386.deb ... Unpacking python3-yarl (1.13.1-1+b1) ... Selecting previously unselected package python3-async-timeout. Preparing to unpack .../79-python3-async-timeout_5.0.1-1_all.deb ... Unpacking python3-async-timeout (5.0.1-1) ... Selecting previously unselected package python3-frozenlist. Preparing to unpack .../80-python3-frozenlist_1.5.0-1+b1_i386.deb ... Unpacking python3-frozenlist (1.5.0-1+b1) ... Selecting previously unselected package python3-aiosignal. Preparing to unpack .../81-python3-aiosignal_1.3.2-1_all.deb ... Unpacking python3-aiosignal (1.3.2-1) ... Selecting previously unselected package python3-attr. Preparing to unpack .../82-python3-attr_25.1.0-1_all.deb ... Unpacking python3-attr (25.1.0-1) ... Selecting previously unselected package python3-aiohttp. Preparing to unpack .../83-python3-aiohttp_3.10.11-1_i386.deb ... Unpacking python3-aiohttp (3.10.11-1) ... Selecting previously unselected package python3-aioresponses. Preparing to unpack .../84-python3-aioresponses_0.7.6-2_all.deb ... Unpacking python3-aioresponses (0.7.6-2) ... Selecting previously unselected package python3.12. Preparing to unpack .../85-python3.12_3.12.9-1_i386.deb ... Unpacking python3.12 (3.12.9-1) ... Selecting previously unselected package python3-all. Preparing to unpack .../86-python3-all_3.13.1-2_i386.deb ... Unpacking python3-all (3.13.1-2) ... Selecting previously unselected package python3-async-generator. Preparing to unpack .../87-python3-async-generator_1.10-4_all.deb ... Unpacking python3-async-generator (1.10-4) ... Selecting previously unselected package python3-coverage. Preparing to unpack .../88-python3-coverage_7.6.0+dfsg1-2+b1_i386.deb ... Unpacking python3-coverage (7.6.0+dfsg1-2+b1) ... Selecting previously unselected package python3-covdefaults. Preparing to unpack .../89-python3-covdefaults_2.3.0-2_all.deb ... Unpacking python3-covdefaults (2.3.0-2) ... Selecting previously unselected package python3-iniconfig. Preparing to unpack .../90-python3-iniconfig_1.1.1-2_all.deb ... Unpacking python3-iniconfig (1.1.1-2) ... Selecting previously unselected package python3-pluggy. Preparing to unpack .../91-python3-pluggy_1.5.0-1_all.deb ... Unpacking python3-pluggy (1.5.0-1) ... Selecting previously unselected package python3-poetry-core. Preparing to unpack .../92-python3-poetry-core_2.0.1-2_all.deb ... Unpacking python3-poetry-core (2.0.1-2) ... Selecting previously unselected package python3-pytest. Preparing to unpack .../93-python3-pytest_8.3.4-1_all.deb ... Unpacking python3-pytest (8.3.4-1) ... Selecting previously unselected package python3-pytest-asyncio. Preparing to unpack .../94-python3-pytest-asyncio_0.25.1-1_all.deb ... Unpacking python3-pytest-asyncio (0.25.1-1) ... Selecting previously unselected package python3-pytest-cov. Preparing to unpack .../95-python3-pytest-cov_5.0.0-1_all.deb ... Unpacking python3-pytest-cov (5.0.0-1) ... Selecting previously unselected package python3-syrupy. Preparing to unpack .../96-python3-syrupy_4.8.1-1_all.deb ... Unpacking python3-syrupy (4.8.1-1) ... Setting up media-types (11.0.0) ... Setting up libpipeline1:i386 (1.5.8-1) ... Setting up libkeyutils1:i386 (1.6.3-4) ... Setting up libicu72:i386 (72.1-6) ... Setting up bsdextrautils (2.40.4-3) ... Setting up libmagic-mgc (1:5.45-3+b1) ... Setting up libarchive-zip-perl (1.68-1) ... Setting up libtirpc-common (1.3.4+ds-1.3) ... Setting up libdebhelper-perl (13.24.1) ... Setting up libmagic1t64:i386 (1:5.45-3+b1) ... Setting up libpython3.12-minimal:i386 (3.12.9-1) ... Setting up gettext-base (0.23.1-1) ... Setting up m4 (1.4.19-5) ... Setting up libcom-err2:i386 (1.47.2-1) ... Setting up file (1:5.45-3+b1) ... Setting up libjs-jquery-throttle-debounce (1.1+dfsg.1-2) ... Setting up libelf1t64:i386 (0.192-4) ... Setting up libkrb5support0:i386 (1.21.3-4) ... Setting up tzdata (2025a-2) ... Current default time zone: 'Etc/UTC' Local time is now: Sat Mar 14 09:55:11 UTC 2026. Universal Time is now: Sat Mar 14 09:55:11 UTC 2026. Run 'dpkg-reconfigure tzdata' if you wish to change it. Setting up autotools-dev (20220109.1) ... Setting up libunistring5:i386 (1.3-1) ... Setting up autopoint (0.23.1-1) ... Setting up libk5crypto3:i386 (1.21.3-4) ... Setting up autoconf (2.72-3) ... Setting up libffi8:i386 (3.4.6-1) ... Setting up dwz (0.15-1+b1) ... Setting up sensible-utils (0.0.24) ... Setting up libuchardet0:i386 (0.0.8-1+b2) ... Setting up netbase (6.4) ... Setting up libkrb5-3:i386 (1.21.3-4) ... Setting up libjs-jquery (3.6.1+dfsg+~3.5.14-1) ... Setting up libjs-jquery-hotkeys (0.2.0-1) ... Setting up openssl (3.4.0-2) ... Setting up readline-common (8.2-6) ... Setting up libxml2:i386 (2.12.7+dfsg+really2.9.14-0.2+b1) ... Setting up libonig5:i386 (6.9.9-1+b1) ... Setting up automake (1:1.17-3) ... update-alternatives: using /usr/bin/automake-1.17 to provide /usr/bin/automake (automake) in auto mode Setting up libfile-stripnondeterminism-perl (1.14.1-1) ... Setting up python3.12-minimal (3.12.9-1) ... Setting up gettext (0.23.1-1) ... Setting up libtool (2.5.4-3) ... Setting up libjq1:i386 (1.7.1-3+b1) ... Setting up intltool-debian (0.35.0+20060710.6) ... Setting up dh-autoreconf (20) ... Setting up ca-certificates (20241223) ... Updating certificates in /etc/ssl/certs... 152 added, 0 removed; done. Setting up libjs-jquery-metadata (12-4) ... Setting up libjs-jquery-isonscreen (1.2.0-1.1) ... Setting up libgssapi-krb5-2:i386 (1.21.3-4) ... Setting up libreadline8t64:i386 (8.2-6) ... Setting up dh-strip-nondeterminism (1.14.1-1) ... Setting up libjs-jquery-tablesorter (1:2.31.3+dfsg1-4) ... Setting up groff-base (1.23.0-7) ... Setting up jq (1.7.1-3+b1) ... Setting up libpython3.13-stdlib:i386 (3.13.2-1) ... Setting up libpython3-stdlib:i386 (3.13.1-2) ... Setting up libtirpc3t64:i386 (1.3.4+ds-1.3+b1) ... Setting up python3.13 (3.13.2-1) ... Setting up po-debconf (1.0.21+nmu1) ... Setting up python3 (3.13.1-2) ... Setting up python3-zipp (3.21.0-1) ... Setting up python3-autocommand (2.2.2-3) ... Setting up man-db (2.13.0-1) ... Not building database; man-db/auto-update is not 'true'. Setting up python3-wheel (0.45.1-1) ... Setting up python3-multidict (6.1.0-1+b1) ... Setting up python3-frozenlist (1.5.0-1+b1) ... Setting up python3-aiosignal (1.3.2-1) ... Setting up python3-async-timeout (5.0.1-1) ... Setting up python3-packaging (24.2-1) ... Setting up python3-pyproject-hooks (1.2.0-1) ... Setting up python3-poetry-core (2.0.1-2) ... Setting up python3-idna (3.10-1) ... Setting up python3-typing-extensions (4.12.2-2) ... Setting up python3-aiohappyeyeballs (2.4.6-1) ... Setting up python3-pip (25.0+dfsg-1) ... Setting up python3-toml (0.10.2-1) ... Setting up python3-installer (0.7.0+dfsg1-3) ... Setting up python3-pluggy (1.5.0-1) ... Setting up libnsl2:i386 (1.3.0-3+b3) ... Setting up python3-build (1.2.2-1) ... Setting up python3-yarl (1.13.1-1+b1) ... Setting up python3-more-itertools (10.6.0-1) ... Setting up python3-iniconfig (1.1.1-2) ... Setting up python3-attr (25.1.0-1) ... Setting up python3-jaraco.functools (4.1.0-1) ... Setting up libpython3.12-stdlib:i386 (3.12.9-1) ... Setting up python3-async-generator (1.10-4) ... Setting up python3-jaraco.context (6.0.0-1) ... Setting up python3-pytest (8.3.4-1) ... Setting up python3-syrupy (4.8.1-1) ... Setting up python3.12 (3.12.9-1) ... Setting up python3-typeguard (4.4.1-1) ... Setting up python3-aiohttp (3.10.11-1) ... Setting up python3-all (3.13.1-2) ... Setting up python3-coverage (7.6.0+dfsg1-2+b1) ... Setting up debhelper (13.24.1) ... Setting up python3-pytest-cov (5.0.0-1) ... Setting up openstack-pkg-tools (132) ... Setting up python3-inflect (7.3.1-2) ... Setting up python3-jaraco.text (4.0.0-1) ... Setting up python3-pytest-asyncio (0.25.1-1) ... Setting up python3-pkg-resources (75.6.0-1) ... Setting up python3-aioresponses (0.7.6-2) ... Setting up python3-setuptools (75.6.0-1) ... Setting up python3-covdefaults (2.3.0-2) ... Setting up dh-python (6.20250108) ... Setting up pybuild-plugin-pyproject (6.20250108) ... Processing triggers for libc-bin (2.40-6) ... Processing triggers for ca-certificates (20241223) ... Updating certificates in /etc/ssl/certs... 0 added, 0 removed; done. Running hooks in /etc/ca-certificates/update.d... done. Reading package lists... Building dependency tree... Reading state information... Reading extended state information... Initializing package states... Writing extended state information... Building tag database... -> Finished parsing the build-deps Reading package lists... Building dependency tree... Reading state information... fakeroot is already the newest version (1.37-1). 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. I: Building the package I: Running cd /build/reproducible-path/python-aiowithings-3.0.3/ && env PATH="/usr/sbin:/usr/bin:/sbin:/bin:/usr/games" HOME="/nonexistent/first-build" dpkg-buildpackage -us -uc -b && env PATH="/usr/sbin:/usr/bin:/sbin:/bin:/usr/games" HOME="/nonexistent/first-build" dpkg-genchanges -S > ../python-aiowithings_3.0.3-2_source.changes dpkg-buildpackage: info: source package python-aiowithings dpkg-buildpackage: info: source version 3.0.3-2 dpkg-buildpackage: info: source distribution unstable dpkg-buildpackage: info: source changed by Thomas Goirand dpkg-source --before-build . dpkg-buildpackage: info: host architecture i386 dpkg-source: info: using options from python-aiowithings-3.0.3/debian/source/options: --extend-diff-ignore=^[^/]*[.]egg-info/ debian/rules clean make: pyversions: No such file or directory py3versions: no X-Python3-Version in control file, using supported versions dh clean --buildsystem=pybuild --with python3 dh_auto_clean -O--buildsystem=pybuild dh_autoreconf_clean -O--buildsystem=pybuild dh_clean -O--buildsystem=pybuild debian/rules binary make: pyversions: No such file or directory py3versions: no X-Python3-Version in control file, using supported versions dh binary --buildsystem=pybuild --with python3 dh_update_autotools_config -O--buildsystem=pybuild dh_autoreconf -O--buildsystem=pybuild dh_auto_configure -O--buildsystem=pybuild dh_auto_build -O--buildsystem=pybuild I: pybuild plugin_pyproject:129: Building wheel for python3.12 with "build" module I: pybuild base:311: python3.12 -m build --skip-dependency-check --no-isolation --wheel --outdir /build/reproducible-path/python-aiowithings-3.0.3/.pybuild/cpython3_3.12 * Building wheel... Successfully built aiowithings-2.1.0-py3-none-any.whl I: pybuild plugin_pyproject:144: Unpacking wheel built for python3.12 with "installer" module I: pybuild plugin_pyproject:129: Building wheel for python3.13 with "build" module I: pybuild base:311: python3.13 -m build --skip-dependency-check --no-isolation --wheel --outdir /build/reproducible-path/python-aiowithings-3.0.3/.pybuild/cpython3_3.13 * Building wheel... Successfully built aiowithings-2.1.0-py3-none-any.whl I: pybuild plugin_pyproject:144: Unpacking wheel built for python3.13 with "installer" module dh_auto_test -O--buildsystem=pybuild I: pybuild base:311: cd /build/reproducible-path/python-aiowithings-3.0.3/.pybuild/cpython3_3.12/build; python3.12 -m pytest -v tests /usr/lib/python3/dist-packages/pytest_asyncio/plugin.py:207: PytestDeprecationWarning: The configuration option "asyncio_default_fixture_loop_scope" is unset. The event loop scope for asynchronous fixtures will default to the fixture caching scope. Future versions of pytest-asyncio will default the loop scope for asynchronous fixtures to function scope. Set the default fixture loop scope explicitly in order to avoid unexpected behavior in the future. Valid fixture loop scopes are: "function", "class", "module", "package", "session" warnings.warn(PytestDeprecationWarning(_DEFAULT_FIXTURE_LOOP_SCOPE_UNSET)) ============================= test session starts ============================== platform linux -- Python 3.12.9, pytest-8.3.4, pluggy-1.5.0 -- /usr/bin/python3.12 cachedir: .pytest_cache rootdir: /build/reproducible-path/python-aiowithings-3.0.3/.pybuild/cpython3_3.12/build configfile: pyproject.toml plugins: typeguard-4.4.1, cov-5.0.0, asyncio-0.25.1, syrupy-4.8.1 asyncio: mode=Mode.AUTO, asyncio_default_fixture_loop_scope=None collecting ... collected 60 items tests/test_helpers.py::test_aggregate_measurements PASSED [ 1%] tests/test_helpers.py::test_aggregate_positional_measurements PASSED [ 3%] tests/test_helpers.py::test_aggregate_sleep_summary PASSED [ 5%] tests/test_helpers.py::test_aggregate_single_sleep_summary PASSED [ 6%] tests/test_helpers.py::test_aggregate_no_sleep_summary PASSED [ 8%] tests/test_models.py::test_measurement_parsing[measurement_list.json] PASSED [ 10%] tests/test_models.py::test_measurement_parsing[measurement_list_2.json] PASSED [ 11%] tests/test_util.py::test_measurement PASSED [ 13%] tests/test_util.py::test_measurement_from_dict PASSED [ 15%] tests/test_withings.py::test_putting_in_own_session FAILED [ 16%] tests/test_withings.py::test_creating_own_session FAILED [ 18%] tests/test_withings.py::test_refresh_token PASSED [ 20%] tests/test_withings.py::test_unexpected_server_response FAILED [ 21%] tests/test_withings.py::test_timeout FAILED [ 23%] tests/test_withings.py::test_error_codes[100-WithingsAuthenticationFailedError] FAILED [ 25%] tests/test_withings.py::test_error_codes[201-WithingsInvalidParamsError] FAILED [ 26%] tests/test_withings.py::test_error_codes[214-WithingsUnauthorizedError] FAILED [ 28%] tests/test_withings.py::test_error_codes[215-WithingsErrorOccurredError] FAILED [ 30%] tests/test_withings.py::test_error_codes[522-WithingsConnectionError] FAILED [ 31%] tests/test_withings.py::test_error_codes[524-WithingsBadStateError] FAILED [ 33%] tests/test_withings.py::test_error_codes[601-WithingsTooManyRequestsError] FAILED [ 35%] tests/test_withings.py::test_error_codes[-1-WithingsUnknownStatusError] FAILED [ 36%] tests/test_withings.py::test_error_codes[None-WithingsUnknownStatusError] FAILED [ 38%] tests/test_withings.py::test_get_activities_since FAILED [ 40%] tests/test_withings.py::test_get_activities_period FAILED [ 41%] tests/test_withings.py::test_get_devices FAILED [ 43%] tests/test_withings.py::test_get_new_device FAILED [ 45%] tests/test_withings.py::test_get_goals[goals] FAILED [ 46%] tests/test_withings.py::test_get_goals[goals_1] FAILED [ 48%] tests/test_withings.py::test_get_goals[goals_2] FAILED [ 50%] tests/test_withings.py::test_get_goals[no_goals] FAILED [ 51%] tests/test_withings.py::test_get_measurement_since FAILED [ 53%] tests/test_withings.py::test_get_measurement_period FAILED [ 55%] tests/test_withings.py::test_subscribing FAILED [ 56%] tests/test_withings.py::test_revoking FAILED [ 58%] tests/test_withings.py::test_list_subscriptions FAILED [ 60%] tests/test_withings.py::test_list_all_subscriptions FAILED [ 61%] tests/test_withings.py::test_measurement_points_to_get[UNKNOWN] PASSED [ 63%] tests/test_withings.py::test_measurement_points_to_get[WEIGHT] PASSED [ 65%] tests/test_withings.py::test_measurement_points_to_get[TEMPERATURE] PASSED [ 66%] tests/test_withings.py::test_measurement_points_to_get[PRESSURE] PASSED [ 68%] tests/test_withings.py::test_measurement_points_to_get[ACTIVITY] PASSED [ 70%] tests/test_withings.py::test_measurement_points_to_get[SLEEP] PASSED [ 71%] tests/test_withings.py::test_measurement_points_to_get[USER_DATA] PASSED [ 73%] tests/test_withings.py::test_measurement_points_to_get[IN_BED] PASSED [ 75%] tests/test_withings.py::test_measurement_points_to_get[OUT_BED] PASSED [ 76%] tests/test_withings.py::test_measurement_points_to_get[INITIAL_INFLATION_DONE] PASSED [ 78%] tests/test_withings.py::test_measurement_points_to_get[NO_ACCOUNT_ASSOCIATED] PASSED [ 80%] tests/test_withings.py::test_measurement_points_to_get[ECG] PASSED [ 81%] tests/test_withings.py::test_measurement_points_to_get[ECG_FAILED] PASSED [ 83%] tests/test_withings.py::test_measurement_points_to_get[GLUCOSE] PASSED [ 85%] tests/test_withings.py::test_webhook_object PASSED [ 86%] tests/test_withings.py::test_get_sleep FAILED [ 88%] tests/test_withings.py::test_get_sleep_without_data_fields FAILED [ 90%] tests/test_withings.py::test_get_sleep_summary_in_period FAILED [ 91%] tests/test_withings.py::test_get_sleep_summary_in_period_without_data_fields FAILED [ 93%] tests/test_withings.py::test_get_sleep_summary_since FAILED [ 95%] tests/test_withings.py::test_get_sleep_summary_since_without_data_fields FAILED [ 96%] tests/test_withings.py::test_get_workouts_since FAILED [ 98%] tests/test_withings.py::test_get_workouts_period FAILED [100%] =================================== FAILURES =================================== _________________________ test_putting_in_own_session __________________________ responses = async def test_putting_in_own_session( responses: aioresponses, ) -> None: """Test putting in own session.""" responses.post( f"{WITHINGS_URL}/v2/user", status=200, body=load_fixture("device.json"), ) async with aiohttp.ClientSession() as session: withings = WithingsClient(session=session) withings.authenticate("test") > await withings.get_devices() tests/test_withings.py:55: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:151: in get_devices response = await self._request("v2/user", data={"action": "getdevice"}) aiowithings/withings.py:108: in _request response = await self.session.request( /usr/lib/python3.12/unittest/mock.py:2302: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/v2/user'), args = () kwargs = {'data': {'action': 'getdevice'}, 'headers': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/v2/user') url_str = 'https://wbsapi.withings.net/v2/user' key = ('POST', URL('https://wbsapi.withings.net/v2/user')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test'}, 'data': {'action': 'getdevice'}, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/v2/user /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError __________________________ test_creating_own_session ___________________________ responses = async def test_creating_own_session( responses: aioresponses, ) -> None: """Test creating own session.""" responses.post( f"{WITHINGS_URL}/v2/user", status=200, body=load_fixture("device.json"), ) withings = WithingsClient() withings.authenticate("test") > await withings.get_devices() tests/test_withings.py:73: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:151: in get_devices response = await self._request("v2/user", data={"action": "getdevice"}) aiowithings/withings.py:108: in _request response = await self.session.request( /usr/lib/python3.12/unittest/mock.py:2302: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/v2/user'), args = () kwargs = {'data': {'action': 'getdevice'}, 'headers': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/v2/user') url_str = 'https://wbsapi.withings.net/v2/user' key = ('POST', URL('https://wbsapi.withings.net/v2/user')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test'}, 'data': {'action': 'getdevice'}, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/v2/user /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError _______________________ test_unexpected_server_response ________________________ responses = authenticated_client = WithingsClient(session=, request_timeout=10, api_host='wbsapi.withings.net', _token='test', _close_session=False, refresh_token_function=None) async def test_unexpected_server_response( responses: aioresponses, authenticated_client: WithingsClient, ) -> None: """Test handling unexpected response.""" responses.post( f"{WITHINGS_URL}/v2/user", status=200, headers={"Content-Type": "plain/text"}, body="Yes", ) with pytest.raises(WithingsError): > assert await authenticated_client.get_devices() tests/test_withings.py:109: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:151: in get_devices response = await self._request("v2/user", data={"action": "getdevice"}) aiowithings/withings.py:108: in _request response = await self.session.request( /usr/lib/python3.12/unittest/mock.py:2302: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/v2/user'), args = () kwargs = {'data': {'action': 'getdevice'}, 'headers': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/v2/user') url_str = 'https://wbsapi.withings.net/v2/user' key = ('POST', URL('https://wbsapi.withings.net/v2/user')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test'}, 'data': {'action': 'getdevice'}, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/v2/user /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError _________________________________ test_timeout _________________________________ responses = async def test_timeout( responses: aioresponses, ) -> None: """Test request timeout.""" # Faking a timeout by sleeping async def response_handler(_: str, **_kwargs: Any) -> CallbackResult: """Response handler for this test.""" await asyncio.sleep(2) return CallbackResult(body="Goodmorning!") responses.post( f"{WITHINGS_URL}/v2/user", callback=response_handler, ) async with WithingsClient(request_timeout=1) as withings: with pytest.raises(WithingsConnectionError): > assert await withings.get_devices() tests/test_withings.py:129: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:151: in get_devices response = await self._request("v2/user", data={"action": "getdevice"}) aiowithings/withings.py:108: in _request response = await self.session.request( /usr/lib/python3.12/unittest/mock.py:2302: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/v2/user'), args = () kwargs = {'data': {'action': 'getdevice'}, 'headers': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer None', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/v2/user') url_str = 'https://wbsapi.withings.net/v2/user' key = ('POST', URL('https://wbsapi.withings.net/v2/user')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer None'}, 'data': {'action': 'getdevice'}, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/v2/user /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError ___________ test_error_codes[100-WithingsAuthenticationFailedError] ____________ responses = authenticated_client = WithingsClient(session=, request_timeout=10, api_host='wbsapi.withings.net', _token='test', _close_session=False, refresh_token_function=None) status = 100 error = @pytest.mark.parametrize( ("status", "error"), [ (100, WithingsAuthenticationFailedError), (201, WithingsInvalidParamsError), (214, WithingsUnauthorizedError), (215, WithingsErrorOccurredError), (522, WithingsConnectionError), (524, WithingsBadStateError), (601, WithingsTooManyRequestsError), (-1, WithingsUnknownStatusError), (None, WithingsUnknownStatusError), ], ) async def test_error_codes( responses: aioresponses, authenticated_client: WithingsClient, status: int | None, error: type[Exception], ) -> None: """Test error codes from withings.""" response_data = json.loads(load_fixture("device.json")) response_data["status"] = status responses.post( f"{WITHINGS_URL}/v2/user", status=200, body=json.dumps(response_data), ) with pytest.raises(error): > assert await authenticated_client.get_devices() tests/test_withings.py:162: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:151: in get_devices response = await self._request("v2/user", data={"action": "getdevice"}) aiowithings/withings.py:108: in _request response = await self.session.request( /usr/lib/python3.12/unittest/mock.py:2302: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/v2/user'), args = () kwargs = {'data': {'action': 'getdevice'}, 'headers': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/v2/user') url_str = 'https://wbsapi.withings.net/v2/user' key = ('POST', URL('https://wbsapi.withings.net/v2/user')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test'}, 'data': {'action': 'getdevice'}, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/v2/user /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError _______________ test_error_codes[201-WithingsInvalidParamsError] _______________ responses = authenticated_client = WithingsClient(session=, request_timeout=10, api_host='wbsapi.withings.net', _token='test', _close_session=False, refresh_token_function=None) status = 201 error = @pytest.mark.parametrize( ("status", "error"), [ (100, WithingsAuthenticationFailedError), (201, WithingsInvalidParamsError), (214, WithingsUnauthorizedError), (215, WithingsErrorOccurredError), (522, WithingsConnectionError), (524, WithingsBadStateError), (601, WithingsTooManyRequestsError), (-1, WithingsUnknownStatusError), (None, WithingsUnknownStatusError), ], ) async def test_error_codes( responses: aioresponses, authenticated_client: WithingsClient, status: int | None, error: type[Exception], ) -> None: """Test error codes from withings.""" response_data = json.loads(load_fixture("device.json")) response_data["status"] = status responses.post( f"{WITHINGS_URL}/v2/user", status=200, body=json.dumps(response_data), ) with pytest.raises(error): > assert await authenticated_client.get_devices() tests/test_withings.py:162: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:151: in get_devices response = await self._request("v2/user", data={"action": "getdevice"}) aiowithings/withings.py:108: in _request response = await self.session.request( /usr/lib/python3.12/unittest/mock.py:2302: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/v2/user'), args = () kwargs = {'data': {'action': 'getdevice'}, 'headers': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/v2/user') url_str = 'https://wbsapi.withings.net/v2/user' key = ('POST', URL('https://wbsapi.withings.net/v2/user')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test'}, 'data': {'action': 'getdevice'}, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/v2/user /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError _______________ test_error_codes[214-WithingsUnauthorizedError] ________________ responses = authenticated_client = WithingsClient(session=, request_timeout=10, api_host='wbsapi.withings.net', _token='test', _close_session=False, refresh_token_function=None) status = 214, error = @pytest.mark.parametrize( ("status", "error"), [ (100, WithingsAuthenticationFailedError), (201, WithingsInvalidParamsError), (214, WithingsUnauthorizedError), (215, WithingsErrorOccurredError), (522, WithingsConnectionError), (524, WithingsBadStateError), (601, WithingsTooManyRequestsError), (-1, WithingsUnknownStatusError), (None, WithingsUnknownStatusError), ], ) async def test_error_codes( responses: aioresponses, authenticated_client: WithingsClient, status: int | None, error: type[Exception], ) -> None: """Test error codes from withings.""" response_data = json.loads(load_fixture("device.json")) response_data["status"] = status responses.post( f"{WITHINGS_URL}/v2/user", status=200, body=json.dumps(response_data), ) with pytest.raises(error): > assert await authenticated_client.get_devices() tests/test_withings.py:162: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:151: in get_devices response = await self._request("v2/user", data={"action": "getdevice"}) aiowithings/withings.py:108: in _request response = await self.session.request( /usr/lib/python3.12/unittest/mock.py:2302: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/v2/user'), args = () kwargs = {'data': {'action': 'getdevice'}, 'headers': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/v2/user') url_str = 'https://wbsapi.withings.net/v2/user' key = ('POST', URL('https://wbsapi.withings.net/v2/user')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test'}, 'data': {'action': 'getdevice'}, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/v2/user /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError _______________ test_error_codes[215-WithingsErrorOccurredError] _______________ responses = authenticated_client = WithingsClient(session=, request_timeout=10, api_host='wbsapi.withings.net', _token='test', _close_session=False, refresh_token_function=None) status = 215 error = @pytest.mark.parametrize( ("status", "error"), [ (100, WithingsAuthenticationFailedError), (201, WithingsInvalidParamsError), (214, WithingsUnauthorizedError), (215, WithingsErrorOccurredError), (522, WithingsConnectionError), (524, WithingsBadStateError), (601, WithingsTooManyRequestsError), (-1, WithingsUnknownStatusError), (None, WithingsUnknownStatusError), ], ) async def test_error_codes( responses: aioresponses, authenticated_client: WithingsClient, status: int | None, error: type[Exception], ) -> None: """Test error codes from withings.""" response_data = json.loads(load_fixture("device.json")) response_data["status"] = status responses.post( f"{WITHINGS_URL}/v2/user", status=200, body=json.dumps(response_data), ) with pytest.raises(error): > assert await authenticated_client.get_devices() tests/test_withings.py:162: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:151: in get_devices response = await self._request("v2/user", data={"action": "getdevice"}) aiowithings/withings.py:108: in _request response = await self.session.request( /usr/lib/python3.12/unittest/mock.py:2302: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/v2/user'), args = () kwargs = {'data': {'action': 'getdevice'}, 'headers': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/v2/user') url_str = 'https://wbsapi.withings.net/v2/user' key = ('POST', URL('https://wbsapi.withings.net/v2/user')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test'}, 'data': {'action': 'getdevice'}, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/v2/user /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError ________________ test_error_codes[522-WithingsConnectionError] _________________ responses = authenticated_client = WithingsClient(session=, request_timeout=10, api_host='wbsapi.withings.net', _token='test', _close_session=False, refresh_token_function=None) status = 522, error = @pytest.mark.parametrize( ("status", "error"), [ (100, WithingsAuthenticationFailedError), (201, WithingsInvalidParamsError), (214, WithingsUnauthorizedError), (215, WithingsErrorOccurredError), (522, WithingsConnectionError), (524, WithingsBadStateError), (601, WithingsTooManyRequestsError), (-1, WithingsUnknownStatusError), (None, WithingsUnknownStatusError), ], ) async def test_error_codes( responses: aioresponses, authenticated_client: WithingsClient, status: int | None, error: type[Exception], ) -> None: """Test error codes from withings.""" response_data = json.loads(load_fixture("device.json")) response_data["status"] = status responses.post( f"{WITHINGS_URL}/v2/user", status=200, body=json.dumps(response_data), ) with pytest.raises(error): > assert await authenticated_client.get_devices() tests/test_withings.py:162: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:151: in get_devices response = await self._request("v2/user", data={"action": "getdevice"}) aiowithings/withings.py:108: in _request response = await self.session.request( /usr/lib/python3.12/unittest/mock.py:2302: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/v2/user'), args = () kwargs = {'data': {'action': 'getdevice'}, 'headers': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/v2/user') url_str = 'https://wbsapi.withings.net/v2/user' key = ('POST', URL('https://wbsapi.withings.net/v2/user')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test'}, 'data': {'action': 'getdevice'}, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/v2/user /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError _________________ test_error_codes[524-WithingsBadStateError] __________________ responses = authenticated_client = WithingsClient(session=, request_timeout=10, api_host='wbsapi.withings.net', _token='test', _close_session=False, refresh_token_function=None) status = 524, error = @pytest.mark.parametrize( ("status", "error"), [ (100, WithingsAuthenticationFailedError), (201, WithingsInvalidParamsError), (214, WithingsUnauthorizedError), (215, WithingsErrorOccurredError), (522, WithingsConnectionError), (524, WithingsBadStateError), (601, WithingsTooManyRequestsError), (-1, WithingsUnknownStatusError), (None, WithingsUnknownStatusError), ], ) async def test_error_codes( responses: aioresponses, authenticated_client: WithingsClient, status: int | None, error: type[Exception], ) -> None: """Test error codes from withings.""" response_data = json.loads(load_fixture("device.json")) response_data["status"] = status responses.post( f"{WITHINGS_URL}/v2/user", status=200, body=json.dumps(response_data), ) with pytest.raises(error): > assert await authenticated_client.get_devices() tests/test_withings.py:162: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:151: in get_devices response = await self._request("v2/user", data={"action": "getdevice"}) aiowithings/withings.py:108: in _request response = await self.session.request( /usr/lib/python3.12/unittest/mock.py:2302: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/v2/user'), args = () kwargs = {'data': {'action': 'getdevice'}, 'headers': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/v2/user') url_str = 'https://wbsapi.withings.net/v2/user' key = ('POST', URL('https://wbsapi.withings.net/v2/user')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test'}, 'data': {'action': 'getdevice'}, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/v2/user /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError ______________ test_error_codes[601-WithingsTooManyRequestsError] ______________ responses = authenticated_client = WithingsClient(session=, request_timeout=10, api_host='wbsapi.withings.net', _token='test', _close_session=False, refresh_token_function=None) status = 601 error = @pytest.mark.parametrize( ("status", "error"), [ (100, WithingsAuthenticationFailedError), (201, WithingsInvalidParamsError), (214, WithingsUnauthorizedError), (215, WithingsErrorOccurredError), (522, WithingsConnectionError), (524, WithingsBadStateError), (601, WithingsTooManyRequestsError), (-1, WithingsUnknownStatusError), (None, WithingsUnknownStatusError), ], ) async def test_error_codes( responses: aioresponses, authenticated_client: WithingsClient, status: int | None, error: type[Exception], ) -> None: """Test error codes from withings.""" response_data = json.loads(load_fixture("device.json")) response_data["status"] = status responses.post( f"{WITHINGS_URL}/v2/user", status=200, body=json.dumps(response_data), ) with pytest.raises(error): > assert await authenticated_client.get_devices() tests/test_withings.py:162: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:151: in get_devices response = await self._request("v2/user", data={"action": "getdevice"}) aiowithings/withings.py:108: in _request response = await self.session.request( /usr/lib/python3.12/unittest/mock.py:2302: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/v2/user'), args = () kwargs = {'data': {'action': 'getdevice'}, 'headers': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/v2/user') url_str = 'https://wbsapi.withings.net/v2/user' key = ('POST', URL('https://wbsapi.withings.net/v2/user')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test'}, 'data': {'action': 'getdevice'}, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/v2/user /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError _______________ test_error_codes[-1-WithingsUnknownStatusError] ________________ responses = authenticated_client = WithingsClient(session=, request_timeout=10, api_host='wbsapi.withings.net', _token='test', _close_session=False, refresh_token_function=None) status = -1, error = @pytest.mark.parametrize( ("status", "error"), [ (100, WithingsAuthenticationFailedError), (201, WithingsInvalidParamsError), (214, WithingsUnauthorizedError), (215, WithingsErrorOccurredError), (522, WithingsConnectionError), (524, WithingsBadStateError), (601, WithingsTooManyRequestsError), (-1, WithingsUnknownStatusError), (None, WithingsUnknownStatusError), ], ) async def test_error_codes( responses: aioresponses, authenticated_client: WithingsClient, status: int | None, error: type[Exception], ) -> None: """Test error codes from withings.""" response_data = json.loads(load_fixture("device.json")) response_data["status"] = status responses.post( f"{WITHINGS_URL}/v2/user", status=200, body=json.dumps(response_data), ) with pytest.raises(error): > assert await authenticated_client.get_devices() tests/test_withings.py:162: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:151: in get_devices response = await self._request("v2/user", data={"action": "getdevice"}) aiowithings/withings.py:108: in _request response = await self.session.request( /usr/lib/python3.12/unittest/mock.py:2302: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/v2/user'), args = () kwargs = {'data': {'action': 'getdevice'}, 'headers': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/v2/user') url_str = 'https://wbsapi.withings.net/v2/user' key = ('POST', URL('https://wbsapi.withings.net/v2/user')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test'}, 'data': {'action': 'getdevice'}, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/v2/user /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError ______________ test_error_codes[None-WithingsUnknownStatusError] _______________ responses = authenticated_client = WithingsClient(session=, request_timeout=10, api_host='wbsapi.withings.net', _token='test', _close_session=False, refresh_token_function=None) status = None error = @pytest.mark.parametrize( ("status", "error"), [ (100, WithingsAuthenticationFailedError), (201, WithingsInvalidParamsError), (214, WithingsUnauthorizedError), (215, WithingsErrorOccurredError), (522, WithingsConnectionError), (524, WithingsBadStateError), (601, WithingsTooManyRequestsError), (-1, WithingsUnknownStatusError), (None, WithingsUnknownStatusError), ], ) async def test_error_codes( responses: aioresponses, authenticated_client: WithingsClient, status: int | None, error: type[Exception], ) -> None: """Test error codes from withings.""" response_data = json.loads(load_fixture("device.json")) response_data["status"] = status responses.post( f"{WITHINGS_URL}/v2/user", status=200, body=json.dumps(response_data), ) with pytest.raises(error): > assert await authenticated_client.get_devices() tests/test_withings.py:162: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:151: in get_devices response = await self._request("v2/user", data={"action": "getdevice"}) aiowithings/withings.py:108: in _request response = await self.session.request( /usr/lib/python3.12/unittest/mock.py:2302: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/v2/user'), args = () kwargs = {'data': {'action': 'getdevice'}, 'headers': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/v2/user') url_str = 'https://wbsapi.withings.net/v2/user' key = ('POST', URL('https://wbsapi.withings.net/v2/user')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test'}, 'data': {'action': 'getdevice'}, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/v2/user /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError __________________________ test_get_activities_since ___________________________ responses = snapshot = SnapshotAssertion(name='snapshot', num_executions=0) authenticated_client = WithingsClient(session=, request_timeout=10, api_host='wbsapi.withings.net', _token='test', _close_session=False, refresh_token_function=None) async def test_get_activities_since( responses: aioresponses, snapshot: SnapshotAssertion, authenticated_client: WithingsClient, ) -> None: """Test retrieving activities.""" responses.post( f"{WITHINGS_URL}/v2/measure", status=200, body=load_fixture("activity.json"), ) > response = await authenticated_client.get_activities_since( datetime.fromtimestamp(1609559200, tz=timezone.utc), activity_data_fields=[ActivityDataFields.DISTANCE], ) tests/test_withings.py:176: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:290: in get_activities_since return await self._get_activities( aiowithings/withings.py:278: in _get_activities response = await self._request( aiowithings/withings.py:108: in _request response = await self.session.request( /usr/lib/python3.12/unittest/mock.py:2302: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/v2/measure'), args = () kwargs = {'data': {'action': 'getactivity', 'data_fields': 'distance', 'lastupdate': 1609559200}, 'headers': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/v2/measure') url_str = 'https://wbsapi.withings.net/v2/measure' key = ('POST', URL('https://wbsapi.withings.net/v2/measure')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, *...st'}, 'data': {'lastupdate': 1609559200, 'action': 'getactivity', 'data_fields': 'distance'}, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/v2/measure /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError __________________________ test_get_activities_period __________________________ responses = snapshot = SnapshotAssertion(name='snapshot', num_executions=0) authenticated_client = WithingsClient(session=, request_timeout=10, api_host='wbsapi.withings.net', _token='test', _close_session=False, refresh_token_function=None) async def test_get_activities_period( responses: aioresponses, snapshot: SnapshotAssertion, authenticated_client: WithingsClient, ) -> None: """Test retrieving activities.""" responses.post( f"{WITHINGS_URL}/v2/measure", status=200, body=load_fixture("activity.json"), ) > response = await authenticated_client.get_activities_in_period( start_date=datetime.fromtimestamp(1609459200, tz=timezone.utc), end_date=datetime.fromtimestamp(1609559200, tz=timezone.utc), ) tests/test_withings.py:204: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:302: in get_activities_in_period return await self._get_activities( aiowithings/withings.py:278: in _get_activities response = await self._request( aiowithings/withings.py:108: in _request response = await self.session.request( /usr/lib/python3.12/unittest/mock.py:2302: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/v2/measure'), args = () kwargs = {'data': {'action': 'getactivity', 'enddateymd': '2021-01-02 03:46:40+00:00', 'startdateymd': '2021-01-01 00:00:00+00:...s': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/v2/measure') url_str = 'https://wbsapi.withings.net/v2/measure' key = ('POST', URL('https://wbsapi.withings.net/v2/measure')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, *...1-01-01 00:00:00+00:00', 'enddateymd': '2021-01-02 03:46:40+00:00', 'action': 'getactivity'}, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/v2/measure /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError _______________________________ test_get_devices _______________________________ responses = snapshot = SnapshotAssertion(name='snapshot', num_executions=0) authenticated_client = WithingsClient(session=, request_timeout=10, api_host='wbsapi.withings.net', _token='test', _close_session=False, refresh_token_function=None) async def test_get_devices( responses: aioresponses, snapshot: SnapshotAssertion, authenticated_client: WithingsClient, ) -> None: """Test retrieving devices.""" responses.post( f"{WITHINGS_URL}/v2/user", status=200, body=load_fixture("device.json"), ) > response = await authenticated_client.get_devices() tests/test_withings.py:232: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:151: in get_devices response = await self._request("v2/user", data={"action": "getdevice"}) aiowithings/withings.py:108: in _request response = await self.session.request( /usr/lib/python3.12/unittest/mock.py:2302: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/v2/user'), args = () kwargs = {'data': {'action': 'getdevice'}, 'headers': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/v2/user') url_str = 'https://wbsapi.withings.net/v2/user' key = ('POST', URL('https://wbsapi.withings.net/v2/user')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test'}, 'data': {'action': 'getdevice'}, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/v2/user /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError _____________________________ test_get_new_device ______________________________ responses = snapshot = SnapshotAssertion(name='snapshot', num_executions=0) authenticated_client = WithingsClient(session=, request_timeout=10, api_host='wbsapi.withings.net', _token='test', _close_session=False, refresh_token_function=None) caplog = <_pytest.logging.LogCaptureFixture object at 0xf5eaa720> async def test_get_new_device( responses: aioresponses, snapshot: SnapshotAssertion, authenticated_client: WithingsClient, caplog: pytest.LogCaptureFixture, ) -> None: """Test retrieving devices that aren't known yet.""" responses.post( f"{WITHINGS_URL}/v2/user", status=200, body=load_fixture("new_device.json"), ) > response = await authenticated_client.get_devices() tests/test_withings.py:254: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:151: in get_devices response = await self._request("v2/user", data={"action": "getdevice"}) aiowithings/withings.py:108: in _request response = await self.session.request( /usr/lib/python3.12/unittest/mock.py:2302: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/v2/user'), args = () kwargs = {'data': {'action': 'getdevice'}, 'headers': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/v2/user') url_str = 'https://wbsapi.withings.net/v2/user' key = ('POST', URL('https://wbsapi.withings.net/v2/user')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test'}, 'data': {'action': 'getdevice'}, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/v2/user /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError ____________________________ test_get_goals[goals] _____________________________ responses = snapshot = SnapshotAssertion(name='snapshot', num_executions=0) authenticated_client = WithingsClient(session=, request_timeout=10, api_host='wbsapi.withings.net', _token='test', _close_session=False, refresh_token_function=None) fixture = 'goals' @pytest.mark.parametrize( "fixture", [ "goals", "goals_1", "goals_2", "no_goals", ], ) async def test_get_goals( responses: aioresponses, snapshot: SnapshotAssertion, authenticated_client: WithingsClient, fixture: str, ) -> None: """Test retrieving goals.""" responses.post( f"{WITHINGS_URL}/v2/user", status=200, body=load_fixture(f"{fixture}.json"), ) > response = await authenticated_client.get_goals() tests/test_withings.py:288: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:156: in get_goals response = await self._request("v2/user", data={"action": "getgoals"}) aiowithings/withings.py:108: in _request response = await self.session.request( /usr/lib/python3.12/unittest/mock.py:2302: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/v2/user'), args = () kwargs = {'data': {'action': 'getgoals'}, 'headers': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/v2/user') url_str = 'https://wbsapi.withings.net/v2/user' key = ('POST', URL('https://wbsapi.withings.net/v2/user')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test'}, 'data': {'action': 'getgoals'}, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/v2/user /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError ___________________________ test_get_goals[goals_1] ____________________________ responses = snapshot = SnapshotAssertion(name='snapshot', num_executions=0) authenticated_client = WithingsClient(session=, request_timeout=10, api_host='wbsapi.withings.net', _token='test', _close_session=False, refresh_token_function=None) fixture = 'goals_1' @pytest.mark.parametrize( "fixture", [ "goals", "goals_1", "goals_2", "no_goals", ], ) async def test_get_goals( responses: aioresponses, snapshot: SnapshotAssertion, authenticated_client: WithingsClient, fixture: str, ) -> None: """Test retrieving goals.""" responses.post( f"{WITHINGS_URL}/v2/user", status=200, body=load_fixture(f"{fixture}.json"), ) > response = await authenticated_client.get_goals() tests/test_withings.py:288: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:156: in get_goals response = await self._request("v2/user", data={"action": "getgoals"}) aiowithings/withings.py:108: in _request response = await self.session.request( /usr/lib/python3.12/unittest/mock.py:2302: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/v2/user'), args = () kwargs = {'data': {'action': 'getgoals'}, 'headers': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/v2/user') url_str = 'https://wbsapi.withings.net/v2/user' key = ('POST', URL('https://wbsapi.withings.net/v2/user')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test'}, 'data': {'action': 'getgoals'}, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/v2/user /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError ___________________________ test_get_goals[goals_2] ____________________________ responses = snapshot = SnapshotAssertion(name='snapshot', num_executions=0) authenticated_client = WithingsClient(session=, request_timeout=10, api_host='wbsapi.withings.net', _token='test', _close_session=False, refresh_token_function=None) fixture = 'goals_2' @pytest.mark.parametrize( "fixture", [ "goals", "goals_1", "goals_2", "no_goals", ], ) async def test_get_goals( responses: aioresponses, snapshot: SnapshotAssertion, authenticated_client: WithingsClient, fixture: str, ) -> None: """Test retrieving goals.""" responses.post( f"{WITHINGS_URL}/v2/user", status=200, body=load_fixture(f"{fixture}.json"), ) > response = await authenticated_client.get_goals() tests/test_withings.py:288: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:156: in get_goals response = await self._request("v2/user", data={"action": "getgoals"}) aiowithings/withings.py:108: in _request response = await self.session.request( /usr/lib/python3.12/unittest/mock.py:2302: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/v2/user'), args = () kwargs = {'data': {'action': 'getgoals'}, 'headers': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/v2/user') url_str = 'https://wbsapi.withings.net/v2/user' key = ('POST', URL('https://wbsapi.withings.net/v2/user')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test'}, 'data': {'action': 'getgoals'}, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/v2/user /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError ___________________________ test_get_goals[no_goals] ___________________________ responses = snapshot = SnapshotAssertion(name='snapshot', num_executions=0) authenticated_client = WithingsClient(session=, request_timeout=10, api_host='wbsapi.withings.net', _token='test', _close_session=False, refresh_token_function=None) fixture = 'no_goals' @pytest.mark.parametrize( "fixture", [ "goals", "goals_1", "goals_2", "no_goals", ], ) async def test_get_goals( responses: aioresponses, snapshot: SnapshotAssertion, authenticated_client: WithingsClient, fixture: str, ) -> None: """Test retrieving goals.""" responses.post( f"{WITHINGS_URL}/v2/user", status=200, body=load_fixture(f"{fixture}.json"), ) > response = await authenticated_client.get_goals() tests/test_withings.py:288: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:156: in get_goals response = await self._request("v2/user", data={"action": "getgoals"}) aiowithings/withings.py:108: in _request response = await self.session.request( /usr/lib/python3.12/unittest/mock.py:2302: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/v2/user'), args = () kwargs = {'data': {'action': 'getgoals'}, 'headers': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/v2/user') url_str = 'https://wbsapi.withings.net/v2/user' key = ('POST', URL('https://wbsapi.withings.net/v2/user')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test'}, 'data': {'action': 'getgoals'}, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/v2/user /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError __________________________ test_get_measurement_since __________________________ responses = snapshot = SnapshotAssertion(name='snapshot', num_executions=0) authenticated_client = WithingsClient(session=, request_timeout=10, api_host='wbsapi.withings.net', _token='test', _close_session=False, refresh_token_function=None) async def test_get_measurement_since( responses: aioresponses, snapshot: SnapshotAssertion, authenticated_client: WithingsClient, ) -> None: """Test retrieving measurements.""" responses.post( f"{WITHINGS_URL}/measure", status=200, body=load_fixture("measurement.json"), ) > response = await authenticated_client.get_measurement_since( datetime.fromtimestamp(1609459200, tz=timezone.utc), measurement_types=[MeasurementType.WEIGHT], ) tests/test_withings.py:309: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:181: in get_measurement_since return await self._get_measurements( aiowithings/withings.py:169: in _get_measurements response = await self._request("measure", data=data) aiowithings/withings.py:108: in _request response = await self.session.request( /usr/lib/python3.12/unittest/mock.py:2302: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/measure'), args = () kwargs = {'data': {'action': 'getmeas', 'lastupdate': 1609459200, 'meastypes': '1'}, 'headers': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/measure') url_str = 'https://wbsapi.withings.net/measure' key = ('POST', URL('https://wbsapi.withings.net/measure')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, *...': 'Bearer test'}, 'data': {'lastupdate': 1609459200, 'action': 'getmeas', 'meastypes': '1'}, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/measure /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError _________________________ test_get_measurement_period __________________________ responses = snapshot = SnapshotAssertion(name='snapshot', num_executions=0) authenticated_client = WithingsClient(session=, request_timeout=10, api_host='wbsapi.withings.net', _token='test', _close_session=False, refresh_token_function=None) async def test_get_measurement_period( responses: aioresponses, snapshot: SnapshotAssertion, authenticated_client: WithingsClient, ) -> None: """Test retrieving measurements.""" responses.post( f"{WITHINGS_URL}/measure", status=200, body=load_fixture("measurement.json"), ) > response = await authenticated_client.get_measurement_in_period( start_date=datetime.fromtimestamp(1609459200, tz=timezone.utc), end_date=datetime.fromtimestamp(1609559200, tz=timezone.utc), ) tests/test_withings.py:333: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:193: in get_measurement_in_period return await self._get_measurements( aiowithings/withings.py:169: in _get_measurements response = await self._request("measure", data=data) aiowithings/withings.py:108: in _request response = await self.session.request( /usr/lib/python3.12/unittest/mock.py:2302: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/measure'), args = () kwargs = {'data': {'action': 'getmeas', 'enddate': 1609559200, 'startdate': 1609459200}, 'headers': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/measure') url_str = 'https://wbsapi.withings.net/measure' key = ('POST', URL('https://wbsapi.withings.net/measure')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, *...Bearer test'}, 'data': {'startdate': 1609459200, 'enddate': 1609559200, 'action': 'getmeas'}, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/measure /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError _______________________________ test_subscribing _______________________________ responses = authenticated_client = WithingsClient(session=, request_timeout=10, api_host='wbsapi.withings.net', _token='test', _close_session=False, refresh_token_function=None) async def test_subscribing( responses: aioresponses, authenticated_client: WithingsClient, ) -> None: """Test subscribing to webhook updates.""" responses.post( f"{WITHINGS_URL}/notify", status=200, body=load_fixture("notify_subscribe.json"), ) > await authenticated_client.subscribe_notification( "https://test.com/callback", NotificationCategory.PRESSURE, ) tests/test_withings.py:356: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:352: in subscribe_notification await self._request( aiowithings/withings.py:108: in _request response = await self.session.request( /usr/lib/python3.12/unittest/mock.py:2302: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/notify'), args = () kwargs = {'data': {'action': 'subscribe', 'appli': , 'callbackurl': 'https://test.com/callbac...s': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/notify') url_str = 'https://wbsapi.withings.net/notify' key = ('POST', URL('https://wbsapi.withings.net/notify')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, *...e', 'callbackurl': 'https://test.com/callback', 'appli': }, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/notify /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError ________________________________ test_revoking _________________________________ responses = authenticated_client = WithingsClient(session=, request_timeout=10, api_host='wbsapi.withings.net', _token='test', _close_session=False, refresh_token_function=None) async def test_revoking( responses: aioresponses, authenticated_client: WithingsClient, ) -> None: """Test subscribing to webhook updates.""" responses.post( f"{WITHINGS_URL}/notify", status=200, body=load_fixture("notify_revoke.json"), ) > await authenticated_client.revoke_notification_configurations( "https://test.com/callback", NotificationCategory.PRESSURE, ) tests/test_withings.py:382: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:386: in revoke_notification_configurations await self._request( aiowithings/withings.py:108: in _request response = await self.session.request( /usr/lib/python3.12/unittest/mock.py:2302: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/notify'), args = () kwargs = {'data': {'action': 'revoke', 'appli': , 'callbackurl': 'https://test.com/callback'}...s': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/notify') url_str = 'https://wbsapi.withings.net/notify' key = ('POST', URL('https://wbsapi.withings.net/notify')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, *...e', 'callbackurl': 'https://test.com/callback', 'appli': }, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/notify /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError ___________________________ test_list_subscriptions ____________________________ responses = snapshot = SnapshotAssertion(name='snapshot', num_executions=0) authenticated_client = WithingsClient(session=, request_timeout=10, api_host='wbsapi.withings.net', _token='test', _close_session=False, refresh_token_function=None) async def test_list_subscriptions( responses: aioresponses, snapshot: SnapshotAssertion, authenticated_client: WithingsClient, ) -> None: """Test retrieving subscriptions.""" responses.post( f"{WITHINGS_URL}/notify", status=200, body=load_fixture("notify_list.json"), ) > response = await authenticated_client.list_notification_configurations( NotificationCategory.WEIGHT, ) tests/test_withings.py:409: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:371: in list_notification_configurations response = await self._request( aiowithings/withings.py:108: in _request response = await self.session.request( /usr/lib/python3.12/unittest/mock.py:2302: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/notify'), args = () kwargs = {'data': {'action': 'list', 'appli': }, 'headers': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/notify') url_str = 'https://wbsapi.withings.net/notify' key = ('POST', URL('https://wbsapi.withings.net/notify')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, *...tion': 'Bearer test'}, 'data': {'action': 'list', 'appli': }, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/notify /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError _________________________ test_list_all_subscriptions __________________________ responses = authenticated_client = WithingsClient(session=, request_timeout=10, api_host='wbsapi.withings.net', _token='test', _close_session=False, refresh_token_function=None) async def test_list_all_subscriptions( responses: aioresponses, authenticated_client: WithingsClient, ) -> None: """Test retrieving all subscriptions.""" responses.post( f"{WITHINGS_URL}/notify", status=200, body=load_fixture("notify_list.json"), ) > response = await authenticated_client.list_notification_configurations() tests/test_withings.py:431: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:371: in list_notification_configurations response = await self._request( aiowithings/withings.py:108: in _request response = await self.session.request( /usr/lib/python3.12/unittest/mock.py:2302: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/notify'), args = () kwargs = {'data': {'action': 'list'}, 'headers': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/notify') url_str = 'https://wbsapi.withings.net/notify' key = ('POST', URL('https://wbsapi.withings.net/notify')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test'}, 'data': {'action': 'list'}, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/notify /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError ________________________________ test_get_sleep ________________________________ responses = snapshot = SnapshotAssertion(name='snapshot', num_executions=0) authenticated_client = WithingsClient(session=, request_timeout=10, api_host='wbsapi.withings.net', _token='test', _close_session=False, refresh_token_function=None) async def test_get_sleep( responses: aioresponses, snapshot: SnapshotAssertion, authenticated_client: WithingsClient, ) -> None: """Test retrieving sleep.""" responses.post( f"{WITHINGS_URL}/v2/sleep", status=200, body=load_fixture("sleep.json"), ) > response = await authenticated_client.get_sleep( datetime.fromtimestamp(0, tz=timezone.utc), datetime.fromtimestamp(1609559200, tz=timezone.utc), [ SleepDataFields.HEART_RATE, SleepDataFields.RESPIRATION_RATE, SleepDataFields.SNORING, SleepDataFields.HEART_RATE_VARIABILITY, SleepDataFields.HEART_RATE_VARIABILITY_2, SleepDataFields.MOVEMENT_SCORE, ], ) tests/test_withings.py:479: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:217: in get_sleep response = await self._request( aiowithings/withings.py:108: in _request response = await self.session.request( /usr/lib/python3.12/unittest/mock.py:2302: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/v2/sleep'), args = () kwargs = {'data': {'action': 'get', 'data_fields': 'hr,rr,snoring,sdnn_1,rmssd,mvt_score', 'enddate': 1609559200, 'startdate': ...s': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/v2/sleep') url_str = 'https://wbsapi.withings.net/v2/sleep' key = ('POST', URL('https://wbsapi.withings.net/v2/sleep')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, *...startdate': 0, 'enddate': 1609559200, 'data_fields': 'hr,rr,snoring,sdnn_1,rmssd,mvt_score'}, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/v2/sleep /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError ______________________ test_get_sleep_without_data_fields ______________________ responses = snapshot = SnapshotAssertion(name='snapshot', num_executions=0) authenticated_client = WithingsClient(session=, request_timeout=10, api_host='wbsapi.withings.net', _token='test', _close_session=False, refresh_token_function=None) async def test_get_sleep_without_data_fields( responses: aioresponses, snapshot: SnapshotAssertion, authenticated_client: WithingsClient, ) -> None: """Test retrieving sleep without datafields.""" responses.post( f"{WITHINGS_URL}/v2/sleep", status=200, body=load_fixture("sleep_no_datafields.json"), ) > response = await authenticated_client.get_sleep( datetime.fromtimestamp(0, tz=timezone.utc), datetime.fromtimestamp(1609559200, tz=timezone.utc), ) tests/test_withings.py:516: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:217: in get_sleep response = await self._request( aiowithings/withings.py:108: in _request response = await self.session.request( /usr/lib/python3.12/unittest/mock.py:2302: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/v2/sleep'), args = () kwargs = {'data': {'action': 'get', 'enddate': 1609559200, 'startdate': 0}, 'headers': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/v2/sleep') url_str = 'https://wbsapi.withings.net/v2/sleep' key = ('POST', URL('https://wbsapi.withings.net/v2/sleep')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, *...orization': 'Bearer test'}, 'data': {'action': 'get', 'startdate': 0, 'enddate': 1609559200}, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/v2/sleep /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError _______________________ test_get_sleep_summary_in_period _______________________ responses = snapshot = SnapshotAssertion(name='snapshot', num_executions=0) authenticated_client = WithingsClient(session=, request_timeout=10, api_host='wbsapi.withings.net', _token='test', _close_session=False, refresh_token_function=None) async def test_get_sleep_summary_in_period( responses: aioresponses, snapshot: SnapshotAssertion, authenticated_client: WithingsClient, ) -> None: """Test retrieving sleep.""" responses.post( f"{WITHINGS_URL}/v2/sleep", status=200, body=load_fixture("sleep_summary.json"), ) > response = await authenticated_client.get_sleep_summary_in_period( start_date=datetime.fromtimestamp(0, tz=timezone.utc).date(), end_date=datetime.fromtimestamp(1609559200, tz=timezone.utc).date(), sleep_summary_data_fields=[ SleepSummaryDataFields.REM_SLEEP_PHASE_COUNT, SleepSummaryDataFields.SLEEP_EFFICIENCY, SleepSummaryDataFields.SLEEP_LATENCY, SleepSummaryDataFields.TOTAL_SLEEP_TIME, SleepSummaryDataFields.TOTAL_TIME_IN_BED, SleepSummaryDataFields.WAKE_UP_LATENCY, SleepSummaryDataFields.TIME_AWAKE_DURING_SLEEP, SleepSummaryDataFields.APNEA_HYPOPNEA_INDEX, SleepSummaryDataFields.BREATHING_DISTURBANCES_INTENSITY, SleepSummaryDataFields.EXTERNAL_TOTAL_SLEEP_TIME, SleepSummaryDataFields.DEEP_SLEEP_DURATION, SleepSummaryDataFields.AVERAGE_HEART_RATE, SleepSummaryDataFields.MIN_HEART_RATE, SleepSummaryDataFields.MAX_HEART_RATE, SleepSummaryDataFields.LIGHT_SLEEP_DURATION, SleepSummaryDataFields.ACTIVE_MOVEMENT_DURATION, SleepSummaryDataFields.AVERAGE_MOVEMENT_SCORE, SleepSummaryDataFields.NIGHT_EVENTS, SleepSummaryDataFields.OUT_OF_BED_COUNT, SleepSummaryDataFields.REM_SLEEP_DURATION, SleepSummaryDataFields.AVERAGE_RESPIRATION_RATE, SleepSummaryDataFields.MIN_RESPIRATION_RATE, SleepSummaryDataFields.MAX_RESPIRATION_RATE, SleepSummaryDataFields.SLEEP_SCORE, SleepSummaryDataFields.SNORING, SleepSummaryDataFields.SNORING_COUNT, SleepSummaryDataFields.WAKE_UP_COUNT, SleepSummaryDataFields.TOTAL_TIME_AWAKE, SleepSummaryDataFields.WITHINGS_INDEX, ], ) tests/test_withings.py:540: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:260: in get_sleep_summary_in_period return await self._get_sleep_summary( aiowithings/withings.py:236: in _get_sleep_summary response = await self._request( aiowithings/withings.py:108: in _request response = await self.session.request( /usr/lib/python3.12/unittest/mock.py:2302: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/v2/sleep'), args = () kwargs = {'data': {'action': 'getsummary', 'data_fields': 'nb_rem_episodes,sleep_efficiency,sleep_latency,total_sleep_time,tota...s': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/v2/sleep') url_str = 'https://wbsapi.withings.net/v2/sleep' key = ('POST', URL('https://wbsapi.withings.net/v2/sleep')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, *...n,rr_max,sleep_score,snoring,snoringepisodecount,wakeupcount,wakeupduration,withings_index'}, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/v2/sleep /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError _____________ test_get_sleep_summary_in_period_without_data_fields _____________ responses = snapshot = SnapshotAssertion(name='snapshot', num_executions=0) authenticated_client = WithingsClient(session=, request_timeout=10, api_host='wbsapi.withings.net', _token='test', _close_session=False, refresh_token_function=None) async def test_get_sleep_summary_in_period_without_data_fields( responses: aioresponses, snapshot: SnapshotAssertion, authenticated_client: WithingsClient, ) -> None: """Test retrieving sleep without datafields.""" responses.post( f"{WITHINGS_URL}/v2/sleep", status=200, body=load_fixture("sleep_summary_no_datafields.json"), ) > response = await authenticated_client.get_sleep_summary_in_period( start_date=datetime.fromtimestamp(0, tz=timezone.utc).date(), end_date=datetime.fromtimestamp(1609559200, tz=timezone.utc).date(), ) tests/test_withings.py:606: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:260: in get_sleep_summary_in_period return await self._get_sleep_summary( aiowithings/withings.py:236: in _get_sleep_summary response = await self._request( aiowithings/withings.py:108: in _request response = await self.session.request( /usr/lib/python3.12/unittest/mock.py:2302: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/v2/sleep'), args = () kwargs = {'data': {'action': 'getsummary', 'enddateymd': '2021-01-02', 'startdateymd': '1970-01-01'}, 'headers': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/v2/sleep') url_str = 'https://wbsapi.withings.net/v2/sleep' key = ('POST', URL('https://wbsapi.withings.net/v2/sleep')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, *..., 'data': {'startdateymd': '1970-01-01', 'enddateymd': '2021-01-02', 'action': 'getsummary'}, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/v2/sleep /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError _________________________ test_get_sleep_summary_since _________________________ responses = authenticated_client = WithingsClient(session=, request_timeout=10, api_host='wbsapi.withings.net', _token='test', _close_session=False, refresh_token_function=None) async def test_get_sleep_summary_since( responses: aioresponses, authenticated_client: WithingsClient, ) -> None: """Test retrieving sleep.""" responses.post( f"{WITHINGS_URL}/v2/sleep", status=200, body=load_fixture("sleep_summary.json"), ) > response = await authenticated_client.get_sleep_summary_since( sleep_summary_since=datetime.fromtimestamp(0, tz=timezone.utc), sleep_summary_data_fields=[ SleepSummaryDataFields.REM_SLEEP_PHASE_COUNT, SleepSummaryDataFields.SLEEP_EFFICIENCY, SleepSummaryDataFields.SLEEP_LATENCY, SleepSummaryDataFields.TOTAL_SLEEP_TIME, SleepSummaryDataFields.TOTAL_TIME_IN_BED, SleepSummaryDataFields.WAKE_UP_LATENCY, SleepSummaryDataFields.TIME_AWAKE_DURING_SLEEP, SleepSummaryDataFields.APNEA_HYPOPNEA_INDEX, SleepSummaryDataFields.BREATHING_DISTURBANCES_INTENSITY, SleepSummaryDataFields.EXTERNAL_TOTAL_SLEEP_TIME, SleepSummaryDataFields.DEEP_SLEEP_DURATION, SleepSummaryDataFields.AVERAGE_HEART_RATE, SleepSummaryDataFields.MIN_HEART_RATE, SleepSummaryDataFields.MAX_HEART_RATE, SleepSummaryDataFields.LIGHT_SLEEP_DURATION, SleepSummaryDataFields.ACTIVE_MOVEMENT_DURATION, SleepSummaryDataFields.AVERAGE_MOVEMENT_SCORE, SleepSummaryDataFields.NIGHT_EVENTS, SleepSummaryDataFields.OUT_OF_BED_COUNT, SleepSummaryDataFields.REM_SLEEP_DURATION, SleepSummaryDataFields.AVERAGE_RESPIRATION_RATE, SleepSummaryDataFields.MIN_RESPIRATION_RATE, SleepSummaryDataFields.MAX_RESPIRATION_RATE, SleepSummaryDataFields.SLEEP_SCORE, SleepSummaryDataFields.SNORING, SleepSummaryDataFields.SNORING_COUNT, SleepSummaryDataFields.WAKE_UP_COUNT, SleepSummaryDataFields.TOTAL_TIME_AWAKE, SleepSummaryDataFields.WITHINGS_INDEX, ], ) tests/test_withings.py:633: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:248: in get_sleep_summary_since return await self._get_sleep_summary( aiowithings/withings.py:236: in _get_sleep_summary response = await self._request( aiowithings/withings.py:108: in _request response = await self.session.request( /usr/lib/python3.12/unittest/mock.py:2302: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/v2/sleep'), args = () kwargs = {'data': {'action': 'getsummary', 'data_fields': 'nb_rem_episodes,sleep_efficiency,sleep_latency,total_sleep_time,tota...s': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/v2/sleep') url_str = 'https://wbsapi.withings.net/v2/sleep' key = ('POST', URL('https://wbsapi.withings.net/v2/sleep')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, *...n,rr_max,sleep_score,snoring,snoringepisodecount,wakeupcount,wakeupduration,withings_index'}, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/v2/sleep /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError _______________ test_get_sleep_summary_since_without_data_fields _______________ responses = authenticated_client = WithingsClient(session=, request_timeout=10, api_host='wbsapi.withings.net', _token='test', _close_session=False, refresh_token_function=None) async def test_get_sleep_summary_since_without_data_fields( responses: aioresponses, authenticated_client: WithingsClient, ) -> None: """Test retrieving sleep without datafields.""" responses.post( f"{WITHINGS_URL}/v2/sleep", status=200, body=load_fixture("sleep_summary_no_datafields.json"), ) > response = await authenticated_client.get_sleep_summary_since( datetime.fromtimestamp(0, tz=timezone.utc), ) tests/test_withings.py:696: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:248: in get_sleep_summary_since return await self._get_sleep_summary( aiowithings/withings.py:236: in _get_sleep_summary response = await self._request( aiowithings/withings.py:108: in _request response = await self.session.request( /usr/lib/python3.12/unittest/mock.py:2302: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/v2/sleep'), args = () kwargs = {'data': {'action': 'getsummary', 'lastupdate': 0}, 'headers': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/v2/sleep') url_str = 'https://wbsapi.withings.net/v2/sleep' key = ('POST', URL('https://wbsapi.withings.net/v2/sleep')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test'}, 'data': {'lastupdate': 0, 'action': 'getsummary'}, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/v2/sleep /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError ___________________________ test_get_workouts_since ____________________________ responses = snapshot = SnapshotAssertion(name='snapshot', num_executions=0) authenticated_client = WithingsClient(session=, request_timeout=10, api_host='wbsapi.withings.net', _token='test', _close_session=False, refresh_token_function=None) async def test_get_workouts_since( responses: aioresponses, snapshot: SnapshotAssertion, authenticated_client: WithingsClient, ) -> None: """Test retrieving workouts.""" responses.post( f"{WITHINGS_URL}/v2/measure", status=200, body=load_fixture("workouts.json"), ) > response = await authenticated_client.get_workouts_since( datetime.fromtimestamp(0, tz=timezone.utc), workout_data_fields=[WorkoutDataFields.CALORIES], ) tests/test_withings.py:722: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:329: in get_workouts_since return await self._get_workouts( aiowithings/withings.py:317: in _get_workouts response = await self._request( aiowithings/withings.py:108: in _request response = await self.session.request( /usr/lib/python3.12/unittest/mock.py:2302: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/v2/measure'), args = () kwargs = {'data': {'action': 'getworkouts', 'data_fields': 'calories', 'lastupdate': 0}, 'headers': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/v2/measure') url_str = 'https://wbsapi.withings.net/v2/measure' key = ('POST', URL('https://wbsapi.withings.net/v2/measure')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, *...Bearer test'}, 'data': {'lastupdate': 0, 'action': 'getworkouts', 'data_fields': 'calories'}, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/v2/measure /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError ___________________________ test_get_workouts_period ___________________________ responses = snapshot = SnapshotAssertion(name='snapshot', num_executions=0) authenticated_client = WithingsClient(session=, request_timeout=10, api_host='wbsapi.withings.net', _token='test', _close_session=False, refresh_token_function=None) async def test_get_workouts_period( responses: aioresponses, snapshot: SnapshotAssertion, authenticated_client: WithingsClient, ) -> None: """Test retrieving workouts.""" responses.post( f"{WITHINGS_URL}/v2/measure", status=200, body=load_fixture("workouts.json"), ) > response = await authenticated_client.get_workouts_in_period( start_date=datetime.fromtimestamp(0, tz=timezone.utc), end_date=datetime.fromtimestamp(1609559200, tz=timezone.utc), ) tests/test_withings.py:746: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:341: in get_workouts_in_period return await self._get_workouts( aiowithings/withings.py:317: in _get_workouts response = await self._request( aiowithings/withings.py:108: in _request response = await self.session.request( /usr/lib/python3.12/unittest/mock.py:2302: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/v2/measure'), args = () kwargs = {'data': {'action': 'getworkouts', 'enddateymd': '2021-01-02 03:46:40+00:00', 'startdateymd': '1970-01-01 00:00:00+00:...s': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/v2/measure') url_str = 'https://wbsapi.withings.net/v2/measure' key = ('POST', URL('https://wbsapi.withings.net/v2/measure')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, *...0-01-01 00:00:00+00:00', 'enddateymd': '2021-01-02 03:46:40+00:00', 'action': 'getworkouts'}, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/v2/measure /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError ---------- coverage: platform linux, python 3.12.9-final-0 ----------- Name Stmts Miss Branch BrPart Cover Missing --------------------------------------------------------------------- aiowithings/models.py 563 79 94 0 82% 115-127, 149-154, 407, 450, 463-465, 516, 720-736, 876-926 aiowithings/util.py 16 3 0 0 81% 20-26 aiowithings/withings.py 132 35 40 1 69% 115-147, 152, 157, 170, 221, 240, 282, 321, 375 --------------------------------------------------------------------- TOTAL 761 117 152 1 81% 4 files skipped due to complete coverage. FAIL Required test coverage of 100% not reached. Total coverage: 80.72% --------------------------- snapshot report summary ---------------------------- 22 snapshots passed. 17 snapshots unused. Re-run pytest with --snapshot-update to delete unused snapshots. =========================== short test summary info ============================ FAILED tests/test_withings.py::test_putting_in_own_session - aiohttp.client_e... FAILED tests/test_withings.py::test_creating_own_session - aiohttp.client_exc... FAILED tests/test_withings.py::test_unexpected_server_response - aiohttp.clie... FAILED tests/test_withings.py::test_timeout - aiohttp.client_exceptions.Clien... FAILED tests/test_withings.py::test_error_codes[100-WithingsAuthenticationFailedError] FAILED tests/test_withings.py::test_error_codes[201-WithingsInvalidParamsError] FAILED tests/test_withings.py::test_error_codes[214-WithingsUnauthorizedError] FAILED tests/test_withings.py::test_error_codes[215-WithingsErrorOccurredError] FAILED tests/test_withings.py::test_error_codes[522-WithingsConnectionError] FAILED tests/test_withings.py::test_error_codes[524-WithingsBadStateError] - ... FAILED tests/test_withings.py::test_error_codes[601-WithingsTooManyRequestsError] FAILED tests/test_withings.py::test_error_codes[-1-WithingsUnknownStatusError] FAILED tests/test_withings.py::test_error_codes[None-WithingsUnknownStatusError] FAILED tests/test_withings.py::test_get_activities_since - aiohttp.client_exc... FAILED tests/test_withings.py::test_get_activities_period - aiohttp.client_ex... FAILED tests/test_withings.py::test_get_devices - aiohttp.client_exceptions.C... FAILED tests/test_withings.py::test_get_new_device - aiohttp.client_exception... FAILED tests/test_withings.py::test_get_goals[goals] - aiohttp.client_excepti... FAILED tests/test_withings.py::test_get_goals[goals_1] - aiohttp.client_excep... FAILED tests/test_withings.py::test_get_goals[goals_2] - aiohttp.client_excep... FAILED tests/test_withings.py::test_get_goals[no_goals] - aiohttp.client_exce... FAILED tests/test_withings.py::test_get_measurement_since - aiohttp.client_ex... FAILED tests/test_withings.py::test_get_measurement_period - aiohttp.client_e... FAILED tests/test_withings.py::test_subscribing - aiohttp.client_exceptions.C... FAILED tests/test_withings.py::test_revoking - aiohttp.client_exceptions.Clie... FAILED tests/test_withings.py::test_list_subscriptions - aiohttp.client_excep... FAILED tests/test_withings.py::test_list_all_subscriptions - aiohttp.client_e... FAILED tests/test_withings.py::test_get_sleep - aiohttp.client_exceptions.Cli... FAILED tests/test_withings.py::test_get_sleep_without_data_fields - aiohttp.c... FAILED tests/test_withings.py::test_get_sleep_summary_in_period - aiohttp.cli... FAILED tests/test_withings.py::test_get_sleep_summary_in_period_without_data_fields FAILED tests/test_withings.py::test_get_sleep_summary_since - aiohttp.client_... FAILED tests/test_withings.py::test_get_sleep_summary_since_without_data_fields FAILED tests/test_withings.py::test_get_workouts_since - aiohttp.client_excep... FAILED tests/test_withings.py::test_get_workouts_period - aiohttp.client_exce... ======================== 35 failed, 25 passed in 9.22s ========================= E: pybuild pybuild:389: test: plugin pyproject failed with: exit code=1: cd /build/reproducible-path/python-aiowithings-3.0.3/.pybuild/cpython3_3.12/build; python3.12 -m pytest -v tests I: pybuild base:311: cd /build/reproducible-path/python-aiowithings-3.0.3/.pybuild/cpython3_3.13/build; python3.13 -m pytest -v tests /usr/lib/python3/dist-packages/pytest_asyncio/plugin.py:207: PytestDeprecationWarning: The configuration option "asyncio_default_fixture_loop_scope" is unset. The event loop scope for asynchronous fixtures will default to the fixture caching scope. Future versions of pytest-asyncio will default the loop scope for asynchronous fixtures to function scope. Set the default fixture loop scope explicitly in order to avoid unexpected behavior in the future. Valid fixture loop scopes are: "function", "class", "module", "package", "session" warnings.warn(PytestDeprecationWarning(_DEFAULT_FIXTURE_LOOP_SCOPE_UNSET)) ============================= test session starts ============================== platform linux -- Python 3.13.2, pytest-8.3.4, pluggy-1.5.0 -- /usr/bin/python3.13 cachedir: .pytest_cache rootdir: /build/reproducible-path/python-aiowithings-3.0.3/.pybuild/cpython3_3.13/build configfile: pyproject.toml plugins: typeguard-4.4.1, cov-5.0.0, asyncio-0.25.1, syrupy-4.8.1 asyncio: mode=Mode.AUTO, asyncio_default_fixture_loop_scope=None collecting ... collected 60 items tests/test_helpers.py::test_aggregate_measurements PASSED [ 1%] tests/test_helpers.py::test_aggregate_positional_measurements PASSED [ 3%] tests/test_helpers.py::test_aggregate_sleep_summary PASSED [ 5%] tests/test_helpers.py::test_aggregate_single_sleep_summary PASSED [ 6%] tests/test_helpers.py::test_aggregate_no_sleep_summary PASSED [ 8%] tests/test_models.py::test_measurement_parsing[measurement_list.json] PASSED [ 10%] tests/test_models.py::test_measurement_parsing[measurement_list_2.json] PASSED [ 11%] tests/test_util.py::test_measurement PASSED [ 13%] tests/test_util.py::test_measurement_from_dict PASSED [ 15%] tests/test_withings.py::test_putting_in_own_session FAILED [ 16%] tests/test_withings.py::test_creating_own_session FAILED [ 18%] tests/test_withings.py::test_refresh_token PASSED [ 20%] tests/test_withings.py::test_unexpected_server_response FAILED [ 21%] tests/test_withings.py::test_timeout FAILED [ 23%] tests/test_withings.py::test_error_codes[100-WithingsAuthenticationFailedError] FAILED [ 25%] tests/test_withings.py::test_error_codes[201-WithingsInvalidParamsError] FAILED [ 26%] tests/test_withings.py::test_error_codes[214-WithingsUnauthorizedError] FAILED [ 28%] tests/test_withings.py::test_error_codes[215-WithingsErrorOccurredError] FAILED [ 30%] tests/test_withings.py::test_error_codes[522-WithingsConnectionError] FAILED [ 31%] tests/test_withings.py::test_error_codes[524-WithingsBadStateError] FAILED [ 33%] tests/test_withings.py::test_error_codes[601-WithingsTooManyRequestsError] FAILED [ 35%] tests/test_withings.py::test_error_codes[-1-WithingsUnknownStatusError] FAILED [ 36%] tests/test_withings.py::test_error_codes[None-WithingsUnknownStatusError] FAILED [ 38%] tests/test_withings.py::test_get_activities_since FAILED [ 40%] tests/test_withings.py::test_get_activities_period FAILED [ 41%] tests/test_withings.py::test_get_devices FAILED [ 43%] tests/test_withings.py::test_get_new_device FAILED [ 45%] tests/test_withings.py::test_get_goals[goals] FAILED [ 46%] tests/test_withings.py::test_get_goals[goals_1] FAILED [ 48%] tests/test_withings.py::test_get_goals[goals_2] FAILED [ 50%] tests/test_withings.py::test_get_goals[no_goals] FAILED [ 51%] tests/test_withings.py::test_get_measurement_since FAILED [ 53%] tests/test_withings.py::test_get_measurement_period FAILED [ 55%] tests/test_withings.py::test_subscribing FAILED [ 56%] tests/test_withings.py::test_revoking FAILED [ 58%] tests/test_withings.py::test_list_subscriptions FAILED [ 60%] tests/test_withings.py::test_list_all_subscriptions FAILED [ 61%] tests/test_withings.py::test_measurement_points_to_get[UNKNOWN] PASSED [ 63%] tests/test_withings.py::test_measurement_points_to_get[WEIGHT] PASSED [ 65%] tests/test_withings.py::test_measurement_points_to_get[TEMPERATURE] PASSED [ 66%] tests/test_withings.py::test_measurement_points_to_get[PRESSURE] PASSED [ 68%] tests/test_withings.py::test_measurement_points_to_get[ACTIVITY] PASSED [ 70%] tests/test_withings.py::test_measurement_points_to_get[SLEEP] PASSED [ 71%] tests/test_withings.py::test_measurement_points_to_get[USER_DATA] PASSED [ 73%] tests/test_withings.py::test_measurement_points_to_get[IN_BED] PASSED [ 75%] tests/test_withings.py::test_measurement_points_to_get[OUT_BED] PASSED [ 76%] tests/test_withings.py::test_measurement_points_to_get[INITIAL_INFLATION_DONE] PASSED [ 78%] tests/test_withings.py::test_measurement_points_to_get[NO_ACCOUNT_ASSOCIATED] PASSED [ 80%] tests/test_withings.py::test_measurement_points_to_get[ECG] PASSED [ 81%] tests/test_withings.py::test_measurement_points_to_get[ECG_FAILED] PASSED [ 83%] tests/test_withings.py::test_measurement_points_to_get[GLUCOSE] PASSED [ 85%] tests/test_withings.py::test_webhook_object PASSED [ 86%] tests/test_withings.py::test_get_sleep FAILED [ 88%] tests/test_withings.py::test_get_sleep_without_data_fields FAILED [ 90%] tests/test_withings.py::test_get_sleep_summary_in_period FAILED [ 91%] tests/test_withings.py::test_get_sleep_summary_in_period_without_data_fields FAILED [ 93%] tests/test_withings.py::test_get_sleep_summary_since FAILED [ 95%] tests/test_withings.py::test_get_sleep_summary_since_without_data_fields FAILED [ 96%] tests/test_withings.py::test_get_workouts_since FAILED [ 98%] tests/test_withings.py::test_get_workouts_period FAILED [100%] =================================== FAILURES =================================== _________________________ test_putting_in_own_session __________________________ responses = async def test_putting_in_own_session( responses: aioresponses, ) -> None: """Test putting in own session.""" responses.post( f"{WITHINGS_URL}/v2/user", status=200, body=load_fixture("device.json"), ) async with aiohttp.ClientSession() as session: withings = WithingsClient(session=session) withings.authenticate("test") > await withings.get_devices() tests/test_withings.py:55: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:151: in get_devices response = await self._request("v2/user", data={"action": "getdevice"}) aiowithings/withings.py:108: in _request response = await self.session.request( :3: in _request ??? /usr/lib/python3.13/unittest/mock.py:2330: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/v2/user'), args = () kwargs = {'data': {'action': 'getdevice'}, 'headers': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/v2/user') url_str = 'https://wbsapi.withings.net/v2/user' key = ('POST', URL('https://wbsapi.withings.net/v2/user')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test'}, 'data': {'action': 'getdevice'}, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/v2/user /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError __________________________ test_creating_own_session ___________________________ responses = async def test_creating_own_session( responses: aioresponses, ) -> None: """Test creating own session.""" responses.post( f"{WITHINGS_URL}/v2/user", status=200, body=load_fixture("device.json"), ) withings = WithingsClient() withings.authenticate("test") > await withings.get_devices() tests/test_withings.py:73: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:151: in get_devices response = await self._request("v2/user", data={"action": "getdevice"}) aiowithings/withings.py:108: in _request response = await self.session.request( :3: in _request ??? /usr/lib/python3.13/unittest/mock.py:2330: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/v2/user'), args = () kwargs = {'data': {'action': 'getdevice'}, 'headers': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/v2/user') url_str = 'https://wbsapi.withings.net/v2/user' key = ('POST', URL('https://wbsapi.withings.net/v2/user')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test'}, 'data': {'action': 'getdevice'}, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/v2/user /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError _______________________ test_unexpected_server_response ________________________ responses = authenticated_client = WithingsClient(session=, request_timeout=10, api_host='wbsapi.withings.net', _token='test', _close_session=False, refresh_token_function=None) async def test_unexpected_server_response( responses: aioresponses, authenticated_client: WithingsClient, ) -> None: """Test handling unexpected response.""" responses.post( f"{WITHINGS_URL}/v2/user", status=200, headers={"Content-Type": "plain/text"}, body="Yes", ) with pytest.raises(WithingsError): > assert await authenticated_client.get_devices() tests/test_withings.py:109: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:151: in get_devices response = await self._request("v2/user", data={"action": "getdevice"}) aiowithings/withings.py:108: in _request response = await self.session.request( :3: in _request ??? /usr/lib/python3.13/unittest/mock.py:2330: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/v2/user'), args = () kwargs = {'data': {'action': 'getdevice'}, 'headers': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/v2/user') url_str = 'https://wbsapi.withings.net/v2/user' key = ('POST', URL('https://wbsapi.withings.net/v2/user')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test'}, 'data': {'action': 'getdevice'}, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/v2/user /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError _________________________________ test_timeout _________________________________ responses = async def test_timeout( responses: aioresponses, ) -> None: """Test request timeout.""" # Faking a timeout by sleeping async def response_handler(_: str, **_kwargs: Any) -> CallbackResult: """Response handler for this test.""" await asyncio.sleep(2) return CallbackResult(body="Goodmorning!") responses.post( f"{WITHINGS_URL}/v2/user", callback=response_handler, ) async with WithingsClient(request_timeout=1) as withings: with pytest.raises(WithingsConnectionError): > assert await withings.get_devices() tests/test_withings.py:129: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:151: in get_devices response = await self._request("v2/user", data={"action": "getdevice"}) aiowithings/withings.py:108: in _request response = await self.session.request( :3: in _request ??? /usr/lib/python3.13/unittest/mock.py:2330: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/v2/user'), args = () kwargs = {'data': {'action': 'getdevice'}, 'headers': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer None', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/v2/user') url_str = 'https://wbsapi.withings.net/v2/user' key = ('POST', URL('https://wbsapi.withings.net/v2/user')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer None'}, 'data': {'action': 'getdevice'}, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/v2/user /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError ___________ test_error_codes[100-WithingsAuthenticationFailedError] ____________ responses = authenticated_client = WithingsClient(session=, request_timeout=10, api_host='wbsapi.withings.net', _token='test', _close_session=False, refresh_token_function=None) status = 100 error = @pytest.mark.parametrize( ("status", "error"), [ (100, WithingsAuthenticationFailedError), (201, WithingsInvalidParamsError), (214, WithingsUnauthorizedError), (215, WithingsErrorOccurredError), (522, WithingsConnectionError), (524, WithingsBadStateError), (601, WithingsTooManyRequestsError), (-1, WithingsUnknownStatusError), (None, WithingsUnknownStatusError), ], ) async def test_error_codes( responses: aioresponses, authenticated_client: WithingsClient, status: int | None, error: type[Exception], ) -> None: """Test error codes from withings.""" response_data = json.loads(load_fixture("device.json")) response_data["status"] = status responses.post( f"{WITHINGS_URL}/v2/user", status=200, body=json.dumps(response_data), ) with pytest.raises(error): > assert await authenticated_client.get_devices() tests/test_withings.py:162: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:151: in get_devices response = await self._request("v2/user", data={"action": "getdevice"}) aiowithings/withings.py:108: in _request response = await self.session.request( :3: in _request ??? /usr/lib/python3.13/unittest/mock.py:2330: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/v2/user'), args = () kwargs = {'data': {'action': 'getdevice'}, 'headers': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/v2/user') url_str = 'https://wbsapi.withings.net/v2/user' key = ('POST', URL('https://wbsapi.withings.net/v2/user')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test'}, 'data': {'action': 'getdevice'}, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/v2/user /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError _______________ test_error_codes[201-WithingsInvalidParamsError] _______________ responses = authenticated_client = WithingsClient(session=, request_timeout=10, api_host='wbsapi.withings.net', _token='test', _close_session=False, refresh_token_function=None) status = 201 error = @pytest.mark.parametrize( ("status", "error"), [ (100, WithingsAuthenticationFailedError), (201, WithingsInvalidParamsError), (214, WithingsUnauthorizedError), (215, WithingsErrorOccurredError), (522, WithingsConnectionError), (524, WithingsBadStateError), (601, WithingsTooManyRequestsError), (-1, WithingsUnknownStatusError), (None, WithingsUnknownStatusError), ], ) async def test_error_codes( responses: aioresponses, authenticated_client: WithingsClient, status: int | None, error: type[Exception], ) -> None: """Test error codes from withings.""" response_data = json.loads(load_fixture("device.json")) response_data["status"] = status responses.post( f"{WITHINGS_URL}/v2/user", status=200, body=json.dumps(response_data), ) with pytest.raises(error): > assert await authenticated_client.get_devices() tests/test_withings.py:162: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:151: in get_devices response = await self._request("v2/user", data={"action": "getdevice"}) aiowithings/withings.py:108: in _request response = await self.session.request( :3: in _request ??? /usr/lib/python3.13/unittest/mock.py:2330: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/v2/user'), args = () kwargs = {'data': {'action': 'getdevice'}, 'headers': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/v2/user') url_str = 'https://wbsapi.withings.net/v2/user' key = ('POST', URL('https://wbsapi.withings.net/v2/user')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test'}, 'data': {'action': 'getdevice'}, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/v2/user /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError _______________ test_error_codes[214-WithingsUnauthorizedError] ________________ responses = authenticated_client = WithingsClient(session=, request_timeout=10, api_host='wbsapi.withings.net', _token='test', _close_session=False, refresh_token_function=None) status = 214, error = @pytest.mark.parametrize( ("status", "error"), [ (100, WithingsAuthenticationFailedError), (201, WithingsInvalidParamsError), (214, WithingsUnauthorizedError), (215, WithingsErrorOccurredError), (522, WithingsConnectionError), (524, WithingsBadStateError), (601, WithingsTooManyRequestsError), (-1, WithingsUnknownStatusError), (None, WithingsUnknownStatusError), ], ) async def test_error_codes( responses: aioresponses, authenticated_client: WithingsClient, status: int | None, error: type[Exception], ) -> None: """Test error codes from withings.""" response_data = json.loads(load_fixture("device.json")) response_data["status"] = status responses.post( f"{WITHINGS_URL}/v2/user", status=200, body=json.dumps(response_data), ) with pytest.raises(error): > assert await authenticated_client.get_devices() tests/test_withings.py:162: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:151: in get_devices response = await self._request("v2/user", data={"action": "getdevice"}) aiowithings/withings.py:108: in _request response = await self.session.request( :3: in _request ??? /usr/lib/python3.13/unittest/mock.py:2330: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/v2/user'), args = () kwargs = {'data': {'action': 'getdevice'}, 'headers': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/v2/user') url_str = 'https://wbsapi.withings.net/v2/user' key = ('POST', URL('https://wbsapi.withings.net/v2/user')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test'}, 'data': {'action': 'getdevice'}, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/v2/user /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError _______________ test_error_codes[215-WithingsErrorOccurredError] _______________ responses = authenticated_client = WithingsClient(session=, request_timeout=10, api_host='wbsapi.withings.net', _token='test', _close_session=False, refresh_token_function=None) status = 215 error = @pytest.mark.parametrize( ("status", "error"), [ (100, WithingsAuthenticationFailedError), (201, WithingsInvalidParamsError), (214, WithingsUnauthorizedError), (215, WithingsErrorOccurredError), (522, WithingsConnectionError), (524, WithingsBadStateError), (601, WithingsTooManyRequestsError), (-1, WithingsUnknownStatusError), (None, WithingsUnknownStatusError), ], ) async def test_error_codes( responses: aioresponses, authenticated_client: WithingsClient, status: int | None, error: type[Exception], ) -> None: """Test error codes from withings.""" response_data = json.loads(load_fixture("device.json")) response_data["status"] = status responses.post( f"{WITHINGS_URL}/v2/user", status=200, body=json.dumps(response_data), ) with pytest.raises(error): > assert await authenticated_client.get_devices() tests/test_withings.py:162: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:151: in get_devices response = await self._request("v2/user", data={"action": "getdevice"}) aiowithings/withings.py:108: in _request response = await self.session.request( :3: in _request ??? /usr/lib/python3.13/unittest/mock.py:2330: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/v2/user'), args = () kwargs = {'data': {'action': 'getdevice'}, 'headers': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/v2/user') url_str = 'https://wbsapi.withings.net/v2/user' key = ('POST', URL('https://wbsapi.withings.net/v2/user')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test'}, 'data': {'action': 'getdevice'}, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/v2/user /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError ________________ test_error_codes[522-WithingsConnectionError] _________________ responses = authenticated_client = WithingsClient(session=, request_timeout=10, api_host='wbsapi.withings.net', _token='test', _close_session=False, refresh_token_function=None) status = 522, error = @pytest.mark.parametrize( ("status", "error"), [ (100, WithingsAuthenticationFailedError), (201, WithingsInvalidParamsError), (214, WithingsUnauthorizedError), (215, WithingsErrorOccurredError), (522, WithingsConnectionError), (524, WithingsBadStateError), (601, WithingsTooManyRequestsError), (-1, WithingsUnknownStatusError), (None, WithingsUnknownStatusError), ], ) async def test_error_codes( responses: aioresponses, authenticated_client: WithingsClient, status: int | None, error: type[Exception], ) -> None: """Test error codes from withings.""" response_data = json.loads(load_fixture("device.json")) response_data["status"] = status responses.post( f"{WITHINGS_URL}/v2/user", status=200, body=json.dumps(response_data), ) with pytest.raises(error): > assert await authenticated_client.get_devices() tests/test_withings.py:162: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:151: in get_devices response = await self._request("v2/user", data={"action": "getdevice"}) aiowithings/withings.py:108: in _request response = await self.session.request( :3: in _request ??? /usr/lib/python3.13/unittest/mock.py:2330: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/v2/user'), args = () kwargs = {'data': {'action': 'getdevice'}, 'headers': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/v2/user') url_str = 'https://wbsapi.withings.net/v2/user' key = ('POST', URL('https://wbsapi.withings.net/v2/user')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test'}, 'data': {'action': 'getdevice'}, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/v2/user /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError _________________ test_error_codes[524-WithingsBadStateError] __________________ responses = authenticated_client = WithingsClient(session=, request_timeout=10, api_host='wbsapi.withings.net', _token='test', _close_session=False, refresh_token_function=None) status = 524, error = @pytest.mark.parametrize( ("status", "error"), [ (100, WithingsAuthenticationFailedError), (201, WithingsInvalidParamsError), (214, WithingsUnauthorizedError), (215, WithingsErrorOccurredError), (522, WithingsConnectionError), (524, WithingsBadStateError), (601, WithingsTooManyRequestsError), (-1, WithingsUnknownStatusError), (None, WithingsUnknownStatusError), ], ) async def test_error_codes( responses: aioresponses, authenticated_client: WithingsClient, status: int | None, error: type[Exception], ) -> None: """Test error codes from withings.""" response_data = json.loads(load_fixture("device.json")) response_data["status"] = status responses.post( f"{WITHINGS_URL}/v2/user", status=200, body=json.dumps(response_data), ) with pytest.raises(error): > assert await authenticated_client.get_devices() tests/test_withings.py:162: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:151: in get_devices response = await self._request("v2/user", data={"action": "getdevice"}) aiowithings/withings.py:108: in _request response = await self.session.request( :3: in _request ??? /usr/lib/python3.13/unittest/mock.py:2330: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/v2/user'), args = () kwargs = {'data': {'action': 'getdevice'}, 'headers': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/v2/user') url_str = 'https://wbsapi.withings.net/v2/user' key = ('POST', URL('https://wbsapi.withings.net/v2/user')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test'}, 'data': {'action': 'getdevice'}, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/v2/user /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError ______________ test_error_codes[601-WithingsTooManyRequestsError] ______________ responses = authenticated_client = WithingsClient(session=, request_timeout=10, api_host='wbsapi.withings.net', _token='test', _close_session=False, refresh_token_function=None) status = 601 error = @pytest.mark.parametrize( ("status", "error"), [ (100, WithingsAuthenticationFailedError), (201, WithingsInvalidParamsError), (214, WithingsUnauthorizedError), (215, WithingsErrorOccurredError), (522, WithingsConnectionError), (524, WithingsBadStateError), (601, WithingsTooManyRequestsError), (-1, WithingsUnknownStatusError), (None, WithingsUnknownStatusError), ], ) async def test_error_codes( responses: aioresponses, authenticated_client: WithingsClient, status: int | None, error: type[Exception], ) -> None: """Test error codes from withings.""" response_data = json.loads(load_fixture("device.json")) response_data["status"] = status responses.post( f"{WITHINGS_URL}/v2/user", status=200, body=json.dumps(response_data), ) with pytest.raises(error): > assert await authenticated_client.get_devices() tests/test_withings.py:162: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:151: in get_devices response = await self._request("v2/user", data={"action": "getdevice"}) aiowithings/withings.py:108: in _request response = await self.session.request( :3: in _request ??? /usr/lib/python3.13/unittest/mock.py:2330: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/v2/user'), args = () kwargs = {'data': {'action': 'getdevice'}, 'headers': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/v2/user') url_str = 'https://wbsapi.withings.net/v2/user' key = ('POST', URL('https://wbsapi.withings.net/v2/user')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test'}, 'data': {'action': 'getdevice'}, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/v2/user /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError _______________ test_error_codes[-1-WithingsUnknownStatusError] ________________ responses = authenticated_client = WithingsClient(session=, request_timeout=10, api_host='wbsapi.withings.net', _token='test', _close_session=False, refresh_token_function=None) status = -1, error = @pytest.mark.parametrize( ("status", "error"), [ (100, WithingsAuthenticationFailedError), (201, WithingsInvalidParamsError), (214, WithingsUnauthorizedError), (215, WithingsErrorOccurredError), (522, WithingsConnectionError), (524, WithingsBadStateError), (601, WithingsTooManyRequestsError), (-1, WithingsUnknownStatusError), (None, WithingsUnknownStatusError), ], ) async def test_error_codes( responses: aioresponses, authenticated_client: WithingsClient, status: int | None, error: type[Exception], ) -> None: """Test error codes from withings.""" response_data = json.loads(load_fixture("device.json")) response_data["status"] = status responses.post( f"{WITHINGS_URL}/v2/user", status=200, body=json.dumps(response_data), ) with pytest.raises(error): > assert await authenticated_client.get_devices() tests/test_withings.py:162: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:151: in get_devices response = await self._request("v2/user", data={"action": "getdevice"}) aiowithings/withings.py:108: in _request response = await self.session.request( :3: in _request ??? /usr/lib/python3.13/unittest/mock.py:2330: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/v2/user'), args = () kwargs = {'data': {'action': 'getdevice'}, 'headers': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/v2/user') url_str = 'https://wbsapi.withings.net/v2/user' key = ('POST', URL('https://wbsapi.withings.net/v2/user')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test'}, 'data': {'action': 'getdevice'}, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/v2/user /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError ______________ test_error_codes[None-WithingsUnknownStatusError] _______________ responses = authenticated_client = WithingsClient(session=, request_timeout=10, api_host='wbsapi.withings.net', _token='test', _close_session=False, refresh_token_function=None) status = None error = @pytest.mark.parametrize( ("status", "error"), [ (100, WithingsAuthenticationFailedError), (201, WithingsInvalidParamsError), (214, WithingsUnauthorizedError), (215, WithingsErrorOccurredError), (522, WithingsConnectionError), (524, WithingsBadStateError), (601, WithingsTooManyRequestsError), (-1, WithingsUnknownStatusError), (None, WithingsUnknownStatusError), ], ) async def test_error_codes( responses: aioresponses, authenticated_client: WithingsClient, status: int | None, error: type[Exception], ) -> None: """Test error codes from withings.""" response_data = json.loads(load_fixture("device.json")) response_data["status"] = status responses.post( f"{WITHINGS_URL}/v2/user", status=200, body=json.dumps(response_data), ) with pytest.raises(error): > assert await authenticated_client.get_devices() tests/test_withings.py:162: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:151: in get_devices response = await self._request("v2/user", data={"action": "getdevice"}) aiowithings/withings.py:108: in _request response = await self.session.request( :3: in _request ??? /usr/lib/python3.13/unittest/mock.py:2330: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/v2/user'), args = () kwargs = {'data': {'action': 'getdevice'}, 'headers': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/v2/user') url_str = 'https://wbsapi.withings.net/v2/user' key = ('POST', URL('https://wbsapi.withings.net/v2/user')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test'}, 'data': {'action': 'getdevice'}, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/v2/user /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError __________________________ test_get_activities_since ___________________________ responses = snapshot = SnapshotAssertion(name='snapshot', num_executions=0) authenticated_client = WithingsClient(session=, request_timeout=10, api_host='wbsapi.withings.net', _token='test', _close_session=False, refresh_token_function=None) async def test_get_activities_since( responses: aioresponses, snapshot: SnapshotAssertion, authenticated_client: WithingsClient, ) -> None: """Test retrieving activities.""" responses.post( f"{WITHINGS_URL}/v2/measure", status=200, body=load_fixture("activity.json"), ) > response = await authenticated_client.get_activities_since( datetime.fromtimestamp(1609559200, tz=timezone.utc), activity_data_fields=[ActivityDataFields.DISTANCE], ) tests/test_withings.py:176: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:290: in get_activities_since return await self._get_activities( aiowithings/withings.py:278: in _get_activities response = await self._request( aiowithings/withings.py:108: in _request response = await self.session.request( :3: in _request ??? /usr/lib/python3.13/unittest/mock.py:2330: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/v2/measure'), args = () kwargs = {'data': {'action': 'getactivity', 'data_fields': 'distance', 'lastupdate': 1609559200}, 'headers': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/v2/measure') url_str = 'https://wbsapi.withings.net/v2/measure' key = ('POST', URL('https://wbsapi.withings.net/v2/measure')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, *...st'}, 'data': {'lastupdate': 1609559200, 'action': 'getactivity', 'data_fields': 'distance'}, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/v2/measure /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError __________________________ test_get_activities_period __________________________ responses = snapshot = SnapshotAssertion(name='snapshot', num_executions=0) authenticated_client = WithingsClient(session=, request_timeout=10, api_host='wbsapi.withings.net', _token='test', _close_session=False, refresh_token_function=None) async def test_get_activities_period( responses: aioresponses, snapshot: SnapshotAssertion, authenticated_client: WithingsClient, ) -> None: """Test retrieving activities.""" responses.post( f"{WITHINGS_URL}/v2/measure", status=200, body=load_fixture("activity.json"), ) > response = await authenticated_client.get_activities_in_period( start_date=datetime.fromtimestamp(1609459200, tz=timezone.utc), end_date=datetime.fromtimestamp(1609559200, tz=timezone.utc), ) tests/test_withings.py:204: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:302: in get_activities_in_period return await self._get_activities( aiowithings/withings.py:278: in _get_activities response = await self._request( aiowithings/withings.py:108: in _request response = await self.session.request( :3: in _request ??? /usr/lib/python3.13/unittest/mock.py:2330: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/v2/measure'), args = () kwargs = {'data': {'action': 'getactivity', 'enddateymd': '2021-01-02 03:46:40+00:00', 'startdateymd': '2021-01-01 00:00:00+00:...s': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/v2/measure') url_str = 'https://wbsapi.withings.net/v2/measure' key = ('POST', URL('https://wbsapi.withings.net/v2/measure')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, *...1-01-01 00:00:00+00:00', 'enddateymd': '2021-01-02 03:46:40+00:00', 'action': 'getactivity'}, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/v2/measure /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError _______________________________ test_get_devices _______________________________ responses = snapshot = SnapshotAssertion(name='snapshot', num_executions=0) authenticated_client = WithingsClient(session=, request_timeout=10, api_host='wbsapi.withings.net', _token='test', _close_session=False, refresh_token_function=None) async def test_get_devices( responses: aioresponses, snapshot: SnapshotAssertion, authenticated_client: WithingsClient, ) -> None: """Test retrieving devices.""" responses.post( f"{WITHINGS_URL}/v2/user", status=200, body=load_fixture("device.json"), ) > response = await authenticated_client.get_devices() tests/test_withings.py:232: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:151: in get_devices response = await self._request("v2/user", data={"action": "getdevice"}) aiowithings/withings.py:108: in _request response = await self.session.request( :3: in _request ??? /usr/lib/python3.13/unittest/mock.py:2330: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/v2/user'), args = () kwargs = {'data': {'action': 'getdevice'}, 'headers': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/v2/user') url_str = 'https://wbsapi.withings.net/v2/user' key = ('POST', URL('https://wbsapi.withings.net/v2/user')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test'}, 'data': {'action': 'getdevice'}, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/v2/user /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError _____________________________ test_get_new_device ______________________________ responses = snapshot = SnapshotAssertion(name='snapshot', num_executions=0) authenticated_client = WithingsClient(session=, request_timeout=10, api_host='wbsapi.withings.net', _token='test', _close_session=False, refresh_token_function=None) caplog = <_pytest.logging.LogCaptureFixture object at 0xf5ef3760> async def test_get_new_device( responses: aioresponses, snapshot: SnapshotAssertion, authenticated_client: WithingsClient, caplog: pytest.LogCaptureFixture, ) -> None: """Test retrieving devices that aren't known yet.""" responses.post( f"{WITHINGS_URL}/v2/user", status=200, body=load_fixture("new_device.json"), ) > response = await authenticated_client.get_devices() tests/test_withings.py:254: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:151: in get_devices response = await self._request("v2/user", data={"action": "getdevice"}) aiowithings/withings.py:108: in _request response = await self.session.request( :3: in _request ??? /usr/lib/python3.13/unittest/mock.py:2330: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/v2/user'), args = () kwargs = {'data': {'action': 'getdevice'}, 'headers': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/v2/user') url_str = 'https://wbsapi.withings.net/v2/user' key = ('POST', URL('https://wbsapi.withings.net/v2/user')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test'}, 'data': {'action': 'getdevice'}, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/v2/user /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError ____________________________ test_get_goals[goals] _____________________________ responses = snapshot = SnapshotAssertion(name='snapshot', num_executions=0) authenticated_client = WithingsClient(session=, request_timeout=10, api_host='wbsapi.withings.net', _token='test', _close_session=False, refresh_token_function=None) fixture = 'goals' @pytest.mark.parametrize( "fixture", [ "goals", "goals_1", "goals_2", "no_goals", ], ) async def test_get_goals( responses: aioresponses, snapshot: SnapshotAssertion, authenticated_client: WithingsClient, fixture: str, ) -> None: """Test retrieving goals.""" responses.post( f"{WITHINGS_URL}/v2/user", status=200, body=load_fixture(f"{fixture}.json"), ) > response = await authenticated_client.get_goals() tests/test_withings.py:288: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:156: in get_goals response = await self._request("v2/user", data={"action": "getgoals"}) aiowithings/withings.py:108: in _request response = await self.session.request( :3: in _request ??? /usr/lib/python3.13/unittest/mock.py:2330: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/v2/user'), args = () kwargs = {'data': {'action': 'getgoals'}, 'headers': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/v2/user') url_str = 'https://wbsapi.withings.net/v2/user' key = ('POST', URL('https://wbsapi.withings.net/v2/user')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test'}, 'data': {'action': 'getgoals'}, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/v2/user /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError ___________________________ test_get_goals[goals_1] ____________________________ responses = snapshot = SnapshotAssertion(name='snapshot', num_executions=0) authenticated_client = WithingsClient(session=, request_timeout=10, api_host='wbsapi.withings.net', _token='test', _close_session=False, refresh_token_function=None) fixture = 'goals_1' @pytest.mark.parametrize( "fixture", [ "goals", "goals_1", "goals_2", "no_goals", ], ) async def test_get_goals( responses: aioresponses, snapshot: SnapshotAssertion, authenticated_client: WithingsClient, fixture: str, ) -> None: """Test retrieving goals.""" responses.post( f"{WITHINGS_URL}/v2/user", status=200, body=load_fixture(f"{fixture}.json"), ) > response = await authenticated_client.get_goals() tests/test_withings.py:288: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:156: in get_goals response = await self._request("v2/user", data={"action": "getgoals"}) aiowithings/withings.py:108: in _request response = await self.session.request( :3: in _request ??? /usr/lib/python3.13/unittest/mock.py:2330: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/v2/user'), args = () kwargs = {'data': {'action': 'getgoals'}, 'headers': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/v2/user') url_str = 'https://wbsapi.withings.net/v2/user' key = ('POST', URL('https://wbsapi.withings.net/v2/user')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test'}, 'data': {'action': 'getgoals'}, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/v2/user /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError ___________________________ test_get_goals[goals_2] ____________________________ responses = snapshot = SnapshotAssertion(name='snapshot', num_executions=0) authenticated_client = WithingsClient(session=, request_timeout=10, api_host='wbsapi.withings.net', _token='test', _close_session=False, refresh_token_function=None) fixture = 'goals_2' @pytest.mark.parametrize( "fixture", [ "goals", "goals_1", "goals_2", "no_goals", ], ) async def test_get_goals( responses: aioresponses, snapshot: SnapshotAssertion, authenticated_client: WithingsClient, fixture: str, ) -> None: """Test retrieving goals.""" responses.post( f"{WITHINGS_URL}/v2/user", status=200, body=load_fixture(f"{fixture}.json"), ) > response = await authenticated_client.get_goals() tests/test_withings.py:288: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:156: in get_goals response = await self._request("v2/user", data={"action": "getgoals"}) aiowithings/withings.py:108: in _request response = await self.session.request( :3: in _request ??? /usr/lib/python3.13/unittest/mock.py:2330: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/v2/user'), args = () kwargs = {'data': {'action': 'getgoals'}, 'headers': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/v2/user') url_str = 'https://wbsapi.withings.net/v2/user' key = ('POST', URL('https://wbsapi.withings.net/v2/user')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test'}, 'data': {'action': 'getgoals'}, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/v2/user /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError ___________________________ test_get_goals[no_goals] ___________________________ responses = snapshot = SnapshotAssertion(name='snapshot', num_executions=0) authenticated_client = WithingsClient(session=, request_timeout=10, api_host='wbsapi.withings.net', _token='test', _close_session=False, refresh_token_function=None) fixture = 'no_goals' @pytest.mark.parametrize( "fixture", [ "goals", "goals_1", "goals_2", "no_goals", ], ) async def test_get_goals( responses: aioresponses, snapshot: SnapshotAssertion, authenticated_client: WithingsClient, fixture: str, ) -> None: """Test retrieving goals.""" responses.post( f"{WITHINGS_URL}/v2/user", status=200, body=load_fixture(f"{fixture}.json"), ) > response = await authenticated_client.get_goals() tests/test_withings.py:288: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:156: in get_goals response = await self._request("v2/user", data={"action": "getgoals"}) aiowithings/withings.py:108: in _request response = await self.session.request( :3: in _request ??? /usr/lib/python3.13/unittest/mock.py:2330: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/v2/user'), args = () kwargs = {'data': {'action': 'getgoals'}, 'headers': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/v2/user') url_str = 'https://wbsapi.withings.net/v2/user' key = ('POST', URL('https://wbsapi.withings.net/v2/user')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test'}, 'data': {'action': 'getgoals'}, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/v2/user /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError __________________________ test_get_measurement_since __________________________ responses = snapshot = SnapshotAssertion(name='snapshot', num_executions=0) authenticated_client = WithingsClient(session=, request_timeout=10, api_host='wbsapi.withings.net', _token='test', _close_session=False, refresh_token_function=None) async def test_get_measurement_since( responses: aioresponses, snapshot: SnapshotAssertion, authenticated_client: WithingsClient, ) -> None: """Test retrieving measurements.""" responses.post( f"{WITHINGS_URL}/measure", status=200, body=load_fixture("measurement.json"), ) > response = await authenticated_client.get_measurement_since( datetime.fromtimestamp(1609459200, tz=timezone.utc), measurement_types=[MeasurementType.WEIGHT], ) tests/test_withings.py:309: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:181: in get_measurement_since return await self._get_measurements( aiowithings/withings.py:169: in _get_measurements response = await self._request("measure", data=data) aiowithings/withings.py:108: in _request response = await self.session.request( :3: in _request ??? /usr/lib/python3.13/unittest/mock.py:2330: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/measure'), args = () kwargs = {'data': {'action': 'getmeas', 'lastupdate': 1609459200, 'meastypes': '1'}, 'headers': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/measure') url_str = 'https://wbsapi.withings.net/measure' key = ('POST', URL('https://wbsapi.withings.net/measure')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, *...': 'Bearer test'}, 'data': {'lastupdate': 1609459200, 'action': 'getmeas', 'meastypes': '1'}, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/measure /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError _________________________ test_get_measurement_period __________________________ responses = snapshot = SnapshotAssertion(name='snapshot', num_executions=0) authenticated_client = WithingsClient(session=, request_timeout=10, api_host='wbsapi.withings.net', _token='test', _close_session=False, refresh_token_function=None) async def test_get_measurement_period( responses: aioresponses, snapshot: SnapshotAssertion, authenticated_client: WithingsClient, ) -> None: """Test retrieving measurements.""" responses.post( f"{WITHINGS_URL}/measure", status=200, body=load_fixture("measurement.json"), ) > response = await authenticated_client.get_measurement_in_period( start_date=datetime.fromtimestamp(1609459200, tz=timezone.utc), end_date=datetime.fromtimestamp(1609559200, tz=timezone.utc), ) tests/test_withings.py:333: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:193: in get_measurement_in_period return await self._get_measurements( aiowithings/withings.py:169: in _get_measurements response = await self._request("measure", data=data) aiowithings/withings.py:108: in _request response = await self.session.request( :3: in _request ??? /usr/lib/python3.13/unittest/mock.py:2330: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/measure'), args = () kwargs = {'data': {'action': 'getmeas', 'enddate': 1609559200, 'startdate': 1609459200}, 'headers': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/measure') url_str = 'https://wbsapi.withings.net/measure' key = ('POST', URL('https://wbsapi.withings.net/measure')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, *...Bearer test'}, 'data': {'startdate': 1609459200, 'enddate': 1609559200, 'action': 'getmeas'}, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/measure /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError _______________________________ test_subscribing _______________________________ responses = authenticated_client = WithingsClient(session=, request_timeout=10, api_host='wbsapi.withings.net', _token='test', _close_session=False, refresh_token_function=None) async def test_subscribing( responses: aioresponses, authenticated_client: WithingsClient, ) -> None: """Test subscribing to webhook updates.""" responses.post( f"{WITHINGS_URL}/notify", status=200, body=load_fixture("notify_subscribe.json"), ) > await authenticated_client.subscribe_notification( "https://test.com/callback", NotificationCategory.PRESSURE, ) tests/test_withings.py:356: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:352: in subscribe_notification await self._request( aiowithings/withings.py:108: in _request response = await self.session.request( :3: in _request ??? /usr/lib/python3.13/unittest/mock.py:2330: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/notify'), args = () kwargs = {'data': {'action': 'subscribe', 'appli': , 'callbackurl': 'https://test.com/callbac...s': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/notify') url_str = 'https://wbsapi.withings.net/notify' key = ('POST', URL('https://wbsapi.withings.net/notify')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, *...e', 'callbackurl': 'https://test.com/callback', 'appli': }, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/notify /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError ________________________________ test_revoking _________________________________ responses = authenticated_client = WithingsClient(session=, request_timeout=10, api_host='wbsapi.withings.net', _token='test', _close_session=False, refresh_token_function=None) async def test_revoking( responses: aioresponses, authenticated_client: WithingsClient, ) -> None: """Test subscribing to webhook updates.""" responses.post( f"{WITHINGS_URL}/notify", status=200, body=load_fixture("notify_revoke.json"), ) > await authenticated_client.revoke_notification_configurations( "https://test.com/callback", NotificationCategory.PRESSURE, ) tests/test_withings.py:382: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:386: in revoke_notification_configurations await self._request( aiowithings/withings.py:108: in _request response = await self.session.request( :3: in _request ??? /usr/lib/python3.13/unittest/mock.py:2330: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/notify'), args = () kwargs = {'data': {'action': 'revoke', 'appli': , 'callbackurl': 'https://test.com/callback'}...s': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/notify') url_str = 'https://wbsapi.withings.net/notify' key = ('POST', URL('https://wbsapi.withings.net/notify')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, *...e', 'callbackurl': 'https://test.com/callback', 'appli': }, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/notify /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError ___________________________ test_list_subscriptions ____________________________ responses = snapshot = SnapshotAssertion(name='snapshot', num_executions=0) authenticated_client = WithingsClient(session=, request_timeout=10, api_host='wbsapi.withings.net', _token='test', _close_session=False, refresh_token_function=None) async def test_list_subscriptions( responses: aioresponses, snapshot: SnapshotAssertion, authenticated_client: WithingsClient, ) -> None: """Test retrieving subscriptions.""" responses.post( f"{WITHINGS_URL}/notify", status=200, body=load_fixture("notify_list.json"), ) > response = await authenticated_client.list_notification_configurations( NotificationCategory.WEIGHT, ) tests/test_withings.py:409: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:371: in list_notification_configurations response = await self._request( aiowithings/withings.py:108: in _request response = await self.session.request( :3: in _request ??? /usr/lib/python3.13/unittest/mock.py:2330: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/notify'), args = () kwargs = {'data': {'action': 'list', 'appli': }, 'headers': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/notify') url_str = 'https://wbsapi.withings.net/notify' key = ('POST', URL('https://wbsapi.withings.net/notify')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, *...tion': 'Bearer test'}, 'data': {'action': 'list', 'appli': }, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/notify /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError _________________________ test_list_all_subscriptions __________________________ responses = authenticated_client = WithingsClient(session=, request_timeout=10, api_host='wbsapi.withings.net', _token='test', _close_session=False, refresh_token_function=None) async def test_list_all_subscriptions( responses: aioresponses, authenticated_client: WithingsClient, ) -> None: """Test retrieving all subscriptions.""" responses.post( f"{WITHINGS_URL}/notify", status=200, body=load_fixture("notify_list.json"), ) > response = await authenticated_client.list_notification_configurations() tests/test_withings.py:431: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:371: in list_notification_configurations response = await self._request( aiowithings/withings.py:108: in _request response = await self.session.request( :3: in _request ??? /usr/lib/python3.13/unittest/mock.py:2330: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/notify'), args = () kwargs = {'data': {'action': 'list'}, 'headers': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/notify') url_str = 'https://wbsapi.withings.net/notify' key = ('POST', URL('https://wbsapi.withings.net/notify')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test'}, 'data': {'action': 'list'}, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/notify /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError ________________________________ test_get_sleep ________________________________ responses = snapshot = SnapshotAssertion(name='snapshot', num_executions=0) authenticated_client = WithingsClient(session=, request_timeout=10, api_host='wbsapi.withings.net', _token='test', _close_session=False, refresh_token_function=None) async def test_get_sleep( responses: aioresponses, snapshot: SnapshotAssertion, authenticated_client: WithingsClient, ) -> None: """Test retrieving sleep.""" responses.post( f"{WITHINGS_URL}/v2/sleep", status=200, body=load_fixture("sleep.json"), ) > response = await authenticated_client.get_sleep( datetime.fromtimestamp(0, tz=timezone.utc), datetime.fromtimestamp(1609559200, tz=timezone.utc), [ SleepDataFields.HEART_RATE, SleepDataFields.RESPIRATION_RATE, SleepDataFields.SNORING, SleepDataFields.HEART_RATE_VARIABILITY, SleepDataFields.HEART_RATE_VARIABILITY_2, SleepDataFields.MOVEMENT_SCORE, ], ) tests/test_withings.py:479: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:217: in get_sleep response = await self._request( aiowithings/withings.py:108: in _request response = await self.session.request( :3: in _request ??? /usr/lib/python3.13/unittest/mock.py:2330: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/v2/sleep'), args = () kwargs = {'data': {'action': 'get', 'data_fields': 'hr,rr,snoring,sdnn_1,rmssd,mvt_score', 'enddate': 1609559200, 'startdate': ...s': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/v2/sleep') url_str = 'https://wbsapi.withings.net/v2/sleep' key = ('POST', URL('https://wbsapi.withings.net/v2/sleep')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, *...startdate': 0, 'enddate': 1609559200, 'data_fields': 'hr,rr,snoring,sdnn_1,rmssd,mvt_score'}, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/v2/sleep /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError ______________________ test_get_sleep_without_data_fields ______________________ responses = snapshot = SnapshotAssertion(name='snapshot', num_executions=0) authenticated_client = WithingsClient(session=, request_timeout=10, api_host='wbsapi.withings.net', _token='test', _close_session=False, refresh_token_function=None) async def test_get_sleep_without_data_fields( responses: aioresponses, snapshot: SnapshotAssertion, authenticated_client: WithingsClient, ) -> None: """Test retrieving sleep without datafields.""" responses.post( f"{WITHINGS_URL}/v2/sleep", status=200, body=load_fixture("sleep_no_datafields.json"), ) > response = await authenticated_client.get_sleep( datetime.fromtimestamp(0, tz=timezone.utc), datetime.fromtimestamp(1609559200, tz=timezone.utc), ) tests/test_withings.py:516: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:217: in get_sleep response = await self._request( aiowithings/withings.py:108: in _request response = await self.session.request( :3: in _request ??? /usr/lib/python3.13/unittest/mock.py:2330: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/v2/sleep'), args = () kwargs = {'data': {'action': 'get', 'enddate': 1609559200, 'startdate': 0}, 'headers': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/v2/sleep') url_str = 'https://wbsapi.withings.net/v2/sleep' key = ('POST', URL('https://wbsapi.withings.net/v2/sleep')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, *...orization': 'Bearer test'}, 'data': {'action': 'get', 'startdate': 0, 'enddate': 1609559200}, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/v2/sleep /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError _______________________ test_get_sleep_summary_in_period _______________________ responses = snapshot = SnapshotAssertion(name='snapshot', num_executions=0) authenticated_client = WithingsClient(session=, request_timeout=10, api_host='wbsapi.withings.net', _token='test', _close_session=False, refresh_token_function=None) async def test_get_sleep_summary_in_period( responses: aioresponses, snapshot: SnapshotAssertion, authenticated_client: WithingsClient, ) -> None: """Test retrieving sleep.""" responses.post( f"{WITHINGS_URL}/v2/sleep", status=200, body=load_fixture("sleep_summary.json"), ) > response = await authenticated_client.get_sleep_summary_in_period( start_date=datetime.fromtimestamp(0, tz=timezone.utc).date(), end_date=datetime.fromtimestamp(1609559200, tz=timezone.utc).date(), sleep_summary_data_fields=[ SleepSummaryDataFields.REM_SLEEP_PHASE_COUNT, SleepSummaryDataFields.SLEEP_EFFICIENCY, SleepSummaryDataFields.SLEEP_LATENCY, SleepSummaryDataFields.TOTAL_SLEEP_TIME, SleepSummaryDataFields.TOTAL_TIME_IN_BED, SleepSummaryDataFields.WAKE_UP_LATENCY, SleepSummaryDataFields.TIME_AWAKE_DURING_SLEEP, SleepSummaryDataFields.APNEA_HYPOPNEA_INDEX, SleepSummaryDataFields.BREATHING_DISTURBANCES_INTENSITY, SleepSummaryDataFields.EXTERNAL_TOTAL_SLEEP_TIME, SleepSummaryDataFields.DEEP_SLEEP_DURATION, SleepSummaryDataFields.AVERAGE_HEART_RATE, SleepSummaryDataFields.MIN_HEART_RATE, SleepSummaryDataFields.MAX_HEART_RATE, SleepSummaryDataFields.LIGHT_SLEEP_DURATION, SleepSummaryDataFields.ACTIVE_MOVEMENT_DURATION, SleepSummaryDataFields.AVERAGE_MOVEMENT_SCORE, SleepSummaryDataFields.NIGHT_EVENTS, SleepSummaryDataFields.OUT_OF_BED_COUNT, SleepSummaryDataFields.REM_SLEEP_DURATION, SleepSummaryDataFields.AVERAGE_RESPIRATION_RATE, SleepSummaryDataFields.MIN_RESPIRATION_RATE, SleepSummaryDataFields.MAX_RESPIRATION_RATE, SleepSummaryDataFields.SLEEP_SCORE, SleepSummaryDataFields.SNORING, SleepSummaryDataFields.SNORING_COUNT, SleepSummaryDataFields.WAKE_UP_COUNT, SleepSummaryDataFields.TOTAL_TIME_AWAKE, SleepSummaryDataFields.WITHINGS_INDEX, ], ) tests/test_withings.py:540: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:260: in get_sleep_summary_in_period return await self._get_sleep_summary( aiowithings/withings.py:236: in _get_sleep_summary response = await self._request( aiowithings/withings.py:108: in _request response = await self.session.request( :3: in _request ??? /usr/lib/python3.13/unittest/mock.py:2330: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/v2/sleep'), args = () kwargs = {'data': {'action': 'getsummary', 'data_fields': 'nb_rem_episodes,sleep_efficiency,sleep_latency,total_sleep_time,tota...s': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/v2/sleep') url_str = 'https://wbsapi.withings.net/v2/sleep' key = ('POST', URL('https://wbsapi.withings.net/v2/sleep')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, *...n,rr_max,sleep_score,snoring,snoringepisodecount,wakeupcount,wakeupduration,withings_index'}, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/v2/sleep /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError _____________ test_get_sleep_summary_in_period_without_data_fields _____________ responses = snapshot = SnapshotAssertion(name='snapshot', num_executions=0) authenticated_client = WithingsClient(session=, request_timeout=10, api_host='wbsapi.withings.net', _token='test', _close_session=False, refresh_token_function=None) async def test_get_sleep_summary_in_period_without_data_fields( responses: aioresponses, snapshot: SnapshotAssertion, authenticated_client: WithingsClient, ) -> None: """Test retrieving sleep without datafields.""" responses.post( f"{WITHINGS_URL}/v2/sleep", status=200, body=load_fixture("sleep_summary_no_datafields.json"), ) > response = await authenticated_client.get_sleep_summary_in_period( start_date=datetime.fromtimestamp(0, tz=timezone.utc).date(), end_date=datetime.fromtimestamp(1609559200, tz=timezone.utc).date(), ) tests/test_withings.py:606: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:260: in get_sleep_summary_in_period return await self._get_sleep_summary( aiowithings/withings.py:236: in _get_sleep_summary response = await self._request( aiowithings/withings.py:108: in _request response = await self.session.request( :3: in _request ??? /usr/lib/python3.13/unittest/mock.py:2330: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/v2/sleep'), args = () kwargs = {'data': {'action': 'getsummary', 'enddateymd': '2021-01-02', 'startdateymd': '1970-01-01'}, 'headers': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/v2/sleep') url_str = 'https://wbsapi.withings.net/v2/sleep' key = ('POST', URL('https://wbsapi.withings.net/v2/sleep')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, *..., 'data': {'startdateymd': '1970-01-01', 'enddateymd': '2021-01-02', 'action': 'getsummary'}, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/v2/sleep /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError _________________________ test_get_sleep_summary_since _________________________ responses = authenticated_client = WithingsClient(session=, request_timeout=10, api_host='wbsapi.withings.net', _token='test', _close_session=False, refresh_token_function=None) async def test_get_sleep_summary_since( responses: aioresponses, authenticated_client: WithingsClient, ) -> None: """Test retrieving sleep.""" responses.post( f"{WITHINGS_URL}/v2/sleep", status=200, body=load_fixture("sleep_summary.json"), ) > response = await authenticated_client.get_sleep_summary_since( sleep_summary_since=datetime.fromtimestamp(0, tz=timezone.utc), sleep_summary_data_fields=[ SleepSummaryDataFields.REM_SLEEP_PHASE_COUNT, SleepSummaryDataFields.SLEEP_EFFICIENCY, SleepSummaryDataFields.SLEEP_LATENCY, SleepSummaryDataFields.TOTAL_SLEEP_TIME, SleepSummaryDataFields.TOTAL_TIME_IN_BED, SleepSummaryDataFields.WAKE_UP_LATENCY, SleepSummaryDataFields.TIME_AWAKE_DURING_SLEEP, SleepSummaryDataFields.APNEA_HYPOPNEA_INDEX, SleepSummaryDataFields.BREATHING_DISTURBANCES_INTENSITY, SleepSummaryDataFields.EXTERNAL_TOTAL_SLEEP_TIME, SleepSummaryDataFields.DEEP_SLEEP_DURATION, SleepSummaryDataFields.AVERAGE_HEART_RATE, SleepSummaryDataFields.MIN_HEART_RATE, SleepSummaryDataFields.MAX_HEART_RATE, SleepSummaryDataFields.LIGHT_SLEEP_DURATION, SleepSummaryDataFields.ACTIVE_MOVEMENT_DURATION, SleepSummaryDataFields.AVERAGE_MOVEMENT_SCORE, SleepSummaryDataFields.NIGHT_EVENTS, SleepSummaryDataFields.OUT_OF_BED_COUNT, SleepSummaryDataFields.REM_SLEEP_DURATION, SleepSummaryDataFields.AVERAGE_RESPIRATION_RATE, SleepSummaryDataFields.MIN_RESPIRATION_RATE, SleepSummaryDataFields.MAX_RESPIRATION_RATE, SleepSummaryDataFields.SLEEP_SCORE, SleepSummaryDataFields.SNORING, SleepSummaryDataFields.SNORING_COUNT, SleepSummaryDataFields.WAKE_UP_COUNT, SleepSummaryDataFields.TOTAL_TIME_AWAKE, SleepSummaryDataFields.WITHINGS_INDEX, ], ) tests/test_withings.py:633: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:248: in get_sleep_summary_since return await self._get_sleep_summary( aiowithings/withings.py:236: in _get_sleep_summary response = await self._request( aiowithings/withings.py:108: in _request response = await self.session.request( :3: in _request ??? /usr/lib/python3.13/unittest/mock.py:2330: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/v2/sleep'), args = () kwargs = {'data': {'action': 'getsummary', 'data_fields': 'nb_rem_episodes,sleep_efficiency,sleep_latency,total_sleep_time,tota...s': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/v2/sleep') url_str = 'https://wbsapi.withings.net/v2/sleep' key = ('POST', URL('https://wbsapi.withings.net/v2/sleep')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, *...n,rr_max,sleep_score,snoring,snoringepisodecount,wakeupcount,wakeupduration,withings_index'}, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/v2/sleep /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError _______________ test_get_sleep_summary_since_without_data_fields _______________ responses = authenticated_client = WithingsClient(session=, request_timeout=10, api_host='wbsapi.withings.net', _token='test', _close_session=False, refresh_token_function=None) async def test_get_sleep_summary_since_without_data_fields( responses: aioresponses, authenticated_client: WithingsClient, ) -> None: """Test retrieving sleep without datafields.""" responses.post( f"{WITHINGS_URL}/v2/sleep", status=200, body=load_fixture("sleep_summary_no_datafields.json"), ) > response = await authenticated_client.get_sleep_summary_since( datetime.fromtimestamp(0, tz=timezone.utc), ) tests/test_withings.py:696: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:248: in get_sleep_summary_since return await self._get_sleep_summary( aiowithings/withings.py:236: in _get_sleep_summary response = await self._request( aiowithings/withings.py:108: in _request response = await self.session.request( :3: in _request ??? /usr/lib/python3.13/unittest/mock.py:2330: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/v2/sleep'), args = () kwargs = {'data': {'action': 'getsummary', 'lastupdate': 0}, 'headers': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/v2/sleep') url_str = 'https://wbsapi.withings.net/v2/sleep' key = ('POST', URL('https://wbsapi.withings.net/v2/sleep')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test'}, 'data': {'lastupdate': 0, 'action': 'getsummary'}, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/v2/sleep /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError ___________________________ test_get_workouts_since ____________________________ responses = snapshot = SnapshotAssertion(name='snapshot', num_executions=0) authenticated_client = WithingsClient(session=, request_timeout=10, api_host='wbsapi.withings.net', _token='test', _close_session=False, refresh_token_function=None) async def test_get_workouts_since( responses: aioresponses, snapshot: SnapshotAssertion, authenticated_client: WithingsClient, ) -> None: """Test retrieving workouts.""" responses.post( f"{WITHINGS_URL}/v2/measure", status=200, body=load_fixture("workouts.json"), ) > response = await authenticated_client.get_workouts_since( datetime.fromtimestamp(0, tz=timezone.utc), workout_data_fields=[WorkoutDataFields.CALORIES], ) tests/test_withings.py:722: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:329: in get_workouts_since return await self._get_workouts( aiowithings/withings.py:317: in _get_workouts response = await self._request( aiowithings/withings.py:108: in _request response = await self.session.request( :3: in _request ??? /usr/lib/python3.13/unittest/mock.py:2330: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/v2/measure'), args = () kwargs = {'data': {'action': 'getworkouts', 'data_fields': 'calories', 'lastupdate': 0}, 'headers': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/v2/measure') url_str = 'https://wbsapi.withings.net/v2/measure' key = ('POST', URL('https://wbsapi.withings.net/v2/measure')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, *...Bearer test'}, 'data': {'lastupdate': 0, 'action': 'getworkouts', 'data_fields': 'calories'}, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/v2/measure /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError ___________________________ test_get_workouts_period ___________________________ responses = snapshot = SnapshotAssertion(name='snapshot', num_executions=0) authenticated_client = WithingsClient(session=, request_timeout=10, api_host='wbsapi.withings.net', _token='test', _close_session=False, refresh_token_function=None) async def test_get_workouts_period( responses: aioresponses, snapshot: SnapshotAssertion, authenticated_client: WithingsClient, ) -> None: """Test retrieving workouts.""" responses.post( f"{WITHINGS_URL}/v2/measure", status=200, body=load_fixture("workouts.json"), ) > response = await authenticated_client.get_workouts_in_period( start_date=datetime.fromtimestamp(0, tz=timezone.utc), end_date=datetime.fromtimestamp(1609559200, tz=timezone.utc), ) tests/test_withings.py:746: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ aiowithings/withings.py:341: in get_workouts_in_period return await self._get_workouts( aiowithings/withings.py:317: in _get_workouts response = await self._request( aiowithings/withings.py:108: in _request response = await self.session.request( :3: in _request ??? /usr/lib/python3.13/unittest/mock.py:2330: in _execute_mock_call result = await effect(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = orig_self = , method = 'POST' url = URL('https://wbsapi.withings.net/v2/measure'), args = () kwargs = {'data': {'action': 'getworkouts', 'enddateymd': '2021-01-02 03:46:40+00:00', 'startdateymd': '1970-01-01 00:00:00+00:...s': {'Accept': 'application/json, text/plain, */*', 'Authorization': 'Bearer test', 'User-Agent': 'AioWithings/2.1.0'}} url_origin = URL('https://wbsapi.withings.net/v2/measure') url_str = 'https://wbsapi.withings.net/v2/measure' key = ('POST', URL('https://wbsapi.withings.net/v2/measure')) request_call = RequestCall(args=(), kwargs={'headers': {'User-Agent': 'AioWithings/2.1.0', 'Accept': 'application/json, text/plain, *...0-01-01 00:00:00+00:00', 'enddateymd': '2021-01-02 03:46:40+00:00', 'action': 'getworkouts'}, 'allow_redirects': True}) response = None async def _request_mock(self, orig_self: ClientSession, method: str, url: 'Union[URL, str]', *args: Tuple, **kwargs: Any) -> 'ClientResponse': """Return mocked response object or raise connection error.""" if orig_self.closed: raise RuntimeError('Session is closed') url_origin = url url = normalize_url(merge_params(url, kwargs.get('params'))) url_str = str(url) for prefix in self._passthrough: if url_str.startswith(prefix): return (await self.patcher.temp_original( orig_self, method, url_origin, *args, **kwargs )) key = (method, url) self.requests.setdefault(key, []) request_call = self._build_request_call(method, *args, **kwargs) self.requests[key].append(request_call) response = await self.match(method, url, **kwargs) if response is None: > raise ClientConnectionError( 'Connection refused: {} {}'.format(method, url) ) E aiohttp.client_exceptions.ClientConnectionError: Connection refused: POST https://wbsapi.withings.net/v2/measure /usr/lib/python3/dist-packages/aioresponses/core.py:515: ClientConnectionError ---------- coverage: platform linux, python 3.13.2-final-0 ----------- Name Stmts Miss Branch BrPart Cover Missing --------------------------------------------------------------------- aiowithings/models.py 563 79 94 0 82% 115-127, 149-154, 407, 450, 463-465, 516, 720-736, 876-926 aiowithings/util.py 16 3 0 0 81% 20-26 aiowithings/withings.py 132 35 40 1 69% 115-147, 152, 157, 170, 221, 240, 282, 321, 375 --------------------------------------------------------------------- TOTAL 761 117 152 1 81% 4 files skipped due to complete coverage. FAIL Required test coverage of 100% not reached. Total coverage: 80.72% --------------------------- snapshot report summary ---------------------------- 22 snapshots passed. 17 snapshots unused. Re-run pytest with --snapshot-update to delete unused snapshots. =========================== short test summary info ============================ FAILED tests/test_withings.py::test_putting_in_own_session - aiohttp.client_e... FAILED tests/test_withings.py::test_creating_own_session - aiohttp.client_exc... FAILED tests/test_withings.py::test_unexpected_server_response - aiohttp.clie... FAILED tests/test_withings.py::test_timeout - aiohttp.client_exceptions.Clien... FAILED tests/test_withings.py::test_error_codes[100-WithingsAuthenticationFailedError] FAILED tests/test_withings.py::test_error_codes[201-WithingsInvalidParamsError] FAILED tests/test_withings.py::test_error_codes[214-WithingsUnauthorizedError] FAILED tests/test_withings.py::test_error_codes[215-WithingsErrorOccurredError] FAILED tests/test_withings.py::test_error_codes[522-WithingsConnectionError] FAILED tests/test_withings.py::test_error_codes[524-WithingsBadStateError] - ... FAILED tests/test_withings.py::test_error_codes[601-WithingsTooManyRequestsError] FAILED tests/test_withings.py::test_error_codes[-1-WithingsUnknownStatusError] FAILED tests/test_withings.py::test_error_codes[None-WithingsUnknownStatusError] FAILED tests/test_withings.py::test_get_activities_since - aiohttp.client_exc... FAILED tests/test_withings.py::test_get_activities_period - aiohttp.client_ex... FAILED tests/test_withings.py::test_get_devices - aiohttp.client_exceptions.C... FAILED tests/test_withings.py::test_get_new_device - aiohttp.client_exception... FAILED tests/test_withings.py::test_get_goals[goals] - aiohttp.client_excepti... FAILED tests/test_withings.py::test_get_goals[goals_1] - aiohttp.client_excep... FAILED tests/test_withings.py::test_get_goals[goals_2] - aiohttp.client_excep... FAILED tests/test_withings.py::test_get_goals[no_goals] - aiohttp.client_exce... FAILED tests/test_withings.py::test_get_measurement_since - aiohttp.client_ex... FAILED tests/test_withings.py::test_get_measurement_period - aiohttp.client_e... FAILED tests/test_withings.py::test_subscribing - aiohttp.client_exceptions.C... FAILED tests/test_withings.py::test_revoking - aiohttp.client_exceptions.Clie... FAILED tests/test_withings.py::test_list_subscriptions - aiohttp.client_excep... FAILED tests/test_withings.py::test_list_all_subscriptions - aiohttp.client_e... FAILED tests/test_withings.py::test_get_sleep - aiohttp.client_exceptions.Cli... FAILED tests/test_withings.py::test_get_sleep_without_data_fields - aiohttp.c... FAILED tests/test_withings.py::test_get_sleep_summary_in_period - aiohttp.cli... FAILED tests/test_withings.py::test_get_sleep_summary_in_period_without_data_fields FAILED tests/test_withings.py::test_get_sleep_summary_since - aiohttp.client_... FAILED tests/test_withings.py::test_get_sleep_summary_since_without_data_fields FAILED tests/test_withings.py::test_get_workouts_since - aiohttp.client_excep... FAILED tests/test_withings.py::test_get_workouts_period - aiohttp.client_exce... ======================== 35 failed, 25 passed in 8.79s ========================= E: pybuild pybuild:389: test: plugin pyproject failed with: exit code=1: cd /build/reproducible-path/python-aiowithings-3.0.3/.pybuild/cpython3_3.13/build; python3.13 -m pytest -v tests dh_auto_test: error: pybuild --test --test-pytest -i python{version} -p "3.12 3.13" returned exit code 13 make: *** [debian/rules:9: binary] Error 25 dpkg-buildpackage: error: debian/rules binary subprocess returned exit status 2 I: copying local configuration E: Failed autobuilding of package I: unmounting dev/ptmx filesystem I: unmounting dev/pts filesystem I: unmounting dev/shm filesystem I: unmounting proc filesystem I: unmounting sys filesystem I: cleaning the build env I: removing directory /srv/workspace/pbuilder/37560 and its subdirectories