summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorGregory P. Smith <greg@krypto.org>2015-01-22 22:38:26 (GMT)
committerGregory P. Smith <greg@krypto.org>2015-01-22 22:38:26 (GMT)
commit1d51ba6a6e8924955d936b4ee6d7a49256776054 (patch)
tree373493e4e67c860b6bb68e6f1e8b89c73dd3eedd /Lib/test
parent58c85144db694508573fde2dc1df1b5ec12a7677 (diff)
parent34cd2ae69fc9a004c95e6c361aa7cd3ae4db2caa (diff)
downloadcpython-1d51ba6a6e8924955d936b4ee6d7a49256776054.zip
cpython-1d51ba6a6e8924955d936b4ee6d7a49256776054.tar.gz
cpython-1d51ba6a6e8924955d936b4ee6d7a49256776054.tar.bz2
Break up TestCommandLine.test_env_var into four distinct tests.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_tracemalloc.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/Lib/test/test_tracemalloc.py b/Lib/test/test_tracemalloc.py
index 33b0dc2..bc22450 100644
--- a/Lib/test/test_tracemalloc.py
+++ b/Lib/test/test_tracemalloc.py
@@ -748,26 +748,28 @@ class TestFilters(unittest.TestCase):
class TestCommandLine(unittest.TestCase):
- def test_env_var(self):
+ def test_env_var_disabled_by_default(self):
# not tracing by default
code = 'import tracemalloc; print(tracemalloc.is_tracing())'
ok, stdout, stderr = assert_python_ok('-c', code)
stdout = stdout.rstrip()
self.assertEqual(stdout, b'False')
- # PYTHON* environment variables must be ignored when -E option is
- # present
+ 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())'
ok, stdout, stderr = assert_python_ok('-E', '-c', code, PYTHONTRACEMALLOC='1')
stdout = stdout.rstrip()
self.assertEqual(stdout, b'False')
+ def test_env_var_enabled_at_startup(self):
# tracing at startup
code = 'import tracemalloc; print(tracemalloc.is_tracing())'
ok, stdout, stderr = assert_python_ok('-c', code, PYTHONTRACEMALLOC='1')
stdout = stdout.rstrip()
self.assertEqual(stdout, b'True')
+ def test_env_limit(self):
# start and set the number of frames
code = 'import tracemalloc; print(tracemalloc.get_traceback_limit())'
ok, stdout, stderr = assert_python_ok('-c', code, PYTHONTRACEMALLOC='10')