[Python-checkins] python/dist/src/Lib/test test_gettext.py,1.14,1.15

bcannon@users.sourceforge.net bcannon@users.sourceforge.net
Sun, 27 Apr 2003 12:42:43 -0700


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

Modified Files:
	test_gettext.py 
Log Message:
Make tests clean up after themselves better.  This means:

* call tearDown when Setup is called
* shutil.rmtree the root of the created directory instead of just the leaf
  directory
* set the LANGUAGE environment variable to what it was originally and not
  assume 'en'.


Index: test_gettext.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_gettext.py,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** test_gettext.py	24 Apr 2003 18:08:13 -0000	1.14
--- test_gettext.py	27 Apr 2003 19:42:41 -0000	1.15
***************
*** 47,50 ****
--- 47,54 ----
  MOFILE = os.path.join(LOCALEDIR, 'gettext.mo')
  UMOFILE = os.path.join(LOCALEDIR, 'ugettext.mo')
+ try:
+     LANG = os.environ['LANGUAGE']
+ except:
+     LANG = 'en'
  
  
***************
*** 61,66 ****
  
      def tearDown(self):
!         os.environ['LANGUAGE'] = 'en'
!         shutil.rmtree(LOCALEDIR)
  
  
--- 65,70 ----
  
      def tearDown(self):
!         os.environ['LANGUAGE'] = LANG
!         shutil.rmtree(os.path.split(LOCALEDIR)[0])
  
  
***************
*** 72,75 ****
--- 76,82 ----
          gettext.install('gettext', self.localedir)
  
+     def tearDown(self):
+         GettextBaseTest.tearDown(self)
+ 
      def test_some_translations(self):
          eq = self.assertEqual
***************
*** 138,141 ****
--- 145,151 ----
          self._ = gettext.gettext
  
+     def tearDown(self):
+         GettextBaseTest.tearDown(self)
+ 
      def test_bindtextdomain(self):
          self.assertEqual(gettext.bindtextdomain('gettext'), self.localedir)
***************
*** 192,195 ****
--- 202,208 ----
          self.mofile = MOFILE
  
+     def tearDown(self):
+         GettextBaseTest.tearDown(self)
+ 
      def test_plural_forms1(self):
          eq = self.assertEqual
***************
*** 279,282 ****
--- 292,298 ----
              fp.close()
          self._ = self.t.ugettext
+ 
+     def tearDown(self):
+         GettextBaseTest.tearDown(self)
  
      def test_unicode_msgid(self):