summaryrefslogtreecommitdiff
path: root/Lib/test/test_tracemalloc.py
diff options
context:
space:
mode:
authorGregory P. Smith <greg@krypto.org>2015-02-04 00:59:40 -0800
committerGregory P. Smith <greg@krypto.org>2015-02-04 00:59:40 -0800
commitb9a3dd9dfb780b9691f8a1859fd67cf9eadbd2d0 (patch)
treec186f9c50fd386da260b0c345550df9f0a65ac81 /Lib/test/test_tracemalloc.py
parent17d87f8ae42122025b5ce41230df6ba9e042ec40 (diff)
downloadcpython-git-b9a3dd9dfb780b9691f8a1859fd67cf9eadbd2d0.tar.gz
Skip some tests that require a subinterpreter launched with -E or -I when the
interpreter under test is being run in an environment that requires the use of environment variables such as PYTHONHOME in order to function at all. Adds a private test.script_helper._interpreter_requires_environment() function to be used with @unittest.skipIf on stdlib test methods requiring this.
Diffstat (limited to 'Lib/test/test_tracemalloc.py')
-rw-r--r--Lib/test/test_tracemalloc.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/test/test_tracemalloc.py b/Lib/test/test_tracemalloc.py
index bc22450f0f..48ccab28b8 100644
--- a/Lib/test/test_tracemalloc.py
+++ b/Lib/test/test_tracemalloc.py
@@ -5,7 +5,7 @@ import tracemalloc
import unittest
from unittest.mock import patch
from test.script_helper import assert_python_ok, assert_python_failure
-from test import support
+from test import script_helper, support
try:
import threading
except ImportError:
@@ -755,6 +755,8 @@ class TestCommandLine(unittest.TestCase):
stdout = stdout.rstrip()
self.assertEqual(stdout, b'False')
+ @unittest.skipIf(script_helper._interpreter_requires_environment(),
+ 'Cannot run -E tests when PYTHON env vars are required.')
def test_env_var_ignored_with_E(self):
"""PYTHON* environment variables must be ignored when -E is present."""
code = 'import tracemalloc; print(tracemalloc.is_tracing())'