diff options
author | Jun Li <matthew.lijun@huawei.com> | 2016-10-08 02:33:08 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2016-10-08 02:33:08 +0000 |
commit | 23f716997d7cc1f396007f5b2e3c4d82dc2e94a3 (patch) | |
tree | 33c968c9d88da2497be2b51969a456ffa88af843 /testsuites/vstf/vstf_collector.py | |
parent | c84e4a663343a1d19073ce73a5c0596a99d84a52 (diff) | |
parent | 6204bfbe6228d5167bdb67c42cac4c884cdcf664 (diff) |
Merge "autopep8 fix for flake8"
Diffstat (limited to 'testsuites/vstf/vstf_collector.py')
-rwxr-xr-x | testsuites/vstf/vstf_collector.py | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/testsuites/vstf/vstf_collector.py b/testsuites/vstf/vstf_collector.py index 7206e32d..af11bc66 100755 --- a/testsuites/vstf/vstf_collector.py +++ b/testsuites/vstf/vstf_collector.py @@ -14,7 +14,9 @@ import logging LOG = logging.getLogger(__name__)
+
class Uploader(object):
+
def __init__(self, conf):
self.headers = {'Content-type': 'application/json'}
self.timeout = 5
@@ -36,12 +38,18 @@ class Uploader(object): self.result["case_name"] = case_name
self.result["details"] = raw_data
try:
- LOG.debug('Result to be uploaded:\n %s' % json.dumps(self.result, indent=4))
+ LOG.debug(
+ 'Result to be uploaded:\n %s' %
+ json.dumps(
+ self.result,
+ indent=4))
res = requests.post(self.target,
data=json.dumps(self.result),
headers=self.headers,
timeout=self.timeout)
- print('Test result posting finished with status code %d.' % res.status_code)
+ print(
+ 'Test result posting finished with status code %d.' %
+ res.status_code)
except Exception as err:
LOG.error('Failed to record result data: %s', err)
@@ -49,8 +57,14 @@ class Uploader(object): if __name__ == "__main__":
logging.basicConfig(level=logging.DEBUG)
parser = argparse.ArgumentParser()
- parser.add_argument('--config', required=True, help="basic config file for uploader, json format.")
- parser.add_argument('--dir', required=True, help="result files for test cases")
+ parser.add_argument(
+ '--config',
+ required=True,
+ help="basic config file for uploader, json format.")
+ parser.add_argument(
+ '--dir',
+ required=True,
+ help="result files for test cases")
args = parser.parse_args()
realpath = os.path.realpath(args.dir)
for filename in os.listdir(args.dir):
@@ -58,4 +72,9 @@ if __name__ == "__main__": LOG.debug("uploading test result from file:%s", filepath)
with open(filepath) as stream:
result = eval(stream.read())
- Uploader(args.config).upload_result(filename.lower().replace('-', ''), result)
+ Uploader(
+ args.config).upload_result(
+ filename.lower().replace(
+ '-',
+ ''),
+ result)
|