blob: 3a3d63555f3de6f01fdf060b8244a2f26e2c7f3f [file] [log] [blame]
Neal Norwitz8d3654d2007-08-25 00:21:36 +00001
2import syslog
3import unittest
Benjamin Petersonee8712c2008-05-20 21:35:26 +00004from test import support
Neal Norwitz8d3654d2007-08-25 00:21:36 +00005
6# XXX(nnorwitz): This test sucks. I don't know of a platform independent way
7# to verify that the messages were really logged.
8# The only purpose of this test is to verify the code doesn't crash or leak.
9
10class Test(unittest.TestCase):
11
12 def test_openlog(self):
13 syslog.openlog('python')
14
15 def test_syslog(self):
16 syslog.openlog('python')
17 syslog.syslog('test message from python test_syslog')
18 syslog.syslog(syslog.LOG_ERR, 'test error from python test_syslog')
19
20 def test_closelog(self):
21 syslog.openlog('python')
22 syslog.closelog()
23
24 def test_setlogmask(self):
25 syslog.setlogmask(syslog.LOG_DEBUG)
26
27 def test_log_mask(self):
28 syslog.LOG_MASK(syslog.LOG_INFO)
29
30 def test_log_upto(self):
31 syslog.LOG_UPTO(syslog.LOG_INFO)
32
33def test_main():
Benjamin Petersonee8712c2008-05-20 21:35:26 +000034 support.run_unittest(__name__)
Neal Norwitz8d3654d2007-08-25 00:21:36 +000035
36if __name__ == "__main__":
37 test_main()