diff --git a/app/config.py b/app/config.py index 74342e0..0b691c6 100644 --- a/app/config.py +++ b/app/config.py @@ -11,19 +11,12 @@ isUseATX=True ATXHost = 'http://localhost:8000' # 截图目录相关配置 -import os,platform +import os currentPath = os.path.dirname(os.path.abspath(__file__)) -print(currentPath) -if platform.system()=='Windows': - logPath = currentPath + '\\log\\' - reportPathWin = currentPath + '\\templates\\reports\\' - unittestPathWin = currentPath + '\\test\\' - screen_shot_path = currentPath + '\\static\\screenshot\\' -else: - reportPathLinux =currentPath + '/templates/reports/' - unittestPathLinux = currentPath + '/test/' - logPath = currentPath + '/log/' - screen_shot_path = currentPath +'/static/screenshot/' +logPath = os.path.join(currentPath,'log') +reportPath = os.path.join(currentPath,'templates','reports') +unittestPath = os.path.join(currentPath,'test') +screen_shot_path = os.path.join(currentPath,'static','screenshot') # smtp 发送邮件相关配置: is_email_enable = False #发送邮件开关 diff --git a/app/core/log.py b/app/core/log.py index ad41576..32b5e1e 100644 --- a/app/core/log.py +++ b/app/core/log.py @@ -1,11 +1,11 @@ -import platform +import os import logzero from app import config class log : def __init__(self) : - self.logfile = config.logPath + 'core-service.log' + self.logfile = os.path.join(config.logPath, 'core-service.log') logzero.logfile(self.logfile, maxBytes = 1e6, backupCount = 3) import logging formatter = logging.Formatter('%(asctime)-15s - [%(filename)s: %(lineno)s] -%(levelname)s: %(message)s'); diff --git a/app/core/log1.py b/app/core/log1.py index 85567c4..f13d687 100644 --- a/app/core/log1.py +++ b/app/core/log1.py @@ -1,11 +1,11 @@ -import platform +import os import logzero from app import config class log : def __init__(self) : - self.logfile = config.logPath + 'service.log' + self.logfile = os.path.join(config.logPath, 'service.log') logzero.logfile(self.logfile, maxBytes = 1e6, backupCount = 3) import logging formatter = logging.Formatter('%(asctime)-15s - [%(filename)s: %(lineno)s] -%(levelname)s: %(message)s'); diff --git a/app/log.py b/app/log.py index 5b7371e..c25968e 100644 --- a/app/log.py +++ b/app/log.py @@ -1,11 +1,11 @@ -import platform +import os import logzero from app import config class log : def __init__(self) : - self.logfile = config.logPath + 'flask.log' + self.logfile = os.path.join(config.logPath, 'flask.log') logzero.logfile(self.logfile, maxBytes = 1e6, backupCount = 3) import logging formatter = logging.Formatter('%(asctime)-15s - [%(filename)s: %(lineno)s] -%(levelname)s: %(message)s'); diff --git a/app/logsql.py b/app/logsql.py index f00a339..8df5a40 100644 --- a/app/logsql.py +++ b/app/logsql.py @@ -1,11 +1,11 @@ -import platform +import os import logzero from app import config class log : def __init__(self) : - self.logfile = config.logPath + 'sql.log' + self.logfile = os.path.join(config.logPath, 'sql.log') logzero.logfile(self.logfile, maxBytes = 1e6, backupCount = 3) import logging formatter = logging.Formatter('%(asctime)-15s - [%(filename)s: %(lineno)s] -%(levelname)s: %(message)s'); diff --git a/app/test/log.py b/app/test/log.py index 8cf5bb6..f5e587d 100644 --- a/app/test/log.py +++ b/app/test/log.py @@ -1,14 +1,11 @@ -import platform +import os import logzero from app import config class log : def __init__(self) : - if platform.system() == 'Windows': - self.logfile = config.logPath + '\\' + 'unittest.log' - else: - self.logfile = '/opt/flask/flask/log/unittest.log' + self.logfile = os.path.join(config.logPath ,'unittest.log') logzero.logfile(self.logfile, maxBytes = 1e6, backupCount = 3) self.logger = logzero.logger diff --git a/app/test/run_unittest.py b/app/test/run_unittest.py index df2aabd..9c96a18 100644 --- a/app/test/run_unittest.py +++ b/app/test/run_unittest.py @@ -9,11 +9,7 @@ def run_all(): reportName = 'unittest_' + str(nowTime) reportFileName = reportName + '.html' test_folder = config.unittestPath - - if platform.system() == 'Windows': - reportNameFull = config.reportPath+'\\'+reportFileName - else: - reportNameFull = config.reportPath + '/' + reportFileName + reportNameFull = os.path.join(config.reportPath , reportFileName) start_time = datetime.datetime.now() pytest.main([test_folder,'--html=%s' %reportNameFull,'-o log_cli=true -o log_cli_level=INFO']) diff --git a/doc/17.gif b/doc/17.gif new file mode 100644 index 0000000..29fd16d Binary files /dev/null and b/doc/17.gif differ