mirror of
https://github.com/arcan1s/ahriman.git
synced 2026-02-24 21:59:48 +00:00
fix: handle class overrides for retry polices correctly
Previous implementation didn't work as intended because there was still override in init. Current implementation instead of playing with guessing separates default and instance setttings. Also update test cases to handle this scenario correctly
This commit is contained in:
@@ -49,14 +49,18 @@ def test_retry_policy() -> None:
|
||||
"""
|
||||
must set retry policy
|
||||
"""
|
||||
SyncHttpClient.retry = SyncHttpClient.retry_policy(1, 2.0)
|
||||
AUR.retry = AUR.retry_policy(3, 4.0)
|
||||
SyncHttpClient.DEFAULT_MAX_RETRIES = 1
|
||||
SyncHttpClient.DEFAULT_RETRY_BACKOFF = 2.0
|
||||
AUR.DEFAULT_MAX_RETRIES = 3
|
||||
AUR.DEFAULT_RETRY_BACKOFF = 4.0
|
||||
|
||||
assert SyncHttpClient.retry.connect == 1
|
||||
assert SyncHttpClient.retry.backoff_factor == 2.0
|
||||
client = SyncHttpClient()
|
||||
assert client.retry.connect == 1
|
||||
assert client.retry.backoff_factor == 2.0
|
||||
|
||||
assert AUR.retry.connect == 3
|
||||
assert AUR.retry.backoff_factor == 4.0
|
||||
aur = AUR()
|
||||
assert aur.retry.connect == 3
|
||||
assert aur.retry.backoff_factor == 4.0
|
||||
|
||||
|
||||
def test_exception_response_text() -> None:
|
||||
|
||||
@@ -31,8 +31,9 @@ def test_set_globals(configuration: Configuration) -> None:
|
||||
configuration.set_option("aur", "max_retries", "10")
|
||||
|
||||
Repository._set_globals(configuration)
|
||||
assert AUR.timeout == 42
|
||||
assert AUR.retry.connect == 10
|
||||
aur = AUR()
|
||||
assert aur.timeout == 42
|
||||
assert aur.retry.connect == 10
|
||||
|
||||
|
||||
def test_set_context(configuration: Configuration, database: SQLite, mocker: MockerFixture) -> None:
|
||||
|
||||
Reference in New Issue
Block a user