Assert that threads are actually killed with an assertion.
@@ -301,7 +301,12 @@ def test_code_object_executed_other_thread():
tracer = ExecutionTracer()
tracer.current_thread_identifier = threading.current_thread().ident
tracer.register_code_object(MagicMock())
- thread = threading.Thread(target=tracer.executed_code_object, args=(0,))
+
+ def wrapper(*args):
+ with pytest.raises(RuntimeError):
+ tracer.executed_code_object(*args)
+
+ thread = threading.Thread(target=wrapper, args=(0,))
thread.start()
thread.join()
assert tracer.get_trace().executed_code_objects == set()
@@ -312,7 +317,12 @@ def test_bool_predicate_executed_other_thread():
tracer.current_thread_identifier = threading.current_thread().ident
tracer.register_code_object(MagicMock())
tracer.register_code_object(MagicMock(code_object_id=0))
- thread = threading.Thread(target=tracer.executed_bool_predicate, args=(True, 0))
+
+ def wrapper(*args):
+ with pytest.raises(RuntimeError):
+ tracer.executed_bool_predicate(*args)
+
+ thread = threading.Thread(target=wrapper, args=(True, 0))
thread.start()
thread.join()
assert tracer.get_trace().executed_predicates == {}
@@ -323,9 +333,12 @@ def test_compare_predicate_executed_other_thread():
tracer.current_thread_identifier = threading.current_thread().ident
tracer.register_code_object(MagicMock())
tracer.register_code_object(MagicMock(code_object_id=0))
- thread = threading.Thread(
- target=tracer.executed_compare_predicate, args=(True, False, Compare.EQ, 0)
- )
+
+ def wrapper(*args):
+ with pytest.raises(RuntimeError):
+ tracer.executed_compare_predicate(*args)
+
+ thread = threading.Thread(target=wrapper, args=(True, False, Compare.EQ, 0))
thread.start()
thread.join()
assert tracer.get_trace().executed_predicates == {}
