aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/benchmark/scenarios/parser/parser.py
diff options
context:
space:
mode:
Diffstat (limited to 'yardstick/benchmark/scenarios/parser/parser.py')
-rw-r--r--yardstick/benchmark/scenarios/parser/parser.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/yardstick/benchmark/scenarios/parser/parser.py b/yardstick/benchmark/scenarios/parser/parser.py
index 006258d05..6d39733c6 100644
--- a/yardstick/benchmark/scenarios/parser/parser.py
+++ b/yardstick/benchmark/scenarios/parser/parser.py
@@ -6,6 +6,8 @@
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
+from __future__ import print_function
+from __future__ import absolute_import
import pkg_resources
import logging
import subprocess
@@ -58,10 +60,12 @@ class Parser(base.Scenario):
cmd1 = "%s %s %s" % (self.parser_script, yangfile, toscafile)
cmd2 = "chmod 777 %s" % (self.parser_script)
subprocess.call(cmd2, shell=True)
- output = subprocess.call(cmd1, shell=True, stdout=subprocess.PIPE)
- print "yangtotosca finished"
+ p = subprocess.Popen(cmd1, shell=True, stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE)
+ p.communicate()
+ print("yangtotosca finished")
- result['yangtotosca'] = "success" if output == 0 else "fail"
+ result['yangtotosca'] = "success" if p.returncode == 0 else "fail"
def teardown(self):
''' for scenario teardown remove parser and pyang '''
@@ -76,5 +80,6 @@ def _test():
'''internal test function'''
pass
+
if __name__ == '__main__':
_test()