Coverage for mflog/unittests.py: 100%
21 statements
« prev ^ index » next coverage.py v7.2.7, created at 2024-10-08 09:20 +0000
« prev ^ index » next coverage.py v7.2.7, created at 2024-10-08 09:20 +0000
1# -*- coding: utf-8 -*-
3import os
4import mflog
6UNIT_TESTS_MODE = (os.environ.get('_MFLOG_UNITTESTS', '0') == '1')
7UNIT_TESTS_STDOUT = []
8UNIT_TESTS_STDERR = []
9UNIT_TESTS_JSON = []
12def reset_unittests():
13 """Reset unittests."""
14 global UNIT_TESTS_STDOUT, UNIT_TESTS_STDERR, UNIT_TESTS_JSON
15 del(UNIT_TESTS_STDOUT[:])
16 del(UNIT_TESTS_STDERR[:])
17 del(UNIT_TESTS_JSON[:])
18 try:
19 del(os.environ["MFLOG_EXTRA_CONTEXT_FUNC"])
20 except Exception:
21 pass
22 try:
23 del(os.environ["MFLOG_JSON_ONLY_KEYS"])
24 except Exception:
25 pass
26 mflog.__unset_configuration()
29def extra_context():
30 return {"extra_context_key1": "extra_context_value1",
31 "extra_context_key2": "extra_context_value2"}