third_party_importer.py
914 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env python3
"""
Module for testing import of common logging modules by third party modules.
This module behaves like a third party module. It does not use the common
logging and enables logging on its own. But it imports log_helper_test_main.
"""
import sys
import logging
from tests.common.log_helper import log_helper_test_main
def main(args):
"""
Main function, called when running file as script
see module doc for more info
"""
logging.basicConfig(level=logging.INFO)
if 'enable' in args:
log_helper_test_main.enable_logging()
logging.debug('Should not show.')
logging.info('Start message from 3rd party importer')
log_helper_test_main.do_log()
logging.debug('Returning 0, but you will never see that ... .')
logging.info('End message from 3rd party importer')
return 0
if __name__ == '__main__':
sys.exit(main(sys.argv[1:]))