Commit 02df081a authored by Jeremy Hylton's avatar Jeremy Hylton

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.
parent 60e17538
...@@ -30,11 +30,11 @@ import socket, threading, time, locale ...@@ -30,11 +30,11 @@ import socket, threading, time, locale
import logging, logging.handlers, logging.config import logging, logging.handlers, logging.config
try: try:
locale.setlocale(locale.LC_ALL, '') cur_locale = locale.setlocale(locale.LC_ALL, '')
except (ValueError, locale.Error): except (ValueError, locale.Error):
# this happens on a Solaris box which only supports "C" locale # 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 # or a Mac OS X box which supports very little locale stuff at all
pass cur_locale = None
BANNER = "-- %-10s %-6s ---------------------------------------------------\n" BANNER = "-- %-10s %-6s ---------------------------------------------------\n"
...@@ -474,6 +474,9 @@ def test_main(): ...@@ -474,6 +474,9 @@ def test_main():
banner("logrecv output", "end") banner("logrecv output", "end")
sys.stdout.flush() sys.stdout.flush()
if cur_locale:
locale.setlocale(locale.LC_ALL, "C")
if __name__ == "__main__": if __name__ == "__main__":
sys.stdout.write("test_logging\n") sys.stdout.write("test_logging\n")
test_main() test_main()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment