(self)
| 1374 | "Test only runs on Linux with process_vm_readv support", |
| 1375 | ) |
| 1376 | def test_self_trace(self): |
| 1377 | stack_trace = get_stack_trace(os.getpid()) |
| 1378 | |
| 1379 | this_thread_stack = None |
| 1380 | for interpreter_info in stack_trace: |
| 1381 | for thread_info in interpreter_info.threads: |
| 1382 | if thread_info.thread_id == threading.get_native_id(): |
| 1383 | this_thread_stack = thread_info.frame_info |
| 1384 | break |
| 1385 | if this_thread_stack: |
| 1386 | break |
| 1387 | |
| 1388 | self.assertIsNotNone(this_thread_stack) |
| 1389 | # Check the top two frames |
| 1390 | self.assertGreaterEqual(len(this_thread_stack), 2) |
| 1391 | self.assertEqual(this_thread_stack[0].funcname, "get_stack_trace") |
| 1392 | self.assertTrue(this_thread_stack[0].filename.endswith("test_external_inspection.py")) |
| 1393 | self.assertEqual(this_thread_stack[1].funcname, "TestGetStackTrace.test_self_trace") |
| 1394 | self.assertTrue(this_thread_stack[1].filename.endswith("test_external_inspection.py")) |
| 1395 | |
| 1396 | @skip_if_not_supported |
| 1397 | @unittest.skipIf( |
nothing calls this directly
no test coverage detected