Skip to content

Commit aee3486

Browse files
committed
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://[email protected]/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. ........ ................
1 parent ee26c98 commit aee3486

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Lib/test/test_sys.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
55
import subprocess
66
import textwrap
77

8+
# count the number of test runs, used to create unique
9+
# strings to intern in test_intern()
10+
numruns = 0
11+
12+
813
class SysModuleTest(unittest.TestCase):
914

1015
def setUp(self):
@@ -379,8 +384,10 @@ def test_43581(self):
379384
self.assertEqual(sys.__stdout__.encoding, sys.__stderr__.encoding)
380385

381386
def test_intern(self):
387+
global numruns
388+
numruns += 1
382389
self.assertRaises(TypeError, sys.intern)
383-
s = "never interned before"
390+
s = "never interned before" + str(numruns)
384391
self.assertTrue(sys.intern(s) is s)
385392
s2 = s.swapcase().swapcase()
386393
self.assertTrue(sys.intern(s2) is s)

0 commit comments

Comments
 (0)