MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_syslog_threaded

Method test_syslog_threaded

Lib/test/test_syslog.py:59–83  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

57
58 @threading_helper.requires_working_threading()
59 def test_syslog_threaded(self):
60 start = threading.Event()
61 stop = False
62 def opener():
63 start.wait(10)
64 i = 1
65 while not stop:
66 syslog.openlog(f'python-test-{i}') # new string object
67 i += 1
68 def logger():
69 start.wait(10)
70 while not stop:
71 syslog.syslog('test message from python test_syslog')
72
73 orig_si = sys.getswitchinterval()
74 support.setswitchinterval(1e-9)
75 try:
76 threads = [threading.Thread(target=opener)]
77 threads += [threading.Thread(target=logger) for k in range(10)]
78 with threading_helper.start_threads(threads):
79 start.set()
80 time.sleep(0.1)
81 stop = True
82 finally:
83 sys.setswitchinterval(orig_si)
84
85
86if __name__ == "__main__":

Callers

nothing calls this directly

Calls 3

setMethod · 0.95
EventMethod · 0.80
sleepMethod · 0.45

Tested by

no test coverage detected