aports/community/py3-praw/test-auth.patch
mio 96ceac84a3 community/py3-praw: fix test_auth test
Fix build error due to failed test.

```
_____________________________ TestAuth.test_limits _____________________________
[gw13] linux -- Python 3.12.10 /home/buildozer/aports/community/py3-praw/src/praw-7.8.1/.testenv/bin/python3

self = <tests.unit.models.test_auth.TestAuth object at 0x7fffef87a690>

    def test_limits(self):
        expected = {"remaining": None, "reset_timestamp": None, "used": None}
        for app in [
            installed_app(),
            script_app(),
            script_app_with_password(),
            web_app(),
        ]:
>           assert expected == app.auth.limits

tests/unit/models/test_auth.py:71:

[...]

        data = self._reddit._core._rate_limiter
        return {
            "remaining": data.remaining,
>           "reset_timestamp": data.reset_timestamp,
            "used": data.used,
        }
E       AttributeError: 'RateLimiter' object has no attribute 'reset_timestamp'

praw/models/auth.py:39: AttributeError
```
2025-05-11 22:37:53 +00:00

51 lines
2 KiB
Diff

Patch-Source: https://github.com/praw-dev/praw/commit/1dd6a1aeadcfd77671b4c29edb7eed98322855ef
Auth hunks were extracted from the commit.
---
From 1dd6a1aeadcfd77671b4c29edb7eed98322855ef Mon Sep 17 00:00:00 2001
From: Bryce Boe <bbzbryce@gmail.com>
Date: Wed, 5 Feb 2025 01:30:43 -0800
Subject: [PATCH] Bump prawcore, drop py3.8, add py3.13
---
diff --git a/praw/models/auth.py b/praw/models/auth.py
index fe6c077bc..96c1b2411 100644
--- a/praw/models/auth.py
+++ b/praw/models/auth.py
@@ -19,23 +19,15 @@ def limits(self) -> dict[str, str | int | None]:
:remaining: The number of requests remaining to be made in the current rate
limit window.
- :reset_timestamp: A unix timestamp providing an upper bound on when the rate
- limit counters will reset.
:used: The number of requests made in the current rate limit window.
All values are initially ``None`` as these values are set in response to issued
requests.
- The ``reset_timestamp`` value is an upper bound as the real timestamp is
- computed on Reddit's end in preparation for sending the response. This value may
- change slightly within a given window due to slight changes in response times
- and rounding.
-
"""
data = self._reddit._core._rate_limiter
return {
"remaining": data.remaining,
- "reset_timestamp": data.reset_timestamp,
"used": data.used,
}
diff --git a/tests/unit/models/test_auth.py b/tests/unit/models/test_auth.py
index 2f8926246..4e51d9ef5 100644
--- a/tests/unit/models/test_auth.py
+++ b/tests/unit/models/test_auth.py
@@ -61,7 +61,7 @@ def test_implicit__from_web_app(self):
web_app().auth.implicit(access_token="dummy token", expires_in=10, scope="")
def test_limits(self):
- expected = {"remaining": None, "reset_timestamp": None, "used": None}
+ expected = {"remaining": None, "used": None}
for app in [
installed_app(),
script_app(),