mirror of
https://github.com/python/cpython.git
synced 2025-11-08 17:41:42 +00:00
bpo-33944: site: Add site-packages tracing in verbose mode (GH-12110)
This commit is contained in:
parent
ddef3bdc7b
commit
2145c8c972
4 changed files with 24 additions and 0 deletions
|
|
@ -13,6 +13,7 @@
|
|||
import builtins
|
||||
import encodings
|
||||
import glob
|
||||
import io
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
|
|
@ -320,6 +321,14 @@ def test_no_home_directory(self):
|
|||
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"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue