]> granicus.if.org Git - python/commitdiff
Break up TestCommandLine.test_env_var into four distinct tests.
authorGregory P. Smith <greg@krypto.org>
Thu, 22 Jan 2015 22:38:00 +0000 (14:38 -0800)
committerGregory P. Smith <greg@krypto.org>
Thu, 22 Jan 2015 22:38:00 +0000 (14:38 -0800)
Lib/test/test_tracemalloc.py

index 33b0dc2b0eadd90cad16e1304211ff3c7190012b..bc22450f0fb92fde7782347670a04ab3c4240ae7 100644 (file)
@@ -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')