[Python-checkins] r75891 - in python/branches/release31-maint: Lib/test/test_sys.py

georg.brandl python-checkins at python.org
Wed Oct 28 00:01:31 CET 2009


Author: georg.brandl
Date: Wed Oct 28 00:01:30 2009
New Revision: 75891

Log:
Merged revisions 75889 via svnmerge from 
svn+ssh://svn.python.org/python/branches/py3k

................
  r75889 | georg.brandl | 2009-10-28 00:00:28 +0100 (Mi, 28 Okt 2009) | 9 lines
  
  Merged revisions 75887 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/python/trunk
  
  ........
    r75887 | georg.brandl | 2009-10-27 23:56:09 +0100 (Di, 27 Okt 2009) | 1 line
    
    Make sure every run of test_intern() interns a new string, otherwise that test fails e.g. when some other test in test_builtin fails and it is rerun in verbose mode.
  ........
................


Modified:
   python/branches/release31-maint/   (props changed)
   python/branches/release31-maint/Lib/test/test_sys.py

Modified: python/branches/release31-maint/Lib/test/test_sys.py
==============================================================================
--- python/branches/release31-maint/Lib/test/test_sys.py	(original)
+++ python/branches/release31-maint/Lib/test/test_sys.py	Wed Oct 28 00:01:30 2009
@@ -5,6 +5,11 @@
 import subprocess
 import textwrap
 
+# count the number of test runs, used to create unique
+# strings to intern in test_intern()
+numruns = 0
+
+
 class SysModuleTest(unittest.TestCase):
 
     def setUp(self):
@@ -379,8 +384,10 @@
         self.assertEqual(sys.__stdout__.encoding, sys.__stderr__.encoding)
 
     def test_intern(self):
+        global numruns
+        numruns += 1
         self.assertRaises(TypeError, sys.intern)
-        s = "never interned before"
+        s = "never interned before" + str(numruns)
         self.assertTrue(sys.intern(s) is s)
         s2 = s.swapcase().swapcase()
         self.assertTrue(sys.intern(s2) is s)


More information about the Python-checkins mailing list