[Python-checkins] cpython (merge 3.4 -> default): Break up TestCommandLine.test_env_var into four distinct tests.

gregory.p.smith python-checkins at python.org
Thu Jan 22 23:38:55 CET 2015


https://hg.python.org/cpython/rev/e94fa708c1c6
changeset: 94244:e94fa708c1c6
parent: 94242:1c1c0f40a64b
parent: 94243:76e3f80eb680
user: Gregory P. Smith <greg at krypto.org>
date: Thu Jan 22 14:38:26 2015 -0800
summary:
 Break up TestCommandLine.test_env_var into four distinct tests.
files:
 Lib/test/test_tracemalloc.py | 8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/Lib/test/test_tracemalloc.py b/Lib/test/test_tracemalloc.py
--- a/Lib/test/test_tracemalloc.py
+++ b/Lib/test/test_tracemalloc.py
@@ -748,26 +748,28 @@
 
 
 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')
-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /