We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 11709cb commit 18dbfebCopy full SHA for 18dbfeb
1 file changed
tests/cloudpickle_test.py
@@ -403,5 +403,26 @@ def example():
403
f = cloudpickle.loads(s)
404
f() # test
405
406
+ def test_multiprocess(self):
407
+ # running a function pickled by another process
408
+ def scope():
409
+ import curses.textpad
410
+ def example():
411
+ x = xml.etree.ElementTree.Comment
412
+ x = curses.textpad.Textbox
413
+ return example
414
+ global xml
415
+ import xml.etree.ElementTree
416
+ example = scope()
417
+
418
+ s = cloudpickle.dumps(example)
419
420
+ import subprocess
421
+ # no point trying "import multiprocessing" because that library
422
+ # uses fork to preserve the loaded environment.
423
+ assert not subprocess.call(['python', '-c',
424
+ 'import pickle; (pickle.loads(' +
425
+ s.__str__() + '))()'])
426
427
if __name__ == '__main__':
428
unittest.main()
0 commit comments