python - UnicodeDecodeError while using behave framework(1.2.5) -
i have multiple feature files each containing @ least 5 scenarios(test cases). run features using behave framework giving below command
behave --junit i getting following exception
exception unicodedecodeerror: 'ascii' codec can't decode byte 0xe2 in position 22: ordinal not in range(128) traceback (most recent call last): file "myloc/behave", line 9, in <module> load_entry_point('behave==1.2.5', 'console_scripts', 'behave')() file "project/lib/python2.7/dist-packages/behave/__main__.py", line 109, in main failed = runner.run() file "project/lib/python2.7/dist-packages/behave/runner.py", line 672, in run return self.run_with_paths() file "project/lib/python2.7/dist-packages/behave/runner.py", line 693, in run_with_paths return self.run_model() file "project/lib/python2.7/dist-packages/behave/runner.py", line 483, in run_model failed = feature.run(self) file "project/lib/python2.7/dist-packages/behave/model.py", line 523, in run failed = scenario.run(runner) file "project/lib/python2.7/dist-packages/behave/model.py", line 882, in run if not step.run(runner): file "project/lib/python2.7/dist-packages/behave/model.py", line 1499, in run output = runner.log_capture.getvalue() file "project/lib/python2.7/dist-packages/behave/log_capture.py", line 99, in getvalue return '\n'.join(self.formatter.format(r) r in self.buffer) unicodedecodeerror: 'ascii' codec can't decode byte 0xe2 in position 22: ordinal not in range(128) when exception occurs, behave doesn't run next scenarios(tests)
can fix this
following code worked me
import sys reload(sys) sys.setdefaultencoding('utf-8')
Comments
Post a Comment