Skip to content

Commit

Permalink
chore(tests): fix up it tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Umaaz committed Jan 18, 2024
1 parent d8f350e commit 23854d7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/deep/processor/trigger_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ def start(self):
if self._config.NO_TRACE:
return
self.__old_sys_trace = sys.gettrace()
self.__old_thread_trace = threading.gettrace()
# gettrace was added in 3.10, so use it if we can, else try to get from property
# noinspection PyUnresolvedReferences,PyProtectedMember
self.__old_thread_trace = threading.gettrace() if hasattr(threading, 'gettrace') else threading._trace_hook
sys.settrace(self.trace_call)
threading.settrace(self.trace_call)

Expand Down Expand Up @@ -197,7 +199,7 @@ def __actions_for_location(self, event, file, line, function):

def __process_call_backs(self, frame: FrameType, event: str):
callbacks = self.__callbacks.value.pop()
remaining: list[ActionCallback] = []
remaining: List[ActionCallback] = []
for callback in callbacks:
if callback.process(frame, event):
remaining.append(callback)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class BasicITTest(unittest.TestCase):
def test_simple_it(self):
server: MockServer
with start_server() as server:
server.add_tp("test_target.py", 29, {}, [], [])
server.add_tp("test_target.py", 40, {}, [], [])
_deep = deep.start(server.config({}))
server.await_poll()
test = BPTargetTest("name", 123)
Expand All @@ -41,7 +41,7 @@ def test_simple_it(self):
frames = snapshot.frames
self.assertEqual(it_tests.test_target.__file__, frames[0].file_name)
self.assertEqual("/it_tests/test_target.py", frames[0].short_path)
self.assertEqual(29, frames[0].line_number)
self.assertEqual(40, frames[0].line_number)
self.assertEqual(4, len(frames[0].variables))
self.assertEqual(6, len(snapshot.var_lookup))

Expand Down

0 comments on commit 23854d7

Please sign in to comment.