| 1 |
@issue |
| 2 |
@unicode |
| 3 |
Feature: UnicodeDecodeError in tracebacks (when an exception in a step implementation) |
| 4 |
|
| 5 |
. Exception with non-ASCII character is raised in a step implementation. |
| 6 |
. UnicodeDecodeError occurs with: |
| 7 |
. 'ascii' codec can't decode byte 0x82 in position 11: ordinal not in range(128) |
| 8 |
. |
| 9 |
. RELATED: |
| 10 |
. * features/i18n.unicode_problems.feature |
| 11 |
|
| 12 |
@setup |
| 13 |
Scenario: Feature Setup |
| 14 |
Given a new working directory |
| 15 |
And a file named "features/steps/steps.py" with: |
| 16 |
""" |
| 17 |
# -*- coding: UTF-8 -*- |
| 18 |
from behave import step |
| 19 |
import six |
| 20 |
if six.PY2: |
| 21 |
chr = unichr |
| 22 |
|
| 23 |
@step(u'a step raises an exception with non-ASCII character "{char_code:d}"') |
| 24 |
def step_raises_exception_with_non_ascii_text(context, char_code): |
| 25 |
assert 0 <= char_code <= 255, "RANGE-ERROR: char_code=%s" % char_code |
| 26 |
raise RuntimeError(u"FAIL:"+ chr(char_code) +";") |
| 27 |
""" |
| 28 |
|
| 29 |
Scenario Outline: Syndrome with non-ASCII char <char_code> (format=<format>) |
| 30 |
Given a file named "features/syndrome_0226_<char_code>.feature" with: |
| 31 |
""" |
| 32 |
Feature: |
| 33 |
Scenario: |
| 34 |
Given a step raises an exception with non-ASCII character "<char_code>" |
| 35 |
""" |
| 36 |
When I run "behave -f <format> features/syndrome_0226_<char_code>.feature" |
| 37 |
Then it should fail with: |
| 38 |
""" |
| 39 |
0 scenarios passed, 1 failed, 0 skipped |
| 40 |
0 steps passed, 1 failed, 0 skipped, 0 undefined |
| 41 |
""" |
| 42 |
And the command output should contain: |
| 43 |
""" |
| 44 |
RuntimeError: FAIL:<special_char>; |
| 45 |
""" |
| 46 |
But the command output should not contain "UnicodeDecodeError" |
| 47 |
|
| 48 |
Examples: |
| 49 |
| format | char_code | special_char | comment! | |
| 50 |
| plain | 162 | ¢ | cent | |
| 51 |
| pretty | 191 | ¿ | question-mark on-the-head | |