1 | n/a | |
---|
2 | n/a | from test import support |
---|
3 | n/a | syslog = support.import_module("syslog") #skip if not supported |
---|
4 | n/a | import unittest |
---|
5 | n/a | |
---|
6 | n/a | # XXX(nnorwitz): This test sucks. I don't know of a platform independent way |
---|
7 | n/a | # to verify that the messages were really logged. |
---|
8 | n/a | # The only purpose of this test is to verify the code doesn't crash or leak. |
---|
9 | n/a | |
---|
10 | n/a | class Test(unittest.TestCase): |
---|
11 | n/a | |
---|
12 | n/a | def test_openlog(self): |
---|
13 | n/a | syslog.openlog('python') |
---|
14 | n/a | # Issue #6697. |
---|
15 | n/a | self.assertRaises(UnicodeEncodeError, syslog.openlog, '\uD800') |
---|
16 | n/a | |
---|
17 | n/a | def test_syslog(self): |
---|
18 | n/a | syslog.openlog('python') |
---|
19 | n/a | syslog.syslog('test message from python test_syslog') |
---|
20 | n/a | syslog.syslog(syslog.LOG_ERR, 'test error from python test_syslog') |
---|
21 | n/a | |
---|
22 | n/a | def test_closelog(self): |
---|
23 | n/a | syslog.openlog('python') |
---|
24 | n/a | syslog.closelog() |
---|
25 | n/a | |
---|
26 | n/a | def test_setlogmask(self): |
---|
27 | n/a | syslog.setlogmask(syslog.LOG_DEBUG) |
---|
28 | n/a | |
---|
29 | n/a | def test_log_mask(self): |
---|
30 | n/a | syslog.LOG_MASK(syslog.LOG_INFO) |
---|
31 | n/a | |
---|
32 | n/a | def test_log_upto(self): |
---|
33 | n/a | syslog.LOG_UPTO(syslog.LOG_INFO) |
---|
34 | n/a | |
---|
35 | n/a | def test_openlog_noargs(self): |
---|
36 | n/a | syslog.openlog() |
---|
37 | n/a | syslog.syslog('test message from python test_syslog') |
---|
38 | n/a | |
---|
39 | n/a | if __name__ == "__main__": |
---|
40 | n/a | unittest.main() |
---|