import multiprocessing import sys import unittest class MyTestClass(unittest.TestCase): # Changing the following to a classmethod or a staticmethod causes the test to succeed def _child_process(self): sys.exit(0) def test_something(self): p = multiprocessing.Process(target=self._child_process) p.start() # This fails with a pickle error (different error with unittest and with pytest) p.join() if __name__ == '__main__': multiprocessing.set_start_method('spawn') # in Windows this is the only possibility # import pytest # pytest.main(args=[__file__]) unittest.main()