1 """
2 Pytest plugin with commonly used fixtures
3 """
4 import os
5 import pytest
6 import logging
7 import logging.config
8 from tlib.base import TestHelper
9
10
11 @pytest.fixture(scope='session')
12 -def tlib_logger(request):
13 """
14 Returns logger with name tlib.\n
15 Logger will get flushed at the end to ensure data is not lost fi tests exist abnormally
16 """
17 config_folder = TestHelper.tlib_config_folder()
18 logging.config.fileConfig(os.path.join(config_folder, "logging.conf"))
19 return logging.getLogger("tlib")
20
21
22
23 @pytest.fixture(scope='session')
24 -def adb_logger(request):
25 """
26 Returns logger with name adb\n
27 Logger will get flushed at the end to ensure data is not lost fi tests exist abnormally
28 """
29 config_folder = TestHelper.tlib_config_folder()
30 logging.config.fileConfig(os.path.join(config_folder, "logging.conf"))
31 return logging.getLogger("adb")
32
33
34
35 @pytest.fixture(scope='session')
36 -def test_logger(request):
37 """
38 Returns logger with name test\n
39 Logger will get flushed at the end to ensure data is not lost fi tests exist abnormally
40 """
41 config_folder = TestHelper.tlib_config_folder()
42 logging.config.fileConfig(os.path.join(config_folder, "logging.conf"))
43 return logging.getLogger("test")
44