mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
[3.10] Add more syslog tests (GH-97953). (GH-98101)
(cherry picked from commit cae7d1d7a7)
This commit is contained in:
parent
820ef62833
commit
4d7d91f941
4 changed files with 97 additions and 7 deletions
|
|
@ -408,6 +408,27 @@ def hook(event, *args):
|
|||
raise RuntimeError("Expected sqlite3.load_extension to fail")
|
||||
|
||||
|
||||
def test_syslog():
|
||||
import syslog
|
||||
|
||||
def hook(event, args):
|
||||
if event.startswith("syslog."):
|
||||
print(event, *args)
|
||||
|
||||
sys.addaudithook(hook)
|
||||
syslog.openlog('python')
|
||||
syslog.syslog('test')
|
||||
syslog.setlogmask(syslog.LOG_DEBUG)
|
||||
syslog.closelog()
|
||||
# implicit open
|
||||
syslog.syslog('test2')
|
||||
# open with default ident
|
||||
syslog.openlog(logoption=syslog.LOG_NDELAY, facility=syslog.LOG_LOCAL0)
|
||||
sys.argv = None
|
||||
syslog.openlog()
|
||||
syslog.closelog()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
from test.support import suppress_msvcrt_asserts
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue