diff options
author | Géry Ogam <gery.ogam@gmail.com> | 2022-04-22 22:47:09 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-22 22:47:09 (GMT) |
commit | 5576ddbbbc9c1d7a7819abc961e5d604ae0f7dd7 (patch) | |
tree | 4f87033ff66e48c11420b27c687ded28df53cd50 /Lib/test/_test_multiprocessing.py | |
parent | f912cc0e413f667a8cc257a41775272bc641b0d8 (diff) | |
download | cpython-5576ddbbbc9c1d7a7819abc961e5d604ae0f7dd7.zip cpython-5576ddbbbc9c1d7a7819abc961e5d604ae0f7dd7.tar.gz cpython-5576ddbbbc9c1d7a7819abc961e5d604ae0f7dd7.tar.bz2 |
bpo-46720: Add support for path-like objects to multiprocessing.set_executable for Windows (GH-31279)
This bring the API to be on a par with Unix-like systems.
Diffstat (limited to 'Lib/test/_test_multiprocessing.py')
-rw-r--r-- | Lib/test/_test_multiprocessing.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py index 427fc0c..67bb17c 100644 --- a/Lib/test/_test_multiprocessing.py +++ b/Lib/test/_test_multiprocessing.py @@ -20,6 +20,7 @@ import logging import subprocess import struct import operator +import pathlib import pickle import weakref import warnings @@ -256,6 +257,21 @@ class _TestProcess(BaseTestCase): self.assertEqual(current.ident, os.getpid()) self.assertEqual(current.exitcode, None) + def test_set_executable(self): + if self.TYPE == 'threads': + self.skipTest(f'test not appropriate for {self.TYPE}') + paths = [ + sys.executable, # str + sys.executable.encode(), # bytes + pathlib.Path(sys.executable) # os.PathLike + ] + for path in paths: + self.set_executable(path) + p = self.Process() + p.start() + p.join() + self.assertEqual(p.exitcode, 0) + def test_args_argument(self): # bpo-45735: Using list or tuple as *args* in constructor could # achieve the same effect. @@ -5787,6 +5803,7 @@ class ProcessesMixin(BaseMixin): current_process = staticmethod(multiprocessing.current_process) parent_process = staticmethod(multiprocessing.parent_process) active_children = staticmethod(multiprocessing.active_children) + set_executable = staticmethod(multiprocessing.set_executable) Pool = staticmethod(multiprocessing.Pool) Pipe = staticmethod(multiprocessing.Pipe) Queue = staticmethod(multiprocessing.Queue) |