From 9fb3517adc9b6d078fe3fc00d7393a79fcddae15 Mon Sep 17 00:00:00 2001 From: Matthias Date: Mon, 5 Sep 2022 21:08:01 +0200 Subject: [PATCH] Fix non-resolvable freqai test this test could never succeed in UI's as the name was constantly changing. --- tests/freqai/test_freqai_datakitchen.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/tests/freqai/test_freqai_datakitchen.py b/tests/freqai/test_freqai_datakitchen.py index 44c721515..908223c20 100644 --- a/tests/freqai/test_freqai_datakitchen.py +++ b/tests/freqai/test_freqai_datakitchen.py @@ -1,5 +1,5 @@ -import datetime import shutil +from datetime import datetime, timedelta, timezone from pathlib import Path import pytest @@ -56,16 +56,13 @@ def test_split_timerange( shutil.rmtree(Path(dk.full_path)) -@pytest.mark.parametrize( - "timestamp, expected", - [ - (datetime.datetime.now(tz=datetime.timezone.utc).timestamp() - 7200, True), - (datetime.datetime.now(tz=datetime.timezone.utc).timestamp(), False), - ], -) -def test_check_if_model_expired(mocker, freqai_conf, timestamp, expected): +def test_check_if_model_expired(mocker, freqai_conf): + dk = get_patched_data_kitchen(mocker, freqai_conf) - assert dk.check_if_model_expired(timestamp) == expected + now = datetime.now(tz=timezone.utc).timestamp() + assert dk.check_if_model_expired(now) is False + now = (datetime.now(tz=timezone.utc) - timedelta(hours=2)).timestamp() + assert dk.check_if_model_expired(now) is True shutil.rmtree(Path(dk.full_path))