diff --git a/src/tomato/tomato/__init__.py b/src/tomato/tomato/__init__.py index db4033b..a200346 100644 --- a/src/tomato/tomato/__init__.py +++ b/src/tomato/tomato/__init__.py @@ -249,12 +249,13 @@ def stop( req.connect(f"tcp://127.0.0.1:{port}") req.send_pyobj(dict(cmd="stop")) rep = req.recv_pyobj() - if rep.msg == "stop": + logger.debug(f"{rep=}") + if rep.data == "stop": return Reply( success=True, msg=f"tomato-daemon on port {port} was instructed to stop", ) - elif rep.msg == "running": + elif rep.data == "running": return Reply( success=False, msg=f"tomato-daemon on port {port} cannot stop as jobs are running", @@ -263,7 +264,7 @@ def stop( else: return Reply( success=False, - msg=f"unknown error: {rep.msg}", + msg=f"unknown error: {rep}", data=rep.data, ) else: diff --git a/tests/test_01_tomato.py b/tests/test_01_tomato.py index 9c9f750..1ade0fb 100644 --- a/tests/test_01_tomato.py +++ b/tests/test_01_tomato.py @@ -148,7 +148,7 @@ def test_tomato_stop(start_tomato_daemon, stop_tomato_daemon): assert wait_until_tomato_running(port=PORT, timeout=5000) ret = tomato.stop(**kwargs) assert ret.success - wait_until_tomato_stopped(port=PORT, timeout=5000) + assert wait_until_tomato_stopped(port=PORT, timeout=5000) assert Path("daemon_12345.log").exists() with Path("daemon_12345.log").open() as logf: