diff options
author | native-api <vano@mail.mipt.ru> | 2020-06-12 06:20:11 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-12 06:20:11 (GMT) |
commit | 2145c8c9724287a310bc77a2760d4f1c0ca9eb0c (patch) | |
tree | 754c3c52598209ebfd547710d0736e2ac01351ac /Lib/test/test_site.py | |
parent | ddef3bdc7b254a7e1129a52c17d79cb7c73a88f5 (diff) | |
download | cpython-2145c8c9724287a310bc77a2760d4f1c0ca9eb0c.zip cpython-2145c8c9724287a310bc77a2760d4f1c0ca9eb0c.tar.gz cpython-2145c8c9724287a310bc77a2760d4f1c0ca9eb0c.tar.bz2 |
bpo-33944: site: Add site-packages tracing in verbose mode (GH-12110)
Diffstat (limited to 'Lib/test/test_site.py')
-rw-r--r-- | Lib/test/test_site.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_site.py b/Lib/test/test_site.py index 957e7a4..9f4a8bc 100644 --- a/Lib/test/test_site.py +++ b/Lib/test/test_site.py @@ -13,6 +13,7 @@ from test.support import (captured_stderr, TESTFN, EnvironmentVarGuard, import builtins import encodings import glob +import io import os import re import shutil @@ -320,6 +321,14 @@ class HelperFunctionsTests(unittest.TestCase): mock_addsitedir.assert_not_called() self.assertFalse(known_paths) + def test_trace(self): + message = "bla-bla-bla" + for verbose, out in (True, message + "\n"), (False, ""): + with mock.patch('sys.flags', mock.Mock(verbose=verbose)), \ + mock.patch('sys.stderr', io.StringIO()): + site._trace(message) + self.assertEqual(sys.stderr.getvalue(), out) + class PthFile(object): """Helper class for handling testing of .pth files""" |