Debian Codegraph @

tests/__init__.py

raw
1 import logging
2 import os
3 import platform
4
5
6 if platform.python_implementation() != "PyPy": # pragma: no branch
7 import tracemalloc
8
9
10 format = "%(asctime)s %(levelname)s %(name)s %(message)s"
11
12 if bool(os.environ.get("WEBSOCKETS_DEBUG")): # pragma: no cover
13 # Display every frame sent or received in debug mode.
14 level = logging.DEBUG
15 else:
16 # Hide stack traces of exceptions.
17 level = logging.CRITICAL
18
19 logging.basicConfig(format=format, level=level)
20
21 if bool(os.environ.get("WEBSOCKETS_TRACE")): # pragma: no cover
22 # Trace allocations to debug resource warnings.
23 tracemalloc.start()