Attempt to use and setup a proxy for CI
This commit is contained in:
parent
81eb9ebc6e
commit
48ae248d2d
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -360,6 +360,8 @@ jobs:
|
|||||||
pip install -e .
|
pip install -e .
|
||||||
|
|
||||||
- name: Tests incl. ccxt compatibility tests
|
- name: Tests incl. ccxt compatibility tests
|
||||||
|
env:
|
||||||
|
CI_WEB_PROXY: http://152.67.78.211:13128
|
||||||
run: |
|
run: |
|
||||||
pytest --random-order --cov=freqtrade --cov-config=.coveragerc --longrun
|
pytest --random-order --cov=freqtrade --cov-config=.coveragerc --longrun
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ from typing import Tuple
|
|||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
from freqtrade.constants import Config
|
||||||
from freqtrade.enums import CandleType
|
from freqtrade.enums import CandleType
|
||||||
from freqtrade.exchange import timeframe_to_minutes, timeframe_to_prev_date
|
from freqtrade.exchange import timeframe_to_minutes, timeframe_to_prev_date
|
||||||
from freqtrade.exchange.exchange import Exchange, timeframe_to_msecs
|
from freqtrade.exchange.exchange import Exchange, timeframe_to_msecs
|
||||||
@ -31,16 +32,17 @@ EXCHANGES = {
|
|||||||
'leverage_tiers_public': False,
|
'leverage_tiers_public': False,
|
||||||
'leverage_in_spot_market': False,
|
'leverage_in_spot_market': False,
|
||||||
},
|
},
|
||||||
# 'binance': {
|
'binance': {
|
||||||
# 'pair': 'BTC/USDT',
|
'pair': 'BTC/USDT',
|
||||||
# 'stake_currency': 'USDT',
|
'stake_currency': 'USDT',
|
||||||
# 'hasQuoteVolume': True,
|
'use_ci_proxy': True,
|
||||||
# 'timeframe': '5m',
|
'hasQuoteVolume': True,
|
||||||
# 'futures': True,
|
'timeframe': '5m',
|
||||||
# 'futures_pair': 'BTC/USDT:USDT',
|
'futures': True,
|
||||||
# 'leverage_tiers_public': False,
|
'futures_pair': 'BTC/USDT:USDT',
|
||||||
# 'leverage_in_spot_market': False,
|
'leverage_tiers_public': False,
|
||||||
# },
|
'leverage_in_spot_market': False,
|
||||||
|
},
|
||||||
'kraken': {
|
'kraken': {
|
||||||
'pair': 'BTC/USDT',
|
'pair': 'BTC/USDT',
|
||||||
'stake_currency': 'USDT',
|
'stake_currency': 'USDT',
|
||||||
@ -107,8 +109,23 @@ def exchange_conf():
|
|||||||
return config
|
return config
|
||||||
|
|
||||||
|
|
||||||
|
def set_test_proxy(config: Config, use_proxy: bool) -> Config:
|
||||||
|
# Set proxy to test in CI.
|
||||||
|
import os
|
||||||
|
if use_proxy and (proxy := os.environ.get('CI_WEB_PROXY')):
|
||||||
|
config['exchange']['ccxt_config'] = {
|
||||||
|
'proxies': {
|
||||||
|
'https': proxy,
|
||||||
|
'http': proxy,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return config
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(params=EXCHANGES, scope="class")
|
@pytest.fixture(params=EXCHANGES, scope="class")
|
||||||
def exchange(request, exchange_conf):
|
def exchange(request, exchange_conf):
|
||||||
|
set_test_proxy(exchange_conf, EXCHANGES[request.param].get('use_ci_proxy', False))
|
||||||
exchange_conf['exchange']['name'] = request.param
|
exchange_conf['exchange']['name'] = request.param
|
||||||
exchange_conf['stake_currency'] = EXCHANGES[request.param]['stake_currency']
|
exchange_conf['stake_currency'] = EXCHANGES[request.param]['stake_currency']
|
||||||
exchange = ExchangeResolver.load_exchange(request.param, exchange_conf, validate=True)
|
exchange = ExchangeResolver.load_exchange(request.param, exchange_conf, validate=True)
|
||||||
@ -121,6 +138,7 @@ def exchange_futures(request, exchange_conf, class_mocker):
|
|||||||
if not EXCHANGES[request.param].get('futures') is True:
|
if not EXCHANGES[request.param].get('futures') is True:
|
||||||
yield None, request.param
|
yield None, request.param
|
||||||
else:
|
else:
|
||||||
|
set_test_proxy(exchange_conf, EXCHANGES[request.param].get('use_ci_proxy', False))
|
||||||
exchange_conf = deepcopy(exchange_conf)
|
exchange_conf = deepcopy(exchange_conf)
|
||||||
exchange_conf['exchange']['name'] = request.param
|
exchange_conf['exchange']['name'] = request.param
|
||||||
exchange_conf['trading_mode'] = 'futures'
|
exchange_conf['trading_mode'] = 'futures'
|
||||||
|
Loading…
Reference in New Issue
Block a user