MCPcopy Index your code
hub / github.com/python/cpython / test_syslog_threaded

Method test_syslog_threaded

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 3

setMethod · 0.95
EventMethod · 0.80
sleepMethod · 0.45

Tested by

no test coverage detected