Skip to content

Commit 20c4d27

Browse files
committed
Split tests
1 parent 4473aa9 commit 20c4d27

5 files changed

Lines changed: 2209 additions & 1868 deletions

File tree

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
"""Common test helpers and mocks for live collector tests."""
2+
3+
from profiling.sampling.constants import (
4+
THREAD_STATUS_HAS_GIL,
5+
THREAD_STATUS_ON_CPU,
6+
)
7+
8+
9+
class MockFrameInfo:
10+
"""Mock FrameInfo for testing."""
11+
12+
def __init__(self, filename, lineno, funcname):
13+
self.filename = filename
14+
self.lineno = lineno
15+
self.funcname = funcname
16+
17+
def __repr__(self):
18+
return f"MockFrameInfo(filename='{self.filename}', lineno={self.lineno}, funcname='{self.funcname}')"
19+
20+
21+
class MockThreadInfo:
22+
"""Mock ThreadInfo for testing."""
23+
24+
def __init__(self, thread_id, frame_info, status=THREAD_STATUS_HAS_GIL | THREAD_STATUS_ON_CPU):
25+
self.thread_id = thread_id
26+
self.frame_info = frame_info
27+
self.status = status
28+
29+
def __repr__(self):
30+
return f"MockThreadInfo(thread_id={self.thread_id}, frame_info={self.frame_info}, status={self.status})"
31+
32+
33+
class MockInterpreterInfo:
34+
"""Mock InterpreterInfo for testing."""
35+
36+
def __init__(self, interpreter_id, threads):
37+
self.interpreter_id = interpreter_id
38+
self.threads = threads
39+
40+
def __repr__(self):
41+
return f"MockInterpreterInfo(interpreter_id={self.interpreter_id}, threads={self.threads})"

0 commit comments

Comments
 (0)