From 3598279c5f224445abce100ebed056f849229bc5 Mon Sep 17 00:00:00 2001 From: Daniel Kutik Date: Sun, 22 Jun 2025 10:10:42 +0200 Subject: [PATCH] Test: Fix test_subcmds_sync.py for Python <= 3.7 This change fixes the failing test_interleaved_shared_objdir_serial in Python 3.7 and earlier. In the test the execute_mock.call_args could return either a tuple of arguments or a mock._Call object, depending on the Python version. In Python 3.7 and below, a mock._Call object was returned, causing the test to fail when directly accessing call_args.args. By checking isinstance(call_args, mock._Call), this commit ensures compatibility across Python versions. Change-Id: I6790dffc40cebb7dda47b0f477a1e1586b9da239 --- tests/test_subcmds_sync.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/test_subcmds_sync.py b/tests/test_subcmds_sync.py index e7213ed90..3dacaacb1 100644 --- a/tests/test_subcmds_sync.py +++ b/tests/test_subcmds_sync.py @@ -659,7 +659,10 @@ class InterleavedSyncTest(unittest.TestCase): ) execute_mock.assert_called_once() - jobs_arg, _, work_items = execute_mock.call_args.args + call_args = execute_mock.call_args + if isinstance(call_args, mock._Call): + call_args = call_args[0] + jobs_arg, _, work_items = call_args self.assertEqual(jobs_arg, 2) work_items_sets = {frozenset(item) for item in work_items} expected_sets = {frozenset([0, 2]), frozenset([1])}