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.
........
................
diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py
index cac90f4..1678397 100644
--- a/Lib/test/test_sys.py
+++ b/Lib/test/test_sys.py
@@ -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)