From c8dac103083a7bf43ec466491792cfd07af3a86d Mon Sep 17 00:00:00 2001 From: James Valleroy Date: Sat, 16 Dec 2023 09:32:05 -0500 Subject: [PATCH] tests: operation: Fix mock has_calls assertion In Python 3.12, has_calls is not a valid assertion. Closes: #1058421 Tests: - Run "python3.12 -m pytest plinth/tests/test_operation.py" in unstable container. All tests are passed. Signed-off-by: James Valleroy Reviewed-by: Sunil Mohan Adapa --- plinth/tests/test_operation.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plinth/tests/test_operation.py b/plinth/tests/test_operation.py index d3bd45ce9..429d62170 100644 --- a/plinth/tests/test_operation.py +++ b/plinth/tests/test_operation.py @@ -45,7 +45,7 @@ def test_operation_default_initialization(update_notification): assert operation.thread_data == {} assert isinstance(operation.thread, threading.Thread) assert operation.thread._operation == operation - assert update_notification.has_calls([call()]) + update_notification.assert_has_calls([call()]) @patch('plinth.operation.Operation._update_notification') @@ -64,7 +64,7 @@ def test_operation_initialization(update_notification): assert operation._message is None assert operation.exception is None assert operation.thread_data == {'data1': 'datavalue1'} - assert update_notification.has_calls([call()]) + update_notification.assert_has_calls([call()]) def test_operation_str(): @@ -87,7 +87,7 @@ def test_successful_operation(update_notification): assert operation.state == Operation.State.COMPLETED assert operation.return_value == 'test-return' on_complete.assert_has_calls([call(operation)]) - assert update_notification.has_calls([call(), call()]) + update_notification.assert_has_calls([call(), call()]) @patch('plinth.operation.Operation._update_notification') @@ -106,7 +106,7 @@ def test_error_operation(update_notification): assert operation.state == Operation.State.COMPLETED assert operation.exception == target.side_effect on_complete.assert_has_calls([call(operation)]) - assert update_notification.has_calls([call(), call()]) + update_notification.assert_has_calls([call(), call()]) @patch('plinth.operation.Operation._update_notification') @@ -173,7 +173,7 @@ def test_updating_operation(update_notification): assert operation._message == 'message1' assert operation.exception == exception - assert update_notification.has_calls([call(), call(), call()]) + update_notification.assert_has_calls([call(), call(), call()]) @patch('plinth.app.App.get')