Using oslo_log instead of logging

Change-Id: I97fc44df44a686110b1e0c47c56adf7207cb5647
This commit is contained in:
zhuzeyu 2017-01-23 18:27:18 +08:00
parent bf73e0cb1c
commit f5501338e6
2 changed files with 10 additions and 10 deletions

View File

@ -21,16 +21,18 @@ is fixed but a skip is still in the Tempest test code
"""
import argparse
import logging
import os
import re
from oslo_log import log as logging
try:
from launchpadlib import launchpad
except ImportError:
launchpad = None
LPCACHEDIR = os.path.expanduser('~/.launchpadlib/cache')
LOG = logging.getLogger(__name__)
def parse_args():
@ -40,11 +42,11 @@ def parse_args():
def info(msg, *args, **kwargs):
logging.info(msg, *args, **kwargs)
LOG.info(msg, *args, **kwargs)
def debug(msg, *args, **kwargs):
logging.debug(msg, *args, **kwargs)
LOG.debug(msg, *args, **kwargs)
def find_skips(start):
@ -110,8 +112,6 @@ def get_results(result_dict):
def main():
logging.basicConfig(format='%(levelname)s: %(message)s',
level=logging.INFO)
parser = parse_args()
results = find_skips(parser.test_path)
unique_bugs = sorted(set([bug for (method, bug) in get_results(results)]))

View File

@ -20,23 +20,25 @@ Track test skips via launchpadlib API and raise alerts if a bug
is fixed but a skip is still in the Tempest test code
"""
import logging
import os
import re
from launchpadlib import launchpad
from oslo_log import log as logging
BASEDIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
TESTDIR = os.path.join(BASEDIR, 'tempest')
LPCACHEDIR = os.path.expanduser('~/.launchpadlib/cache')
LOG = logging.getLogger(__name__)
def info(msg, *args, **kwargs):
logging.info(msg, *args, **kwargs)
LOG.info(msg, *args, **kwargs)
def debug(msg, *args, **kwargs):
logging.debug(msg, *args, **kwargs)
LOG.debug(msg, *args, **kwargs)
def find_skips(start=TESTDIR):
@ -102,8 +104,6 @@ def get_results(result_dict):
if __name__ == '__main__':
logging.basicConfig(format='%(levelname)s: %(message)s',
level=logging.INFO)
results = find_skips()
unique_bugs = sorted(set([bug for (method, bug) in get_results(results)]))
unskips = []