| 1 |
@issue |
| 2 |
Feature: Issue #300 -- UnicodeDecodeError when read steps.py |
| 3 |
|
| 4 |
. My system is running on Chinese GBK character set. |
| 5 |
. But you know we make our files as utf-8 format generally, and so do I. |
| 6 |
. I set my step file api1_steps.py as utf-8, and entered some Chinese characters in. |
| 7 |
. I run "behave", but I got UnicodeDecodeError, just like this: |
| 8 |
. |
| 9 |
. File "D:\workspace\env_110\lib\site-packages\behave\runner.py", line 304, in exec_file |
| 10 |
. code = compile(f.read(), filename2, 'exec') |
| 11 |
. UnicodeDecodeError: 'gbk' codec can't decode byte 0xad in position 510: illegal multibyte sequence |
| 12 |
|
| 13 |
| OPEN ISSUES: |
| 14 |
| * Acceptable/supported Python source file encodings |
| 15 |
| * config: Add encoding option for feature files, step files or both. |
| 16 |
|
| 17 |
Scenario: Cause BAD-ASCII Syndrome in steps file |
| 18 |
Given a new working directory |
| 19 |
And a file named "features/steps/bad_ascii_steps.py" with: |
| 20 |
""" |
| 21 |
''' |
| 22 |
BAD ASCII CASES (requires UTF-8/latin1 support): |
| 23 |
* Café |
| 24 |
* Ärgernis ist überall |
| 25 |
''' |
| 26 |
# COMMENT: Ärgernis ist überall |
| 27 |
""" |
| 28 |
And a file named "features/steps/steps.py" with: |
| 29 |
""" |
| 30 |
from __future__ import unicode_literals |
| 31 |
from behave import step |
| 32 |
|
| 33 |
@step('{word:w} step passes') |
| 34 |
def step_passes(context, word): |
| 35 |
pass |
| 36 |
""" |
| 37 |
And a file named "features/e1.feature" with: |
| 38 |
""" |
| 39 |
Feature: |
| 40 |
Scenario: Alice |
| 41 |
Given a step passes |
| 42 |
Then another step passes |
| 43 |
""" |
| 44 |
When I run "behave -f plain features/e1.feature" |
| 45 |
Then it should pass with: |
| 46 |
""" |
| 47 |
1 scenario passed, 0 failed, 0 skipped |
| 48 |
2 steps passed, 0 failed, 0 skipped, 0 undefined |
| 49 |
""" |