Skip to content

Commit

Permalink
adjust timeout in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
btschwertfeger committed Dec 6, 2023
1 parent b0f8b63 commit 68e3403
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
6 changes: 6 additions & 0 deletions kraken/base_api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,9 @@ class KrakenSpotBaseAPI:
This class the the base for all Spot clients, handles un-/signed
requests and returns exception handled results.
If you are facing timeout errors on derived clients, you can make use of the
``TIMEOUT`` attribute to deviate from the default ``10`` seconds.
:param key: Spot API public key (default: ``""``)
:type key: str, optional
:param secret: Spot API secret key (default: ``""``)
Expand Down Expand Up @@ -419,6 +422,9 @@ class KrakenFuturesBaseAPI:
The base class for all Futures clients handles un-/signed requests
and returns exception handled results.
If you are facing timeout errors on derived clients, you can make use of the
``TIMEOUT`` attribute to deviate from the default ``10`` seconds.
If the sandbox environment is chosen, the keys must be generated from here:
https://demo-futures.kraken.com/settings/api
Expand Down
8 changes: 6 additions & 2 deletions tests/futures/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,19 @@ def futures_user() -> User:
"""
Fixture providing an unauthenticated Futures User client.
"""
return User()
user: User = User()
user.TIMEOUT = 30
return user


@pytest.fixture()
def futures_auth_user() -> User:
"""
Fixture providing an authenticated Futures User client.
"""
return User(key=FUTURES_API_KEY, secret=FUTURES_SECRET_KEY)
user: User = User(key=FUTURES_API_KEY, secret=FUTURES_SECRET_KEY)
User.TIMEOUT = 30
return user


@pytest.fixture()
Expand Down
2 changes: 0 additions & 2 deletions tests/futures/test_futures_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ def test_get_order_events(futures_auth_user: User) -> None:
"""
Checks the ``get_order_events`` endpoint.
"""
futures_auth_user.TIMEOUT = 30
result: dict = futures_auth_user.get_order_events(
tradeable="PF_SOLUSD",
since=1668989233,
Expand All @@ -129,7 +128,6 @@ def test_get_order_events(futures_auth_user: User) -> None:
)
assert isinstance(result, dict)
assert "elements" in result
futures_auth_user.TIMEOUT = 10


@pytest.mark.futures()
Expand Down

0 comments on commit 68e3403

Please sign in to comment.