mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-11-29 08:33:07 +00:00
Mock tensorboard callbacks for all freqAI tests
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import platform
|
||||
from copy import deepcopy
|
||||
from pathlib import Path
|
||||
from typing import Any, Dict
|
||||
@@ -14,6 +15,19 @@ from freqtrade.resolvers.freqaimodel_resolver import FreqaiModelResolver
|
||||
from tests.conftest import get_patched_exchange
|
||||
|
||||
|
||||
def is_mac() -> bool:
|
||||
machine = platform.system()
|
||||
return "Darwin" in machine
|
||||
|
||||
|
||||
@pytest.fixture(scope="function", autouse=True)
|
||||
def patch_tensorboard_maconly(mocker):
|
||||
if is_mac():
|
||||
# MacOS CI is not friendly to tensorboard
|
||||
mocker.patch('freqtrade.freqai.tensorboard.tensorboard.SummaryWriter')
|
||||
mocker.patch('freqtrade.freqai.tensorboard.tensorboard.TensorBoardCallback.after_iteration')
|
||||
|
||||
|
||||
@pytest.fixture(scope="function")
|
||||
def freqai_conf(default_conf, tmpdir):
|
||||
freqaiconf = deepcopy(default_conf)
|
||||
|
||||
@@ -15,7 +15,7 @@ from freqtrade.optimize.backtesting import Backtesting
|
||||
from freqtrade.persistence import Trade
|
||||
from freqtrade.plugins.pairlistmanager import PairListManager
|
||||
from tests.conftest import EXMS, create_mock_trades, get_patched_exchange, log_has_re
|
||||
from tests.freqai.conftest import (get_patched_freqai_strategy, make_rl_config,
|
||||
from tests.freqai.conftest import (get_patched_freqai_strategy, is_mac, make_rl_config,
|
||||
mock_pytorch_mlp_model_training_parameters)
|
||||
|
||||
|
||||
@@ -28,11 +28,6 @@ def is_arm() -> bool:
|
||||
return "arm" in machine or "aarch64" in machine
|
||||
|
||||
|
||||
def is_mac() -> bool:
|
||||
machine = platform.system()
|
||||
return "Darwin" in machine
|
||||
|
||||
|
||||
def can_run_model(model: str) -> None:
|
||||
if (is_arm() or is_py11()) and "Catboost" in model:
|
||||
pytest.skip("CatBoost is not supported on ARM.")
|
||||
@@ -59,10 +54,6 @@ def test_extract_data_and_train_model_Standard(mocker, freqai_conf, model, pca,
|
||||
dbscan, float32, can_short, shuffle, buffer):
|
||||
|
||||
can_run_model(model)
|
||||
if is_mac():
|
||||
# MacOS CI is not friendly to tensorboard
|
||||
mocker.patch('freqtrade.freqai.tensorboard.tensorboard.SummaryWriter')
|
||||
mocker.patch('freqtrade.freqai.tensorboard.tensorboard.TensorBoardCallback.after_iteration')
|
||||
|
||||
model_save_ext = 'joblib'
|
||||
freqai_conf.update({"freqaimodel": model})
|
||||
|
||||
Reference in New Issue
Block a user