summaryrefslogtreecommitdiff
path: root/Lib/test/support/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/support/__init__.py')
-rw-r--r--Lib/test/support/__init__.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py
index 4a2ed1ea5a..cb3acecbbd 100644
--- a/Lib/test/support/__init__.py
+++ b/Lib/test/support/__init__.py
@@ -459,6 +459,24 @@ TEST_HOME_DIR = os.path.dirname(TEST_SUPPORT_DIR)
TEST_DATA_DIR = os.path.join(TEST_HOME_DIR, "data")
+def darwin_malloc_err_warning(test_name):
+ """Assure user that loud errors generated by macOS libc's malloc are
+ expected."""
+ if sys.platform != 'darwin':
+ return
+
+ import shutil
+ msg = ' NOTICE '
+ detail = (f'{test_name} may generate "malloc can\'t allocate region"\n'
+ 'warnings on macOS systems. This behavior is known. Do not\n'
+ 'report a bug unless tests are also failing. See bpo-40928.')
+
+ padding, _ = shutil.get_terminal_size()
+ print(msg.center(padding, '-'))
+ print(detail)
+ print('-' * padding)
+
+
def findfile(filename, subdir=None):
"""Try to find a file on sys.path or in the test directory. If it is not
found the argument passed to the function is returned (this does not