diff --git a/qtile_extras/resources/stravadata/sync.py b/qtile_extras/resources/stravadata/sync.py index 401be595..a5844bdd 100644 --- a/qtile_extras/resources/stravadata/sync.py +++ b/qtile_extras/resources/stravadata/sync.py @@ -23,12 +23,16 @@ import pickle import time -from pint import Unit +from pint import Unit, set_application_registry from stravalib import Client from stravalib.model import Activity +from stravalib.unit_registry import ureg from qtile_extras.resources.stravadata.locations import AUTH, CACHE, CREDS, TIMESTAMP +set_application_registry(ureg) + + NUM_EVENTS = 5 APP_ID = AUTH.get("id", False) diff --git a/test/widget/test_strava.py b/test/widget/test_strava.py index a6355ec2..b807f971 100644 --- a/test/widget/test_strava.py +++ b/test/widget/test_strava.py @@ -25,7 +25,6 @@ import libqtile.confreader import libqtile.layout import pytest -from pint import Unit from stravalib.model import Activity from qtile_extras.widget.strava import StravaWidget @@ -35,18 +34,18 @@ Activity( name="Test Activity 1", start_date_local=datetime(2021, 11, 20, 9, 0), - distance=Unit("m") * 10000, + distance=10000, elapsed_time=45 * 60, moving_time=45 * 60, - type=Activity.RUN, + type="Run", ), Activity( name="Test Activity 2", start_date_local=datetime(2021, 11, 21, 7, 10), - distance=Unit("m") * 21100, + distance=21100, elapsed_time=105 * 60, moving_time=105 * 60, - type=Activity.RUN, + type="Run", ), ] diff --git a/tox.ini b/tox.ini index d2ae7335..597c47e3 100644 --- a/tox.ini +++ b/tox.ini @@ -31,7 +31,7 @@ deps = PyGObject requests pint - stravalib <= 1.1.0 + stravalib iwlib psutil pulsectl-asyncio @@ -78,7 +78,7 @@ deps = dbus_next requests pint - stravalib <= 1.1.0 + stravalib commands = pip install --force-reinstall --no-binary :all: cffi pip install pywlroots==0.17.0