Remove state attr from Worker

This commit is contained in:
hroff-1902
2020-01-29 17:08:36 +03:00
parent e1356fb80e
commit 68771a7861
3 changed files with 6 additions and 14 deletions

View File

@@ -797,10 +797,10 @@ def test_process_operational_exception(default_conf, ticker, mocker) -> None:
worker = Worker(args=None, config=default_conf)
patch_get_signal(worker.freqtrade)
assert worker.state == State.RUNNING
assert worker.freqtrade.state == State.RUNNING
worker._process()
assert worker.state == State.STOPPED
assert worker.freqtrade.state == State.STOPPED
assert 'OperationalException' in msg_mock.call_args_list[-1][0][0]['status']
@@ -3631,7 +3631,7 @@ def test_startup_state(default_conf, mocker):
}
mocker.patch('freqtrade.exchange.Exchange.exchange_has', MagicMock(return_value=True))
worker = get_patched_worker(mocker, default_conf)
assert worker.state is State.RUNNING
assert worker.freqtrade.state is State.RUNNING
def test_startup_trade_reinit(default_conf, edge_conf, mocker):

View File

@@ -11,11 +11,11 @@ from tests.conftest import get_patched_worker, log_has
def test_worker_state(mocker, default_conf, markets) -> None:
mocker.patch('freqtrade.exchange.Exchange.markets', PropertyMock(return_value=markets))
worker = get_patched_worker(mocker, default_conf)
assert worker.state is State.RUNNING
assert worker.freqtrade.state is State.RUNNING
default_conf.pop('initial_state')
worker = Worker(args=None, config=default_conf)
assert worker.state is State.STOPPED
assert worker.freqtrade.state is State.STOPPED
def test_worker_running(mocker, default_conf, caplog) -> None:
@@ -41,7 +41,7 @@ def test_worker_stopped(mocker, default_conf, caplog) -> None:
mock_sleep = mocker.patch('time.sleep', return_value=None)
worker = get_patched_worker(mocker, default_conf)
worker.state = State.STOPPED
worker.freqtrade.state = State.STOPPED
state = worker._worker(old_state=State.RUNNING)
assert state is State.STOPPED
assert log_has('Changing state to: STOPPED', caplog)