]> granicus.if.org Git - python/commitdiff
bpo-32030: Fix test_sys.test_getallocatedblocks() (#4637)
authorVictor Stinner <victor.stinner@gmail.com>
Wed, 29 Nov 2017 22:51:41 +0000 (23:51 +0100)
committerGitHub <noreply@github.com>
Wed, 29 Nov 2017 22:51:41 +0000 (23:51 +0100)
Skip the test if PYTHONMALLOC environment variable is set.

Lib/test/test_sys.py

index a47a6bbc9653cabf64f9f66df34a7834c7d75b2d..7866a5c0054a69c0cd0581aa815895aaca866119 100644 (file)
@@ -778,6 +778,10 @@ class SysModuleTest(unittest.TestCase):
     @unittest.skipUnless(hasattr(sys, "getallocatedblocks"),
                          "sys.getallocatedblocks unavailable on this build")
     def test_getallocatedblocks(self):
+        if (os.environ.get('PYTHONMALLOC', None)
+           and not sys.flags.ignore_environment):
+            self.skipTest("cannot test if PYTHONMALLOC env var is set")
+
         # Some sanity checks
         with_pymalloc = sysconfig.get_config_var('WITH_PYMALLOC')
         a = sys.getallocatedblocks()