diff --git a/additional_tests/exchanges_tests/abstract_authenticated_exchange_tester.py b/additional_tests/exchanges_tests/abstract_authenticated_exchange_tester.py index 8c8576edf..6ce4f5054 100644 --- a/additional_tests/exchanges_tests/abstract_authenticated_exchange_tester.py +++ b/additional_tests/exchanges_tests/abstract_authenticated_exchange_tester.py @@ -291,10 +291,7 @@ async def inner_test_get_api_key_permissions(self): "_get_api_key_rights_using_order", mock.AsyncMock(side_effect=origin_get_api_key_rights_using_order) ) as _get_api_key_rights_using_order_mock: permissions = await self.exchange_manager.exchange_backend._get_api_key_rights() - assert len(permissions) > 0 - assert trading_backend.enums.APIKeyRights.READING in permissions - assert trading_backend.enums.APIKeyRights.SPOT_TRADING in permissions - assert trading_backend.enums.APIKeyRights.FUTURES_TRADING in permissions + self._ensure_required_permissions(permissions) if self.USE_ORDER_OPERATION_TO_CHECK_API_KEY_RIGHTS: # failed ? did not use _get_api_key_rights_using_order while expected _get_api_key_rights_using_order_mock.assert_called_once() @@ -302,6 +299,11 @@ async def inner_test_get_api_key_permissions(self): # failed ? used _get_api_key_rights_using_order when not expected _get_api_key_rights_using_order_mock.assert_not_called() + def _ensure_required_permissions(self, permissions): + assert len(permissions) > 0 + assert trading_backend.enums.APIKeyRights.READING in permissions + assert trading_backend.enums.APIKeyRights.SPOT_TRADING in permissions + async def test_missing_trading_api_key_permissions(self): async with self.local_exchange_manager(identifiers_suffix="_READONLY"): await self.inner_test_missing_trading_api_key_permissions() diff --git a/additional_tests/exchanges_tests/abstract_authenticated_future_exchange_tester.py b/additional_tests/exchanges_tests/abstract_authenticated_future_exchange_tester.py index 38d5bef44..1e23387e3 100644 --- a/additional_tests/exchanges_tests/abstract_authenticated_future_exchange_tester.py +++ b/additional_tests/exchanges_tests/abstract_authenticated_future_exchange_tester.py @@ -15,12 +15,12 @@ # License along with OctoBot. If not, see . import contextlib import decimal -import ccxt import pytest import octobot_trading.enums as trading_enums import octobot_trading.constants as trading_constants import octobot_trading.errors as trading_errors +import trading_backend.enums from additional_tests.exchanges_tests import abstract_authenticated_exchange_tester @@ -192,6 +192,10 @@ async def _inner_test_create_and_cancel_limit_orders_for_margin_type( symbol=self.INVERSE_SYMBOL, settlement_currency=self.ORDER_CURRENCY, margin_type=margin_type ) + def _ensure_required_permissions(self, permissions): + super()._ensure_required_permissions(permissions) + assert trading_backend.enums.APIKeyRights.FUTURES_TRADING in permissions + async def inner_test_create_and_fill_market_orders(self): portfolio = await self.get_portfolio() position = await self.get_position() diff --git a/octobot/community/errors_upload/sentry_aiohttp_transport.py b/octobot/community/errors_upload/sentry_aiohttp_transport.py index 8b9c77d59..83ddcaf5f 100644 --- a/octobot/community/errors_upload/sentry_aiohttp_transport.py +++ b/octobot/community/errors_upload/sentry_aiohttp_transport.py @@ -156,13 +156,11 @@ def capture_event( def capture_envelope( self, envelope: sentry_sdk.envelope.Envelope ) -> None: - hub = self.hub_cls.current async def send_envelope_wrapper() -> None: - with hub: # pylint: disable=not-context-manager - with sentry_sdk.utils.capture_internal_exceptions(): - await self._async_send_envelope(envelope) - self._flush_client_reports() + with sentry_sdk.utils.capture_internal_exceptions(): + await self._async_send_envelope(envelope) + self._flush_client_reports() if not self._worker.submit(send_envelope_wrapper): self.on_dropped_event("full_queue") diff --git a/requirements.txt b/requirements.txt index 12bd890f0..4ce46a1aa 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ # Drakkar-Software requirements OctoBot-Commons==1.9.70 -OctoBot-Trading==2.4.143 +OctoBot-Trading==2.4.144 OctoBot-Evaluators==1.9.7 OctoBot-Tentacles-Manager==2.9.16 OctoBot-Services==1.6.23 diff --git a/tests/unit_tests/community/errors_upload/test_sentry_aiohttp_transport.py b/tests/unit_tests/community/errors_upload/test_sentry_aiohttp_transport.py index eca475a29..b311b2191 100644 --- a/tests/unit_tests/community/errors_upload/test_sentry_aiohttp_transport.py +++ b/tests/unit_tests/community/errors_upload/test_sentry_aiohttp_transport.py @@ -61,9 +61,6 @@ def _before_send_callback(event: dict, hint: dict): SENTRY_CONFIG["enabled"] = False if handle and hasattr(handle._client.transport, "async_kill"): await handle._client.transport.async_kill() - client = sentry_sdk.Hub.current.client - if client is not None: - client.close(timeout=0) def _mocked_context(return_value):