ยปCore Development>Code coverage>Lib/test/test_syslog.py

Python code coverage for Lib/test/test_syslog.py

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