|
15 | 15 |
|
16 | 16 |
|
17 | 17 | EMPTY_STRING_SIZE = sys.getsizeof(b'') |
| 18 | +INVALID_NFRAME = (-1, 2**30) |
18 | 19 |
|
19 | 20 |
|
20 | 21 | def get_frames(nframe, lineno_delta): |
@@ -833,6 +834,13 @@ def test_env_var_ignored_with_E(self): |
833 | 834 | stdout = stdout.rstrip() |
834 | 835 | self.assertEqual(stdout, b'False') |
835 | 836 |
|
| 837 | + def test_env_var_disabled(self): |
| 838 | + # tracing at startup |
| 839 | + code = 'import tracemalloc; print(tracemalloc.is_tracing())' |
| 840 | + ok, stdout, stderr = assert_python_ok('-c', code, PYTHONTRACEMALLOC='0') |
| 841 | + stdout = stdout.rstrip() |
| 842 | + self.assertEqual(stdout, b'False') |
| 843 | + |
836 | 844 | def test_env_var_enabled_at_startup(self): |
837 | 845 | # tracing at startup |
838 | 846 | code = 'import tracemalloc; print(tracemalloc.is_tracing())' |
@@ -861,7 +869,7 @@ def check_env_var_invalid(self, nframe): |
861 | 869 |
|
862 | 870 |
|
863 | 871 | def test_env_var_invalid(self): |
864 | | - for nframe in (-1, 0, 2**30): |
| 872 | + for nframe in INVALID_NFRAME: |
865 | 873 | with self.subTest(nframe=nframe): |
866 | 874 | self.check_env_var_invalid(nframe) |
867 | 875 |
|
@@ -889,7 +897,7 @@ def check_sys_xoptions_invalid(self, nframe): |
889 | 897 | self.fail(f"unexpeced output: {stderr!a}") |
890 | 898 |
|
891 | 899 | def test_sys_xoptions_invalid(self): |
892 | | - for nframe in (-1, 0, 2**30): |
| 900 | + for nframe in INVALID_NFRAME: |
893 | 901 | with self.subTest(nframe=nframe): |
894 | 902 | self.check_sys_xoptions_invalid(nframe) |
895 | 903 |
|
|
0 commit comments