From 51fa93e9e1fe9fed63cffaaa4b5dd571623c535c Mon Sep 17 00:00:00 2001 From: Alessio Bogon Date: Tue, 19 Feb 2019 11:48:33 +0100 Subject: [PATCH] Implicitly decode step definitions to unicode with utf-8 --- pytest.ini | 4 ++++ pytest_bdd/parsers.py | 2 ++ 2 files changed, 6 insertions(+) create mode 100644 pytest.ini diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 0000000..2c4fd03 --- /dev/null +++ b/pytest.ini @@ -0,0 +1,4 @@ +[pytest] +filterwarnings = + error + ignore::DeprecationWarning diff --git a/pytest_bdd/parsers.py b/pytest_bdd/parsers.py index 2896039..2a6b436 100644 --- a/pytest_bdd/parsers.py +++ b/pytest_bdd/parsers.py @@ -123,6 +123,8 @@ def get_parser(step_name): print(warn) return re(step_name.pattern, flags=step_name.flags) elif isinstance(step_name, six.string_types): + if isinstance(step_name, six.binary_type): + step_name = step_name.decode('utf-8') return string(step_name) elif not hasattr(step_name, 'is_matching') or not hasattr(step_name, 'parse_arguments'): raise InvalidStepParserError(step_name)