summaryrefslogtreecommitdiffstats
path: root/testsuites/vstf/vstf_collector.py
diff options
context:
space:
mode:
authoryuyang <Gabriel.yuyang@huawei.com>2016-10-01 02:21:36 +0800
committeryuyang <Gabriel.yuyang@huawei.com>2016-10-01 02:23:53 +0800
commit6204bfbe6228d5167bdb67c42cac4c884cdcf664 (patch)
treeb67981719c8aa0542e040d70951bdb7aff044aad /testsuites/vstf/vstf_collector.py
parent3ac496ac711f40f2a4c4fb0837758b4fbade43e4 (diff)
autopep8 fix for flake8
JIRA: BOTTLENECK-101 Using autopep8 to fix the python style scanned by flake8 Change-Id: I74bf28ed4d999dac3dd36e9101f099c9853a49b6 Signed-off-by: yuyang <Gabriel.yuyang@huawei.com>
Diffstat (limited to 'testsuites/vstf/vstf_collector.py')
-rwxr-xr-xtestsuites/vstf/vstf_collector.py29
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)