Skip to content

Add in_subprocess pytest mark and modify tests which run in another process to use it

Tom Mewett requested to merge tmewett/test-in-subprocess into master

Description

Some tests require running in another Python process for reasons related to gRPC multithreading. Currently each test module requiring this implements a lot of duplicate code. Said code also has various disadvantages, such as losing the traceback and other details of the exception on a test failure.

This MR implements a new pytest mark, in_subprocess, which runs the marked test in a forked Python child process, and properly reports test failures and any output to the parent pytest. This makes the concerned tests clearer, shorter, and easier to debug.

This merge request, when approved, will close: #1108 (closed)


Merge request reports