修改目录拼接

This commit is contained in:
jerrylizilong 2018-12-12 10:39:14 +08:00
parent 1892f72773
commit ddd1950867
8 changed files with 16 additions and 30 deletions

View File

@ -11,19 +11,12 @@ isUseATX=True
ATXHost = 'http://localhost:8000' ATXHost = 'http://localhost:8000'
# 截图目录相关配置 # 截图目录相关配置
import os,platform import os
currentPath = os.path.dirname(os.path.abspath(__file__)) currentPath = os.path.dirname(os.path.abspath(__file__))
print(currentPath) logPath = os.path.join(currentPath,'log')
if platform.system()=='Windows': reportPath = os.path.join(currentPath,'templates','reports')
logPath = currentPath + '\\log\\' unittestPath = os.path.join(currentPath,'test')
reportPathWin = currentPath + '\\templates\\reports\\' screen_shot_path = os.path.join(currentPath,'static','screenshot')
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/'
# smtp 发送邮件相关配置: # smtp 发送邮件相关配置:
is_email_enable = False #发送邮件开关 is_email_enable = False #发送邮件开关

View File

@ -1,11 +1,11 @@
import platform import os
import logzero import logzero
from app import config from app import config
class log : class log :
def __init__(self) : 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) logzero.logfile(self.logfile, maxBytes = 1e6, backupCount = 3)
import logging import logging
formatter = logging.Formatter('%(asctime)-15s - [%(filename)s: %(lineno)s] -%(levelname)s: %(message)s'); formatter = logging.Formatter('%(asctime)-15s - [%(filename)s: %(lineno)s] -%(levelname)s: %(message)s');

View File

@ -1,11 +1,11 @@
import platform import os
import logzero import logzero
from app import config from app import config
class log : class log :
def __init__(self) : 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) logzero.logfile(self.logfile, maxBytes = 1e6, backupCount = 3)
import logging import logging
formatter = logging.Formatter('%(asctime)-15s - [%(filename)s: %(lineno)s] -%(levelname)s: %(message)s'); formatter = logging.Formatter('%(asctime)-15s - [%(filename)s: %(lineno)s] -%(levelname)s: %(message)s');

View File

@ -1,11 +1,11 @@
import platform import os
import logzero import logzero
from app import config from app import config
class log : class log :
def __init__(self) : 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) logzero.logfile(self.logfile, maxBytes = 1e6, backupCount = 3)
import logging import logging
formatter = logging.Formatter('%(asctime)-15s - [%(filename)s: %(lineno)s] -%(levelname)s: %(message)s'); formatter = logging.Formatter('%(asctime)-15s - [%(filename)s: %(lineno)s] -%(levelname)s: %(message)s');

View File

@ -1,11 +1,11 @@
import platform import os
import logzero import logzero
from app import config from app import config
class log : class log :
def __init__(self) : 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) logzero.logfile(self.logfile, maxBytes = 1e6, backupCount = 3)
import logging import logging
formatter = logging.Formatter('%(asctime)-15s - [%(filename)s: %(lineno)s] -%(levelname)s: %(message)s'); formatter = logging.Formatter('%(asctime)-15s - [%(filename)s: %(lineno)s] -%(levelname)s: %(message)s');

View File

@ -1,14 +1,11 @@
import platform import os
import logzero import logzero
from app import config from app import config
class log : class log :
def __init__(self) : def __init__(self) :
if platform.system() == 'Windows': self.logfile = os.path.join(config.logPath ,'unittest.log')
self.logfile = config.logPath + '\\' + 'unittest.log'
else:
self.logfile = '/opt/flask/flask/log/unittest.log'
logzero.logfile(self.logfile, maxBytes = 1e6, backupCount = 3) logzero.logfile(self.logfile, maxBytes = 1e6, backupCount = 3)
self.logger = logzero.logger self.logger = logzero.logger

View File

@ -9,11 +9,7 @@ def run_all():
reportName = 'unittest_' + str(nowTime) reportName = 'unittest_' + str(nowTime)
reportFileName = reportName + '.html' reportFileName = reportName + '.html'
test_folder = config.unittestPath test_folder = config.unittestPath
reportNameFull = os.path.join(config.reportPath , reportFileName)
if platform.system() == 'Windows':
reportNameFull = config.reportPath+'\\'+reportFileName
else:
reportNameFull = config.reportPath + '/' + reportFileName
start_time = datetime.datetime.now() start_time = datetime.datetime.now()
pytest.main([test_folder,'--html=%s' %reportNameFull,'-o log_cli=true -o log_cli_level=INFO']) pytest.main([test_folder,'--html=%s' %reportNameFull,'-o log_cli=true -o log_cli_level=INFO'])

BIN
doc/17.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1011 KiB