bpo-32030: Fix test_sys.test_getallocatedblocks() (#4637)

Skip the test if PYTHONMALLOC environment variable is set.
This commit is contained in:
Victor Stinner 2017-11-29 23:51:41 +01:00 committed by GitHub
parent 23cc8c0f9e
commit 06be9daf6f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -778,6 +778,10 @@ class SysModuleTest(unittest.TestCase):
@unittest.skipUnless(hasattr(sys, "getallocatedblocks"), @unittest.skipUnless(hasattr(sys, "getallocatedblocks"),
"sys.getallocatedblocks unavailable on this build") "sys.getallocatedblocks unavailable on this build")
def test_getallocatedblocks(self): 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 # Some sanity checks
with_pymalloc = sysconfig.get_config_var('WITH_PYMALLOC') with_pymalloc = sysconfig.get_config_var('WITH_PYMALLOC')
a = sys.getallocatedblocks() a = sys.getallocatedblocks()