From e1c0c6af7dcf94fe7dc6a982059b6f1a6ccbd2de Mon Sep 17 00:00:00 2001 From: Matthias Date: Tue, 17 Dec 2019 10:51:49 +0100 Subject: [PATCH 1/4] fix random-seed to failing one --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f6a111944..40a6fd075 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -69,7 +69,7 @@ jobs: COVERALLS_SERVICE_NAME: travis-ci TRAVIS: "true" run: | - pytest --random-order --cov=freqtrade --cov-config=.coveragerc + pytest --random-order --cov=freqtrade --cov-config=.coveragerc --random-order-seed=834267 # Allow failure for coveralls # Fake travis environment to get coveralls working correctly export TRAVIS_PULL_REQUEST="https://github.com/${GITHUB_REPOSITORY}/pull/$(cat $GITHUB_EVENT_PATH | jq -r .number)" From 2e2f084f662e02eebc6cb083deb1dbeac145e840 Mon Sep 17 00:00:00 2001 From: Matthias Date: Tue, 17 Dec 2019 11:07:59 +0100 Subject: [PATCH 2/4] Try to clear caplog ... --- .github/workflows/ci.yml | 2 +- tests/test_utils.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 40a6fd075..f6a111944 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -69,7 +69,7 @@ jobs: COVERALLS_SERVICE_NAME: travis-ci TRAVIS: "true" run: | - pytest --random-order --cov=freqtrade --cov-config=.coveragerc --random-order-seed=834267 + pytest --random-order --cov=freqtrade --cov-config=.coveragerc # Allow failure for coveralls # Fake travis environment to get coveralls working correctly export TRAVIS_PULL_REQUEST="https://github.com/${GITHUB_REPOSITORY}/pull/$(cat $GITHUB_EVENT_PATH | jq -r .number)" diff --git a/tests/test_utils.py b/tests/test_utils.py index feba1ed59..40ca9ac02 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -444,6 +444,9 @@ def test_create_datadir_failed(caplog): def test_create_datadir(caplog, mocker): + # Ensure that caplog is empty before starting ... + # Should prevent random failures. + caplog.clear() cud = mocker.patch("freqtrade.utils.create_userdata_dir", MagicMock()) csf = mocker.patch("freqtrade.utils.copy_sample_files", MagicMock()) args = [ From 8513a5e2d68721e896e4d3337f8be162847d8c86 Mon Sep 17 00:00:00 2001 From: Matthias Date: Tue, 17 Dec 2019 11:35:39 +0100 Subject: [PATCH 3/4] Fix failures in test_main --- .github/workflows/ci.yml | 2 +- tests/test_main.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f6a111944..628f169c2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -139,7 +139,7 @@ jobs: - name: Tests run: | - pytest --random-order --cov=freqtrade --cov-config=.coveragerc + pytest --random-order --cov=freqtrade --cov-config=.coveragerc --random-order-seed=781055 - name: Backtesting run: | diff --git a/tests/test_main.py b/tests/test_main.py index 4e97c375d..03e6a7ce9 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -79,6 +79,7 @@ def test_main_keyboard_interrupt(mocker, default_conf, caplog) -> None: mocker.patch('freqtrade.worker.Worker._worker', MagicMock(side_effect=KeyboardInterrupt)) patched_configuration_load_config_file(mocker, default_conf) mocker.patch('freqtrade.freqtradebot.RPCManager', MagicMock()) + mocker.patch('freqtrade.wallets.Wallets.update', MagicMock()) mocker.patch('freqtrade.freqtradebot.persistence.init', MagicMock()) args = ['trade', '-c', 'config.json.example'] @@ -98,6 +99,7 @@ def test_main_operational_exception(mocker, default_conf, caplog) -> None: MagicMock(side_effect=OperationalException('Oh snap!')) ) patched_configuration_load_config_file(mocker, default_conf) + mocker.patch('freqtrade.wallets.Wallets.update', MagicMock()) mocker.patch('freqtrade.freqtradebot.RPCManager', MagicMock()) mocker.patch('freqtrade.freqtradebot.persistence.init', MagicMock()) @@ -120,6 +122,7 @@ def test_main_reload_conf(mocker, default_conf, caplog) -> None: OperationalException("Oh snap!")]) mocker.patch('freqtrade.worker.Worker._worker', worker_mock) patched_configuration_load_config_file(mocker, default_conf) + mocker.patch('freqtrade.wallets.Wallets.update', MagicMock()) reconfigure_mock = mocker.patch('freqtrade.worker.Worker._reconfigure', MagicMock()) mocker.patch('freqtrade.freqtradebot.RPCManager', MagicMock()) @@ -143,6 +146,7 @@ def test_reconfigure(mocker, default_conf) -> None: 'freqtrade.worker.Worker._worker', MagicMock(side_effect=OperationalException('Oh snap!')) ) + mocker.patch('freqtrade.wallets.Wallets.update', MagicMock()) patched_configuration_load_config_file(mocker, default_conf) mocker.patch('freqtrade.freqtradebot.RPCManager', MagicMock()) mocker.patch('freqtrade.freqtradebot.persistence.init', MagicMock()) From bbb05b52862dbd04d169a6df010683207545b92b Mon Sep 17 00:00:00 2001 From: Matthias Date: Tue, 17 Dec 2019 11:51:50 +0100 Subject: [PATCH 4/4] Remove fixed random order --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 628f169c2..f6a111944 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -139,7 +139,7 @@ jobs: - name: Tests run: | - pytest --random-order --cov=freqtrade --cov-config=.coveragerc --random-order-seed=781055 + pytest --random-order --cov=freqtrade --cov-config=.coveragerc - name: Backtesting run: |