summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_logging.py
diff options
context:
space:
mode:
authorJeremy Hylton <jeremy@alum.mit.edu>2003-07-18 03:19:20 (GMT)
committerJeremy Hylton <jeremy@alum.mit.edu>2003-07-18 03:19:20 (GMT)
commit096d986f3b2be9c1ea61efbf66cf85492bfcd6a8 (patch)
tree12f774ff93116cd1c377db0df4b6d81f39da5167 /Lib/test/test_logging.py
parent95be8bdab74f9f8bbb25387b41eb0ff5e2d5d33f (diff)
downloadcpython-096d986f3b2be9c1ea61efbf66cf85492bfcd6a8.zip
cpython-096d986f3b2be9c1ea61efbf66cf85492bfcd6a8.tar.gz
cpython-096d986f3b2be9c1ea61efbf66cf85492bfcd6a8.tar.bz2
Restore the locale to "C" on exit.
If this doesn't happen, it leaves the locale in a state that can cause other tests to fail. For example, running test_strptime, test_logging, and test_time in that order.
Diffstat (limited to 'Lib/test/test_logging.py')
-rw-r--r--Lib/test/test_logging.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py
index ecf0e68..1932293 100644
--- a/Lib/test/test_logging.py
+++ b/Lib/test/test_logging.py
@@ -30,11 +30,11 @@ import socket, threading, time, locale
import logging, logging.handlers, logging.config
try:
- locale.setlocale(locale.LC_ALL, '')
+ cur_locale = locale.setlocale(locale.LC_ALL, '')
except (ValueError, locale.Error):
# this happens on a Solaris box which only supports "C" locale
# or a Mac OS X box which supports very little locale stuff at all
- pass
+ cur_locale = None
BANNER = "-- %-10s %-6s ---------------------------------------------------\n"
@@ -474,6 +474,9 @@ def test_main():
banner("logrecv output", "end")
sys.stdout.flush()
+ if cur_locale:
+ locale.setlocale(locale.LC_ALL, "C")
+
if __name__ == "__main__":
sys.stdout.write("test_logging\n")
test_main()