Merge pull request #54305 from dwoz/winfix

Fix wart in test_process tests on windows
This commit is contained in:
Daniel Wozniak 2019-08-26 10:59:11 -07:00 committed by GitHub
commit 71fb051258
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -419,18 +419,18 @@ class TestDup2(TestCase):
assert not dup_mock.called
def null_target():
pass
def event_target(event):
while True:
if event.wait(5):
break
class TestProcessList(TestCase):
@staticmethod
def null_target():
pass
@staticmethod
def event_target(event):
while True:
if event.wait(5):
break
@staticmethod
def wait_for_proc(proc, timeout=10):
start = time.time()
@ -441,7 +441,7 @@ class TestProcessList(TestCase):
def test_process_list_process(self):
plist = salt.utils.process.SubprocessList()
proc = multiprocessing.Process(target=self.null_target)
proc = multiprocessing.Process(target=null_target)
proc.start()
plist.add(proc)
assert proc in plist.processes
@ -452,7 +452,7 @@ class TestProcessList(TestCase):
def test_process_list_thread(self):
plist = salt.utils.process.SubprocessList()
thread = threading.Thread(target=self.null_target)
thread = threading.Thread(target=null_target)
thread.start()
plist.add(thread)
assert thread in plist.processes
@ -464,7 +464,7 @@ class TestProcessList(TestCase):
def test_process_list_cleanup(self):
plist = salt.utils.process.SubprocessList()
event = multiprocessing.Event()
proc = multiprocessing.Process(target=self.event_target, args=[event])
proc = multiprocessing.Process(target=event_target, args=[event])
proc.start()
plist.add(proc)
assert proc in plist.processes