[3.10] Add more syslog tests (GH-97953). (GH-98101)

(cherry picked from commit cae7d1d7a7)
This commit is contained in:
Serhiy Storchaka 2022-10-09 14:21:10 +03:00 committed by GitHub
parent 820ef62833
commit 4d7d91f941
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 97 additions and 7 deletions

View file

@ -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