diff options
author | Gregory P. Smith <greg@krypto.org> | 2015-02-04 09:04:31 (GMT) |
---|---|---|
committer | Gregory P. Smith <greg@krypto.org> | 2015-02-04 09:04:31 (GMT) |
commit | 8f2fae1e7d7142a280a23bb9428d0aaddbb518c5 (patch) | |
tree | f53026d0eb093df250a19cd2dd8d80ba5587ebed /Lib/test/test_tracemalloc.py | |
parent | a7559c04e09980a3ae468a996609805dfe413ca4 (diff) | |
parent | b9a3dd9dfb780b9691f8a1859fd67cf9eadbd2d0 (diff) | |
download | cpython-8f2fae1e7d7142a280a23bb9428d0aaddbb518c5.zip cpython-8f2fae1e7d7142a280a23bb9428d0aaddbb518c5.tar.gz cpython-8f2fae1e7d7142a280a23bb9428d0aaddbb518c5.tar.bz2 |
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 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.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/test/test_tracemalloc.py b/Lib/test/test_tracemalloc.py index bc22450..19d3fd8 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())' |