Skip to content

Commit 50a97c2

Browse files
Guillaume De Saint MartinGuillaumeDSM
authored andcommitted
[Tests] add get_test_exchange_manager
1 parent 69475b6 commit 50a97c2

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

tests/test_utils/test_exchanges.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# This file is part of OctoBot (https://github.com/Drakkar-Software/OctoBot)
2+
# Copyright (c) 2022 Drakkar-Software, All rights reserved.
3+
#
4+
# OctoBot is free software; you can redistribute it and/or
5+
# modify it under the terms of the GNU General Public License
6+
# as published by the Free Software Foundation; either
7+
# version 3.0 of the License, or (at your option) any later version.
8+
#
9+
# OctoBot is distributed in the hope that it will be useful,
10+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12+
# General Public License for more details.
13+
#
14+
# You should have received a copy of the GNU General Public
15+
# License along with OctoBot. If not, see <https://www.gnu.org/licenses/>.
16+
import os
17+
18+
import octobot_trading.exchanges as exchanges
19+
20+
21+
def get_test_exchange_manager(config, exchange_name):
22+
exchange_manager = exchanges.ExchangeManager(config, exchange_name)
23+
# customize exchange id to include test name (useful in possible memory issues)
24+
exchange_manager.id = f"{exchange_manager.id}[{os.environ.get('PYTEST_CURRENT_TEST')}]"
25+
return exchange_manager

0 commit comments

Comments
 (0)