Commit 9d230e7d407f53124df8fb93793374f0e1174261

Authored by lixi
1 parent 4242e002

更新进门称重的方法

commons/ConfigDB.py
... ... @@ -2,11 +2,9 @@
2 2 # -*- coding: UTF-8 -*-
3 3 import pymysql
4 4 import time
5   -import commons.common as ca
6 5 import json
7   -from commons.Logging import Logger
8   -# import chardet
9   -log=Logger()
  6 +import commons.common as ca
  7 +from commons.Logging import log
10 8  
11 9  
12 10 dbhost=ca.get_global_config('global_data','Database','dbhost')
... ...
commons/Logging.py
... ... @@ -55,3 +55,6 @@ class Logger():
55 55 def critical(self,message):
56 56  
57 57 self.logger.critical(message)
  58 +
  59 +
  60 +log=Logger()
58 61 \ No newline at end of file
... ...
commons/MySession.py
... ... @@ -2,10 +2,10 @@
2 2 # -*- coding: UTF-8 -*-
3 3 import requests
4 4 from commons import common as com
5   -from commons.Logging import Logger
  5 +from commons.Logging import log
6 6 from commons.clientSession import cliSession
7 7 from commons.scripts.pwdCry import pwdCry
8   -log=Logger()
  8 +
9 9  
10 10 class mysession(requests.Session):
11 11 "封装了requests的基类,以供后期统一使用"
... ... @@ -127,7 +127,7 @@ class mysession(requests.Session):
127 127 com.get_global_config("global_data", "account", account).split("&")[0])
128 128 self.body = self.body.replace("111111", com.get_global_config("global_data", "account", account).split("&")[1])
129 129 # POST请求,
130   - re = self.se.post(url=self.url, headers=self.header, data=self.body, proxies=self.proxies,
  130 + re = super().post(url=self.url, headers=self.header, data=self.body,
131 131 allow_redirects=False, **kwargs)
132 132 # 判断请求
133 133 assert "UAP_accessToken" in re.headers["Set-Cookie"]
... ... @@ -178,9 +178,6 @@ class mysession(requests.Session):
178 178 :param \*\*kwargs: Optional arguments that ``request`` takes.
179 179 :rtype: requests.Response
180 180 """
181   - # 记录日志
182   - log.info("{0:=^86}".format(''))
183   - log.info("{}\n{}\n".format(url, kwargs))
184 181 # 进行请求
185 182 re = super().get(url, **kwargs)
186 183 return re
... ... @@ -194,9 +191,6 @@ class mysession(requests.Session):
194 191 :param \*\*kwargs: Optional arguments that ``request`` takes.
195 192 :rtype: requests.Response
196 193 """
197   - # 记录日志
198   - log.info("{0:=^86}".format(''))
199   - log.info("{}\n{}\n{}\n{}".format(url, data, json, kwargs))
200 194 # 进行请求
201 195 re = super().post(url, data=data, json=json, **kwargs)
202 196 return re
... ...
commons/SendEmail.py
... ... @@ -7,8 +7,7 @@ from email.header import Header
7 7 from email.mime.text import MIMEText
8 8 from email.mime.image import MIMEImage
9 9 from email.mime.application import MIMEApplication
10   -from commons.Logging import Logger
11   -log=Logger()
  10 +from commons.Logging import log
12 11  
13 12 def send_email_text():
14 13 # 1. 编写邮件内容(Email邮件需要专门的MIME格式)
... ...
commons/common.py
... ... @@ -4,8 +4,7 @@ import os
4 4 import configparser
5 5 import unittest
6 6 from discover import DiscoveringTestLoader
7   -from commons.Logging import Logger
8   -log=Logger()
  7 +from commons.Logging import log
9 8  
10 9  
11 10 def get_global_config(file,section, key):
... ...
testcase/weightBizBill/test_weighingServiceSave.py
... ... @@ -23,7 +23,7 @@ class test_weighingServiceSave(unittest.TestCase):
23 23 def setUp(self) :
24 24 pass
25 25  
26   - @com.mylog
  26 + # @com.mylog
27 27 @unittest.case_mark(my.mark())
28 28 def test_weighingServiceSave_01(self):
29 29 "称重服务:成功新增一条称重服务单"
... ...