]> granicus.if.org Git - python/commitdiff
Issue #25876: test_gdb: use subprocess._args_from_interpreter_flags() to test
authorVictor Stinner <victor.stinner@gmail.com>
Fri, 22 Jan 2016 13:16:47 +0000 (14:16 +0100)
committerVictor Stinner <victor.stinner@gmail.com>
Fri, 22 Jan 2016 13:16:47 +0000 (14:16 +0100)
Python with more options.

Lib/test/test_gdb.py

index 78fc55c2f204d0600ba279794a4b34327edda8fe..cc5aab1d1e570749979edb51a271d169fea19af3 100644 (file)
@@ -176,6 +176,7 @@ class DebuggerTests(unittest.TestCase):
         args = ['--eval-command=%s' % cmd for cmd in commands]
         args += ["--args",
                  sys.executable]
+        args.extend(subprocess._args_from_interpreter_flags())
 
         if not import_site:
             # -S suppresses the default 'import site'
@@ -301,7 +302,9 @@ class PrettyPrintTests(DebuggerTests):
         'Verify the pretty-printing of dictionaries'
         self.assertGdbRepr({})
         self.assertGdbRepr({'foo': 'bar'}, "{'foo': 'bar'}")
-        self.assertGdbRepr({'foo': 'bar', 'douglas': 42}, "{'douglas': 42, 'foo': 'bar'}")
+        # PYTHONHASHSEED is need to get the exact item order
+        if not sys.flags.ignore_environment:
+            self.assertGdbRepr({'foo': 'bar', 'douglas': 42}, "{'douglas': 42, 'foo': 'bar'}")
 
     def test_lists(self):
         'Verify the pretty-printing of lists'
@@ -379,9 +382,12 @@ id(s)''')
         'Verify the pretty-printing of frozensets'
         if (gdb_major_version, gdb_minor_version) < (7, 3):
             self.skipTest("pretty-printing of frozensets needs gdb 7.3 or later")
-        self.assertGdbRepr(frozenset(), 'frozenset()')
-        self.assertGdbRepr(frozenset(['a', 'b']), "frozenset({'a', 'b'})")
-        self.assertGdbRepr(frozenset([4, 5, 6]), "frozenset({4, 5, 6})")
+        self.assertGdbRepr(frozenset(), "frozenset()")
+        self.assertGdbRepr(frozenset(['a']), "frozenset({'a'})")
+        # PYTHONHASHSEED is need to get the exact frozenset item order
+        if not sys.flags.ignore_environment:
+            self.assertGdbRepr(frozenset(['a', 'b']), "frozenset({'a', 'b'})")
+            self.assertGdbRepr(frozenset([4, 5, 6]), "frozenset({4, 5, 6})")
 
     def test_exceptions(self):
         # Test a RuntimeError
@@ -510,6 +516,10 @@ id(foo)''')
 
     def test_builtins_help(self):
         'Ensure that the new-style class _Helper in site.py can be handled'
+
+        if sys.flags.no_site:
+            self.skipTest("need site module, but -S option was used")
+
         # (this was the issue causing tracebacks in
         #  http://bugs.python.org/issue8032#msg100537 )
         gdb_repr, gdb_output = self.get_gdb_repr('id(__builtins__.help)', import_site=True)