diff options
author | Benjamin Peterson <benjamin@python.org> | 2012-02-21 02:55:32 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2012-02-21 02:55:32 (GMT) |
commit | 11fa11bc953f7e37788798ef655ac624ac7787f4 (patch) | |
tree | 1bc97a9780ac9fa32b8ef6bd8f775dc3378645ee /Lib/test | |
parent | 5bc92e0824aadca21498aca61a002bc8c3a470d8 (diff) | |
download | cpython-11fa11bc953f7e37788798ef655ac624ac7787f4.zip cpython-11fa11bc953f7e37788798ef655ac624ac7787f4.tar.gz cpython-11fa11bc953f7e37788798ef655ac624ac7787f4.tar.bz2 |
fix test_gdb under hash randomization
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_gdb.py | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/Lib/test/test_gdb.py b/Lib/test/test_gdb.py index 0a2d883..92e5c52 100644 --- a/Lib/test/test_gdb.py +++ b/Lib/test/test_gdb.py @@ -58,13 +58,18 @@ class DebuggerTests(unittest.TestCase): """Test that the debugger can debug Python.""" - def run_gdb(self, *args): + def run_gdb(self, *args, **env_vars): """Runs gdb with the command line given by *args. Returns its stdout, stderr """ + if env_vars: + env = os.environ.copy() + env.update(env_vars) + else: + env = None out, err = subprocess.Popen( - args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, + args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env ).communicate() return out, err @@ -124,7 +129,7 @@ class DebuggerTests(unittest.TestCase): # print ' '.join(args) # Use "args" to invoke gdb, capturing stdout, stderr: - out, err = self.run_gdb(*args) + out, err = self.run_gdb(*args, PYTHONHASHSEED='0') # Ignore some noise on stderr due to the pending breakpoint: err = err.replace('Function "%s" not defined.\n' % breakpoint, '') @@ -213,7 +218,7 @@ class PrettyPrintTests(DebuggerTests): 'Verify the pretty-printing of dictionaries' self.assertGdbRepr({}) self.assertGdbRepr({'foo': 'bar'}) - self.assertGdbRepr({'foo': 'bar', 'douglas':42}) + self.assertGdbRepr("{'foo': 'bar', 'douglas':42}") def test_lists(self): 'Verify the pretty-printing of lists' @@ -273,8 +278,8 @@ print s''') def test_frozensets(self): 'Verify the pretty-printing of frozensets' self.assertGdbRepr(frozenset()) - self.assertGdbRepr(frozenset(['a', 'b'])) - self.assertGdbRepr(frozenset([4, 5, 6])) + self.assertGdbRepr("frozenset(['a', 'b'])") + self.assertGdbRepr("frozenset([4, 5, 6])") def test_exceptions(self): # Test a RuntimeError |