[Python-checkins] python/dist/src/Lib/test test_logging.py,1.9,1.10

jhylton@users.sourceforge.net jhylton@users.sourceforge.net
Thu, 17 Jul 2003 20:19:23 -0700


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1:/tmp/cvs-serv19084/test

Modified Files:
	test_logging.py 
Log Message:
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.


Index: test_logging.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_logging.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** test_logging.py	27 Jun 2003 21:43:39 -0000	1.9
--- test_logging.py	18 Jul 2003 03:19:20 -0000	1.10
***************
*** 31,39 ****
  
  try:
!     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
  
  BANNER = "-- %-10s %-6s ---------------------------------------------------\n"
--- 31,39 ----
  
  try:
!     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
!     cur_locale = None
  
  BANNER = "-- %-10s %-6s ---------------------------------------------------\n"
***************
*** 474,477 ****
--- 474,480 ----
          banner("logrecv output", "end")
          sys.stdout.flush()
+ 
+     if cur_locale:
+         locale.setlocale(locale.LC_ALL, "C")
  
  if __name__ == "__main__":