Lines Matching refs:mock
10 import mock
41 instance = mock.Mock()
42 testsuite = mock.Mock()
45 platform = mock.Mock()
57 env = mock.Mock()
58 options = mock.Mock()
66 jobserver = mock.Mock()
98 @mock.patch("os.path.exists")
245 testsuite_mock = mock.Mock()
246 platform_mock = mock.Mock()
297 process_mock = mock.Mock(
299 communicate=mock.Mock(
307 testsuite_mock = mock.Mock()
308 platform_mock = mock.Mock()
312 jobserver_mock = mock.Mock(
313 popen=mock.Mock(side_effect=mock_popen)
315 instance_mock = mock.Mock(add_missing_case_status=mock.Mock())
325 cmake.options = mock.Mock()
330 popen_mock = mock.Mock(side_effect=mock_popen)
331 change_mock = mock.Mock()
333 with mock.patch('sys.platform', sys_platform), \
334 mock.patch('shutil.which', return_value=cmake_path), \
335 mock.patch('twisterlib.runner.change_skip_to_error_if_integration',
337 mock.patch('builtins.open', mock.mock_open()), \
338 mock.patch('subprocess.Popen', popen_mock):
429 process_mock = mock.Mock(
431 communicate=mock.Mock(
439 testsuite_mock = mock.Mock()
441 platform_mock = mock.Mock()
445 jobserver_mock = mock.Mock(
446 popen=mock.Mock(side_effect=mock_popen)
448 instance_mock = mock.Mock(add_missing_case_status=mock.Mock())
454 instance_mock.testsuite = mock.Mock()
457 instance_mock.testcases = [mock.Mock(), mock.Mock()]
465 cmake.options = mock.Mock()
468 cmake.env = mock.Mock()
473 popen_mock = mock.Mock(side_effect=mock_popen)
474 change_mock = mock.Mock()
476 with mock.patch('sys.platform', sys_platform), \
477 mock.patch('shutil.which', return_value=cmake_path), \
478 mock.patch('twisterlib.runner.change_skip_to_error_if_integration',
480 mock.patch('twisterlib.runner.canonical_zephyr_base',
482 mock.patch('builtins.open', mock.mock_open()), \
483 mock.patch('subprocess.Popen', popen_mock):
677 dom = mock.Mock()
679 res = mock.Mock(get_default_domain=mock.Mock(return_value=dom))
685 cache_elem = mock.Mock()
700 return mock.mock_open(read_data=rd)()
711 return mock.Mock()
713 testsuite_mock = mock.Mock()
716 platform_mock = mock.Mock()
724 instance_mock = mock.Mock()
727 fb.env = mock.Mock()
728 fb.env.options = mock.Mock()
734 with mock.patch('twisterlib.runner.Domains.from_file',
736 mock.patch('twisterlib.runner.CMakeCache.from_file',
738 mock.patch('builtins.open', mock_open), \
739 mock.patch('expr_parser.parse', mock_parser), \
740 mock.patch('pickle.load', mock_pickle), \
741 mock.patch('os.path.exists', return_value=edt_exists), \
742 mock.patch('os.environ', environ_mock), \
786 return mock.mock_open(read_data='file contents')()
796 env_mock = mock.Mock()
797 instance_mock = mock.Mock()
800 with mock.patch('builtins.open', mock_open), \
801 mock.patch('os.path.realpath', mock_realpath), \
802 mock.patch('os.path.abspath', mock_abspath):
854 env_mock = mock.Mock()
855 instance_mock = mock.Mock()
861 log_info_mock = mock.Mock()
863 with mock.patch('os.path.exists', mock_exists), \
864 mock.patch('os.path.getsize', mock_getsize), \
865 mock.patch('twisterlib.runner.ProjectBuilder.log_info', log_info_mock):
868 log_info_mock.assert_called_with(expected_log, mock.ANY)
876 mock.ANY,
877 mock.ANY,
878 mock.ANY,
879 mock.ANY,
880 mock.ANY,
881 mock.ANY,
882 mock.ANY,
883 mock.ANY,
884 mock.ANY,
885 mock.ANY,
886 mock.ANY,
888 {'op': 'report', 'test': mock.ANY},
897 mock.ANY,
898 mock.ANY,
899 mock.ANY,
900 mock.ANY,
901 mock.ANY,
902 mock.ANY,
903 mock.ANY,
905 mock.ANY,
906 mock.ANY,
907 mock.ANY,
908 mock.ANY,
910 {'op': 'report', 'test': mock.ANY},
919 mock.ANY,
920 mock.ANY,
921 mock.ANY,
922 mock.ANY,
923 mock.ANY,
924 mock.ANY,
925 mock.ANY,
927 mock.ANY,
928 mock.ANY,
929 mock.ANY,
930 mock.ANY,
932 {'op': 'cmake', 'test': mock.ANY},
934 mock.ANY,
942 mock.ANY,
943 mock.ANY,
944 mock.ANY,
945 mock.ANY,
946 mock.ANY,
947 mock.ANY,
948 mock.ANY,
949 mock.ANY,
950 mock.ANY,
951 mock.ANY,
952 mock.ANY,
954 {'op': 'report', 'test': mock.ANY},
963 mock.ANY,
964 mock.ANY,
965 mock.ANY,
967 mock.ANY,
968 mock.ANY,
969 mock.ANY,
970 mock.ANY,
971 mock.ANY,
972 mock.ANY,
973 mock.ANY,
974 mock.ANY,
976 {'op': 'report', 'test': mock.ANY},
978 mock.ANY,
985 mock.ANY,
986 mock.ANY,
987 mock.ANY,
989 mock.ANY,
990 mock.ANY,
991 mock.ANY,
992 mock.ANY,
993 mock.ANY,
994 mock.ANY,
995 mock.ANY,
996 mock.ANY,
998 {'op': 'report', 'test': mock.ANY},
1000 mock.ANY,
1007 mock.ANY,
1008 mock.ANY,
1009 mock.ANY,
1011 mock.ANY,
1012 mock.ANY,
1013 mock.ANY,
1015 mock.ANY,
1016 mock.ANY,
1017 mock.ANY,
1018 mock.ANY,
1020 {'op': 'report', 'test': mock.ANY},
1029 mock.ANY,
1030 mock.ANY,
1031 mock.ANY,
1033 mock.ANY,
1034 mock.ANY,
1035 mock.ANY,
1037 mock.ANY,
1038 mock.ANY,
1039 mock.ANY,
1040 mock.ANY,
1042 {'op': 'build', 'test': mock.ANY},
1044 mock.ANY,
1050 mock.ANY,
1052 mock.ANY,
1053 mock.ANY,
1054 mock.ANY,
1055 mock.ANY,
1056 mock.ANY,
1057 mock.ANY,
1058 mock.ANY,
1060 mock.ANY,
1061 mock.ANY,
1062 mock.ANY,
1064 {'op': 'report', 'test': mock.ANY},
1073 mock.ANY,
1074 mock.ANY,
1075 mock.ANY,
1076 mock.ANY,
1077 mock.ANY,
1078 mock.ANY,
1079 mock.ANY,
1080 mock.ANY,
1082 mock.ANY,
1083 mock.ANY,
1084 mock.ANY,
1087 {'op': 'gather_metrics', 'test': mock.ANY},
1088 mock.ANY,
1089 mock.ANY,
1091 (TwisterStatus.SKIP, mock.ANY)
1096 mock.ANY,
1097 mock.ANY,
1098 mock.ANY,
1099 mock.ANY,
1100 mock.ANY,
1101 mock.ANY,
1102 mock.ANY,
1103 mock.ANY,
1105 mock.ANY,
1106 mock.ANY,
1107 mock.ANY,
1109 {'op': 'report', 'test': mock.ANY},
1111 mock.ANY,
1113 (TwisterStatus.BLOCK, mock.ANY)
1118 mock.ANY,
1119 mock.ANY,
1120 mock.ANY,
1121 mock.ANY,
1122 mock.ANY,
1123 mock.ANY,
1124 mock.ANY,
1125 mock.ANY,
1127 mock.ANY,
1128 mock.ANY,
1129 mock.ANY,
1132 {'op': 'gather_metrics', 'test': mock.ANY},
1133 mock.ANY,
1134 mock.ANY,
1141 mock.ANY,
1142 mock.ANY,
1143 mock.ANY,
1144 mock.ANY,
1145 mock.ANY,
1146 mock.ANY,
1147 mock.ANY,
1148 mock.ANY,
1150 mock.ANY,
1151 mock.ANY,
1155 {'op': 'report', 'test': mock.ANY},
1163 mock.ANY,
1164 mock.ANY,
1167 mock.ANY,
1168 mock.ANY,
1169 mock.ANY,
1170 mock.ANY,
1171 mock.ANY,
1172 mock.ANY,
1174 mock.ANY,
1175 mock.ANY,
1177 {'op': 'run', 'test': mock.ANY},
1178 mock.ANY,
1179 mock.ANY,
1185 mock.ANY,
1186 mock.ANY,
1189 mock.ANY,
1190 mock.ANY,
1191 mock.ANY,
1192 mock.ANY,
1193 mock.ANY,
1194 mock.ANY,
1196 mock.ANY,
1197 mock.ANY,
1199 {'op': 'report', 'test': mock.ANY},
1200 mock.ANY,
1201 mock.ANY,
1207 mock.ANY,
1208 mock.ANY,
1211 mock.ANY,
1212 mock.ANY,
1213 mock.ANY,
1214 mock.ANY,
1215 mock.ANY,
1218 mock.ANY,
1219 mock.ANY,
1221 {'op': 'report', 'test': mock.ANY},
1231 mock.ANY,
1232 mock.ANY,
1233 mock.ANY,
1234 mock.ANY,
1235 mock.ANY,
1236 mock.ANY,
1237 mock.ANY,
1238 mock.ANY,
1239 mock.ANY,
1241 mock.ANY,
1244 {'op': 'report', 'test': mock.ANY, 'status': 'success', 'reason': 'OK'},
1253 mock.ANY,
1254 mock.ANY,
1255 mock.ANY,
1256 mock.ANY,
1257 mock.ANY,
1258 mock.ANY,
1259 mock.ANY,
1260 mock.ANY,
1261 mock.ANY,
1262 mock.ANY,
1264 mock.ANY,
1270 mock.ANY,
1276 mock.ANY,
1277 mock.ANY,
1278 mock.ANY,
1279 mock.ANY,
1280 mock.ANY,
1283 mock.ANY,
1284 mock.ANY,
1285 mock.ANY,
1286 mock.ANY,
1287 mock.ANY,
1288 mock.ANY,
1290 {'op': 'cleanup', 'mode': 'device', 'test': mock.ANY},
1291 mock.ANY,
1292 mock.ANY,
1299 mock.ANY,
1300 mock.ANY,
1301 mock.ANY,
1302 mock.ANY,
1306 mock.ANY,
1307 mock.ANY,
1308 mock.ANY,
1309 mock.ANY,
1310 mock.ANY,
1312 {'op': 'cleanup', 'mode': 'passed', 'test': mock.ANY},
1313 mock.ANY,
1314 mock.ANY,
1320 mock.ANY,
1321 mock.ANY,
1322 mock.ANY,
1323 mock.ANY,
1324 mock.ANY,
1328 mock.ANY,
1329 mock.ANY,
1330 mock.ANY,
1331 mock.ANY,
1332 mock.ANY,
1334 {'op': 'cleanup', 'mode': 'all', 'test': mock.ANY},
1335 mock.ANY,
1336 mock.ANY,
1342 mock.ANY,
1343 mock.ANY,
1344 mock.ANY,
1345 mock.ANY,
1346 mock.ANY,
1350 mock.ANY,
1351 mock.ANY,
1352 mock.ANY,
1353 mock.ANY,
1354 mock.ANY,
1357 mock.ANY,
1358 mock.ANY,
1364 mock.ANY,
1365 mock.ANY,
1366 mock.ANY,
1367 mock.ANY,
1368 mock.ANY,
1369 mock.ANY,
1370 mock.ANY,
1371 mock.ANY,
1372 mock.ANY,
1373 mock.ANY,
1374 mock.ANY,
1375 mock.ANY,
1376 mock.ANY,
1379 mock.ANY,
1380 mock.ANY,
1386 mock.ANY,
1387 mock.ANY,
1388 mock.ANY,
1389 mock.ANY,
1390 mock.ANY,
1391 mock.ANY,
1392 mock.ANY,
1393 mock.ANY,
1394 mock.ANY,
1395 mock.ANY,
1396 mock.ANY,
1397 mock.ANY,
1398 mock.ANY,
1401 mock.ANY,
1402 mock.ANY,
1408 mock.ANY,
1410 mock.ANY,
1411 mock.ANY,
1412 mock.ANY,
1413 mock.ANY,
1414 mock.ANY,
1415 mock.ANY,
1416 mock.ANY,
1417 mock.ANY,
1418 mock.ANY,
1419 mock.ANY,
1420 mock.ANY,
1423 mock.ANY,
1424 mock.ANY,
1430 mock.ANY,
1432 mock.ANY,
1433 mock.ANY,
1434 mock.ANY,
1435 mock.ANY,
1436 mock.ANY,
1437 mock.ANY,
1438 mock.ANY,
1439 mock.ANY,
1440 mock.ANY,
1441 mock.ANY,
1442 mock.ANY,
1445 mock.ANY,
1446 mock.ANY,
1512 instance_mock = mock.Mock()
1517 instance_mock.handler = mock.Mock()
1520 env_mock = mock.Mock()
1523 pb.options = mock.Mock()
1529 pb.cmake = mock.Mock(return_value=cmake_res)
1530 pb.build = mock.Mock(return_value=build_res)
1531 pb.determine_testcases = mock.Mock(side_effect=mock_determine_testcases)
1533 pb.report_out = mock.Mock()
1534 pb.cleanup_artifacts = mock.Mock()
1535 pb.cleanup_device_testing_artifacts = mock.Mock()
1536 pb.run = mock.Mock()
1537 pb.gather_metrics = mock.Mock(return_value=metrics_res)
1539 pipeline_mock = mock.Mock(put=mock.Mock(side_effect=mock_pipeline_put))
1540 done_mock = mock.Mock()
1541 lock_mock = mock.Mock(
1542 __enter__=mock.Mock(return_value=(mock.Mock(), mock.Mock())),
1543 __exit__=mock.Mock(return_value=None)
1545 results_mock = mock.Mock()
1557 … assert results_mock.filtered_runtime_increment.call_args_list == [mock.call()] * expected_skipped
1645 symbols_mock = [mock.Mock(n=name) for name in symbols_names]
1649 sections_mock = [mock.Mock(spec=SymbolTableSection)]
1650 sections_mock[0].iter_symbols = mock.Mock(return_value=symbols_mock)
1652 elf_mock = mock.Mock()
1653 elf_mock().iter_sections = mock.Mock(return_value=sections_mock)
1655 results_mock = mock.Mock()
1657 instance_mock = mock.Mock()
1662 instance_mock.compose_case_name = mock.Mock(side_effect=iter(added_tcs))
1666 with mock.patch('twisterlib.runner.ELFFile', elf_mock), \
1667 mock.patch('builtins.open', mock.mock_open()):
1671 [mock.call(name=x) for x in added_tcs]
1674 [mock.call(name=x) for x in added_tcs]
1730 instance_mock = mock.Mock()
1732 env_mock = mock.Mock()
1735 pb.options = mock.Mock(runtime_artifact_cleanup=runtime_artifact_cleanup)
1750 instance_mock = mock.Mock()
1754 env_mock = mock.Mock()
1757 pb._get_binaries = mock.Mock(return_value=bins)
1758 pb.cleanup_artifacts = mock.Mock()
1759 pb._sanitize_files = mock.Mock()
1804 instance_mock = mock.Mock()
1807 instance_mock.platform = mock.Mock()
1809 env_mock = mock.Mock()
1812 pb._get_binaries_from_runners = mock.Mock(return_value=runner_binaries)
1859 instance_mock = mock.Mock()
1861 env_mock = mock.Mock()
1865 with mock.patch('os.path.exists', mock_exists), \
1866 mock.patch('builtins.open', mock.mock_open()), \
1867 mock.patch('yaml.load', return_value=runners_content):
1878 instance_mock = mock.Mock()
1879 env_mock = mock.Mock()
1882 pb._sanitize_runners_file = mock.Mock()
1883 pb._sanitize_zephyr_base_from_files = mock.Mock()
1922 instance_mock = mock.Mock()
1924 env_mock = mock.Mock()
1928 with mock.patch('os.path.exists', mock_exists), \
1929 mock.patch('builtins.open',
1930 mock.mock_open(read_data=runners_text)) as f:
1942 'CMakeCache.txt': mock.mock_open(
1952 os.path.join('zephyr', 'runners.yaml'): mock.mock_open(
1984 instance_mock = mock.Mock()
1986 env_mock = mock.Mock()
1990 with mock.patch('os.path.exists', mock_exists), \
1991 mock.patch('builtins.open', mock_open), \
1992 mock.patch('twisterlib.runner.canonical_zephyr_base',
2069 instance_mock = mock.Mock()
2080 skip_mock_tc = mock.Mock(status=TwisterStatus.SKIP, reason=None)
2082 unknown_mock_tc = mock.Mock(status=mock.Mock(value='dummystatus'), reason=None)
2087 env_mock = mock.Mock()
2093 pb.log_info_file = mock.Mock()
2095 results_mock = mock.Mock(
2137 assert results_mock.cases_increment.call_args_list == [mock.call(25)]
2166 handler = mock.Mock(ready=True, args=['dummy_handler'])
2173 with mock.patch('os.path.exists', return_value=True):
2197 instance_mock = mock.Mock()
2200 env_mock = mock.Mock()
2209 pb.cmake_assemble_args = mock.Mock(return_value=['dummy'])
2210 cmake_res_mock = mock.Mock()
2211 pb.run_cmake = mock.Mock(return_value=cmake_res_mock)
2229 instance_mock = mock.Mock()
2231 env_mock = mock.Mock()
2236 pb.run_build = mock.Mock(return_value={'dummy': 'dummy'})
2315 pytest_mock = mock.Mock(spec=Pytest)
2316 harness_mock = mock.Mock()
2324 instance_mock = mock.Mock()
2325 instance_mock.handler.get_test_timeout = mock.Mock(return_value=60)
2329 instance_mock.handler.duts = [mock.Mock(name='dummy dut')]
2333 env_mock = mock.Mock()
2340 pb.parse_generated = mock.Mock()
2342 with mock.patch('twisterlib.runner.HarnessImporter.get_harness',
2385 instance_mock = mock.Mock()
2387 env_mock = mock.Mock()
2393 pb.calc_size = mock.Mock()
2409 (TwisterStatus.ERROR, mock.ANY, False, False, False),
2410 (TwisterStatus.FAIL, mock.ANY, False, False, False),
2411 (TwisterStatus.SKIP, mock.ANY, False, False, False),
2422 ids=[x[0] + (', ' + x[1]) if x[1] != mock.ANY else '' for x in TESTDATA_16]
2431 size_calc_mock = mock.Mock()
2433 instance_mock = mock.Mock()
2437 instance_mock.calculate_sizes = mock.Mock(return_value=size_calc_mock)
2499 jobclient_mock = mock.Mock(jobs=32)
2504 instances = {'dummy instance': mock.Mock(metrics={'k': 'v'})}
2505 suites = [mock.Mock()]
2506 env_mock = mock.Mock()
2516 tr.update_counting_before_pipeline = mock.Mock()
2517 tr.execute = mock.Mock()
2518 tr.show_brief = mock.Mock()
2520 gnumakejobserver_mock = mock.Mock()
2522 jobclient_mock = mock.Mock()
2527 done_instance = mock.Mock(
2533 manager_mock = mock.Mock()
2534 manager_mock().LifoQueue = mock.Mock(
2538 results_mock = mock.Mock()
2548 with mock.patch('twisterlib.runner.ExecutionCounter', results_mock), \
2549 mock.patch('twisterlib.runner.BaseManager', manager_mock), \
2550 mock.patch('twisterlib.runner.GNUMakeJobClient.from_environ',
2552 mock.patch('twisterlib.runner.GNUMakeJobServer',
2554 mock.patch('twisterlib.runner.JobClient', jobclient_mock), \
2555 mock.patch('multiprocessing.cpu_count', return_value=8), \
2556 mock.patch('sys.platform', platform), \
2557 mock.patch('time.sleep', mock.Mock()), \
2558 mock.patch('os.name', os_name):
2577 'dummy1': mock.Mock(
2580 testsuite=mock.Mock(
2581 testcases=[mock.Mock()]
2584 'dummy2': mock.Mock(
2587 testsuite=mock.Mock(
2588 testcases=[mock.Mock(), mock.Mock(), mock.Mock(), mock.Mock()]
2591 'dummy3': mock.Mock(
2594 testsuite=mock.Mock(
2595 testcases=[mock.Mock()]
2598 'dummy4': mock.Mock(
2601 testsuite=mock.Mock(
2602 testcases=[mock.Mock()]
2605 'dummy5': mock.Mock(
2608 testsuite=mock.Mock(
2609 testcases=[mock.Mock()]
2613 suites = [mock.Mock()]
2614 env_mock = mock.Mock()
2617 tr.results = mock.Mock(
2663 'dummy1': mock.Mock(),
2664 'dummy2': mock.Mock(),
2665 'dummy3': mock.Mock(),
2666 'dummy4': mock.Mock(),
2667 'dummy5': mock.Mock()
2669 suites = [mock.Mock(), mock.Mock()]
2670 env_mock = mock.Mock()
2673 tr.results = mock.Mock(
2690 (False, False, False, [{'op': 'cmake', 'test': mock.ANY}]),
2691 (False, False, True, [{'op': 'filter', 'test': mock.ANY},
2692 {'op': 'cmake', 'test': mock.ANY}]),
2693 (False, True, True, [{'op': 'run', 'test': mock.ANY},
2694 {'op': 'run', 'test': mock.ANY}]),
2695 (False, True, False, [{'op': 'run', 'test': mock.ANY}]),
2696 (True, True, False, [{'op': 'cmake', 'test': mock.ANY}]),
2697 (True, True, True, [{'op': 'filter', 'test': mock.ANY},
2698 {'op': 'cmake', 'test': mock.ANY}]),
2699 (True, False, True, [{'op': 'filter', 'test': mock.ANY},
2700 {'op': 'cmake', 'test': mock.ANY}]),
2701 (True, False, False, [{'op': 'cmake', 'test': mock.ANY}]),
2720 'dummy1': mock.Mock(run=True, retries=0, status=TwisterStatus.PASS, build_dir="/tmp"),
2721 'dummy2': mock.Mock(run=True, retries=0, status=TwisterStatus.SKIP, build_dir="/tmp"),
2722 'dummy3': mock.Mock(run=True, retries=0, status=TwisterStatus.FILTER, build_dir="/tmp"),
2723 'dummy4': mock.Mock(run=True, retries=0, status=TwisterStatus.ERROR, build_dir="/tmp"),
2724 'dummy5': mock.Mock(run=True, retries=0, status=TwisterStatus.FAIL, build_dir="/tmp")
2728 suites = [mock.Mock(), mock.Mock()]
2729 env_mock = mock.Mock()
2732 tr.get_cmake_filter_stages = mock.Mock(
2735 tr.results = mock.Mock(iteration=0)
2737 pipeline_mock = mock.Mock()
2750 tr.get_cmake_filter_stages.assert_any_call('full', mock.ANY)
2752 tr.get_cmake_filter_stages.assert_any_call('some', mock.ANY)
2755 print([mock.call(el) for el in expected_pipeline_elements])
2758 [mock.call(el) for el in expected_pipeline_elements]
2781 env_mock = mock.Mock()
2784 tr.jobserver = mock.Mock(
2785 get_job=mock.Mock(
2790 pipeline_mock = mock.Mock()
2791 pipeline_mock.get_nowait = mock.Mock(side_effect=mock_get_nowait)
2792 done_queue_mock = mock.Mock()
2793 lock_mock = mock.Mock()
2794 results_mock = mock.Mock()
2796 with mock.patch('sys.platform', platform), \
2797 mock.patch('twisterlib.runner.ProjectBuilder',\
2798 return_value=mock.Mock()) as pb:
2817 env_mock = mock.Mock()
2820 tr.add_tasks_to_queue = mock.Mock()
2823 process_mock = mock.Mock()
2824 process_mock().join = mock.Mock(side_effect=mock_join)
2826 pipeline_mock = mock.Mock()
2827 done_mock = mock.Mock()
2829 with mock.patch('twisterlib.runner.Process', process_mock):