~ubuntu-branches/ubuntu/maverick/python3.1/maverick

« back to all changes in this revision

Viewing changes to Lib/test/test_syslog.py

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2009-03-23 00:01:27 UTC
  • Revision ID: james.westby@ubuntu.com-20090323000127-5fstfxju4ufrhthq
Tags: upstream-3.1~a1+20090322
ImportĀ upstreamĀ versionĀ 3.1~a1+20090322

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
import syslog
 
3
import unittest
 
4
from test import support
 
5
 
 
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
 
 
10
class 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
 
 
33
def test_main():
 
34
    support.run_unittest(__name__)
 
35
 
 
36
if __name__ == "__main__":
 
37
    test_main()