Mercurial > cpython-lru_cache-weakref
annotate Lib/test/test_syslog.py @ 78069:a8aa77458e12 3.2
Add c_size_t and c_ssize_t to the ctypes summary table.
| author | Antoine Pitrou <solipsis@pitrou.net> |
|---|---|
| date | Thu, 12 Jul 2012 20:31:50 +0200 |
| parents | 50d170bb71c7 |
| children |
| rev | line source |
|---|---|
|
42810
776b8bd68b30
Use unicode and add a "test" for syslog
Neal Norwitz <nnorwitz@gmail.com>
parents:
diff
changeset
|
1 |
|
52642
7347d916f13a
Allow skipping of regression tests not supported on windows. This reduces noise in the regression test suite for py3k on Windows.
Kristján Valur Jónsson <kristjan@ccpgames.com>
parents:
47201
diff
changeset
|
2 from test import support |
|
7347d916f13a
Allow skipping of regression tests not supported on windows. This reduces noise in the regression test suite for py3k on Windows.
Kristján Valur Jónsson <kristjan@ccpgames.com>
parents:
47201
diff
changeset
|
3 syslog = support.import_module("syslog") #skip if not supported |
|
42810
776b8bd68b30
Use unicode and add a "test" for syslog
Neal Norwitz <nnorwitz@gmail.com>
parents:
diff
changeset
|
4 import unittest |
|
776b8bd68b30
Use unicode and add a "test" for syslog
Neal Norwitz <nnorwitz@gmail.com>
parents:
diff
changeset
|
5 |
|
776b8bd68b30
Use unicode and add a "test" for syslog
Neal Norwitz <nnorwitz@gmail.com>
parents:
diff
changeset
|
6 # XXX(nnorwitz): This test sucks. I don't know of a platform independent way |
|
776b8bd68b30
Use unicode and add a "test" for syslog
Neal Norwitz <nnorwitz@gmail.com>
parents:
diff
changeset
|
7 # to verify that the messages were really logged. |
|
776b8bd68b30
Use unicode and add a "test" for syslog
Neal Norwitz <nnorwitz@gmail.com>
parents:
diff
changeset
|
8 # The only purpose of this test is to verify the code doesn't crash or leak. |
|
776b8bd68b30
Use unicode and add a "test" for syslog
Neal Norwitz <nnorwitz@gmail.com>
parents:
diff
changeset
|
9 |
|
776b8bd68b30
Use unicode and add a "test" for syslog
Neal Norwitz <nnorwitz@gmail.com>
parents:
diff
changeset
|
10 class Test(unittest.TestCase): |
|
776b8bd68b30
Use unicode and add a "test" for syslog
Neal Norwitz <nnorwitz@gmail.com>
parents:
diff
changeset
|
11 |
|
776b8bd68b30
Use unicode and add a "test" for syslog
Neal Norwitz <nnorwitz@gmail.com>
parents:
diff
changeset
|
12 def test_openlog(self): |
|
776b8bd68b30
Use unicode and add a "test" for syslog
Neal Norwitz <nnorwitz@gmail.com>
parents:
diff
changeset
|
13 syslog.openlog('python') |
|
66799
50d170bb71c7
Issue #6697: Fixed instances of _PyUnicode_AsString() result not checked for NULL
Alexander Belopolsky <alexander.belopolsky@gmail.com>
parents:
52642
diff
changeset
|
14 # Issue #6697. |
|
50d170bb71c7
Issue #6697: Fixed instances of _PyUnicode_AsString() result not checked for NULL
Alexander Belopolsky <alexander.belopolsky@gmail.com>
parents:
52642
diff
changeset
|
15 self.assertRaises(UnicodeEncodeError, syslog.openlog, '\uD800') |
|
42810
776b8bd68b30
Use unicode and add a "test" for syslog
Neal Norwitz <nnorwitz@gmail.com>
parents:
diff
changeset
|
16 |
|
776b8bd68b30
Use unicode and add a "test" for syslog
Neal Norwitz <nnorwitz@gmail.com>
parents:
diff
changeset
|
17 def test_syslog(self): |
|
776b8bd68b30
Use unicode and add a "test" for syslog
Neal Norwitz <nnorwitz@gmail.com>
parents:
diff
changeset
|
18 syslog.openlog('python') |
|
776b8bd68b30
Use unicode and add a "test" for syslog
Neal Norwitz <nnorwitz@gmail.com>
parents:
diff
changeset
|
19 syslog.syslog('test message from python test_syslog') |
|
776b8bd68b30
Use unicode and add a "test" for syslog
Neal Norwitz <nnorwitz@gmail.com>
parents:
diff
changeset
|
20 syslog.syslog(syslog.LOG_ERR, 'test error from python test_syslog') |
|
776b8bd68b30
Use unicode and add a "test" for syslog
Neal Norwitz <nnorwitz@gmail.com>
parents:
diff
changeset
|
21 |
|
776b8bd68b30
Use unicode and add a "test" for syslog
Neal Norwitz <nnorwitz@gmail.com>
parents:
diff
changeset
|
22 def test_closelog(self): |
|
776b8bd68b30
Use unicode and add a "test" for syslog
Neal Norwitz <nnorwitz@gmail.com>
parents:
diff
changeset
|
23 syslog.openlog('python') |
|
776b8bd68b30
Use unicode and add a "test" for syslog
Neal Norwitz <nnorwitz@gmail.com>
parents:
diff
changeset
|
24 syslog.closelog() |
|
776b8bd68b30
Use unicode and add a "test" for syslog
Neal Norwitz <nnorwitz@gmail.com>
parents:
diff
changeset
|
25 |
|
776b8bd68b30
Use unicode and add a "test" for syslog
Neal Norwitz <nnorwitz@gmail.com>
parents:
diff
changeset
|
26 def test_setlogmask(self): |
|
776b8bd68b30
Use unicode and add a "test" for syslog
Neal Norwitz <nnorwitz@gmail.com>
parents:
diff
changeset
|
27 syslog.setlogmask(syslog.LOG_DEBUG) |
|
776b8bd68b30
Use unicode and add a "test" for syslog
Neal Norwitz <nnorwitz@gmail.com>
parents:
diff
changeset
|
28 |
|
776b8bd68b30
Use unicode and add a "test" for syslog
Neal Norwitz <nnorwitz@gmail.com>
parents:
diff
changeset
|
29 def test_log_mask(self): |
|
776b8bd68b30
Use unicode and add a "test" for syslog
Neal Norwitz <nnorwitz@gmail.com>
parents:
diff
changeset
|
30 syslog.LOG_MASK(syslog.LOG_INFO) |
|
776b8bd68b30
Use unicode and add a "test" for syslog
Neal Norwitz <nnorwitz@gmail.com>
parents:
diff
changeset
|
31 |
|
776b8bd68b30
Use unicode and add a "test" for syslog
Neal Norwitz <nnorwitz@gmail.com>
parents:
diff
changeset
|
32 def test_log_upto(self): |
|
776b8bd68b30
Use unicode and add a "test" for syslog
Neal Norwitz <nnorwitz@gmail.com>
parents:
diff
changeset
|
33 syslog.LOG_UPTO(syslog.LOG_INFO) |
|
776b8bd68b30
Use unicode and add a "test" for syslog
Neal Norwitz <nnorwitz@gmail.com>
parents:
diff
changeset
|
34 |
|
776b8bd68b30
Use unicode and add a "test" for syslog
Neal Norwitz <nnorwitz@gmail.com>
parents:
diff
changeset
|
35 def test_main(): |
|
47201
9c930a32cebb
#2621 rename test.test_support to test.support
Benjamin Peterson <benjamin@python.org>
parents:
42810
diff
changeset
|
36 support.run_unittest(__name__) |
|
42810
776b8bd68b30
Use unicode and add a "test" for syslog
Neal Norwitz <nnorwitz@gmail.com>
parents:
diff
changeset
|
37 |
|
776b8bd68b30
Use unicode and add a "test" for syslog
Neal Norwitz <nnorwitz@gmail.com>
parents:
diff
changeset
|
38 if __name__ == "__main__": |
|
776b8bd68b30
Use unicode and add a "test" for syslog
Neal Norwitz <nnorwitz@gmail.com>
parents:
diff
changeset
|
39 test_main() |
