[3.11] Add more syslog tests (GH-97953). (GH-98096)

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

View file

@ -419,6 +419,27 @@ def test_sys_getframe():
sys._getframe()
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