[python-behave] Add another patch to fix an Unicode error (thanks for vbenes for
Matej Cepl
mcepl at fedoraproject.org
Fri Sep 26 12:27:27 UTC 2014
commit 5c438538952b18f017339b01efa4957b91d3bd2c
Author: Matěj Cepl <mcepl at redhat.com>
Date: Fri Sep 26 14:27:03 2014 +0200
Add another patch to fix an Unicode error (thanks for vbenes for
fixing my earlier proposal).
python-behave.spec | 4 +-
yet-another-unicode-error.patch | 54 ++++++++++++++++++++++++++++----------
2 files changed, 42 insertions(+), 16 deletions(-)
---
diff --git a/python-behave.spec b/python-behave.spec
index cd571a7..40ed01c 100644
--- a/python-behave.spec
+++ b/python-behave.spec
@@ -12,7 +12,7 @@
Name: python-%{modname}
Version: 1.2.4
-Release: 3%{?dist}
+Release: 4%{?dist}
Summary: Tools for the behavior-driven development, Python style
License: BSD
@@ -161,7 +161,7 @@ nosetests -v
%changelog
-* Fri Sep 12 2014 Matěj Cepl <mcepl at redhat.com> - 1.2.4-3
+* Fri Sep 12 2014 Matěj Cepl <mcepl at redhat.com> - 1.2.4-4
- Add another patch to fix an Unicode error (thanks for vbenes for
fixing my earlier proposal).
diff --git a/yet-another-unicode-error.patch b/yet-another-unicode-error.patch
index 7dc1754..22caae8 100644
--- a/yet-another-unicode-error.patch
+++ b/yet-another-unicode-error.patch
@@ -1,23 +1,49 @@
+From 456305ab21d7307a7d9742e332caffae4109dc8e Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Mat=C4=9Bj=20Cepl?= <mcepl at redhat.com>
+Date: Mon, 15 Sep 2014 15:30:18 +0200
+Subject: [PATCH] Fix Unicode-related crash in model.py
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Fixes #251
+
+Signed-off-by: Matěj Cepl <mcepl at redhat.com>
+---
+ behave/model.py | 15 +++++++++------
+ 1 file changed, 9 insertions(+), 6 deletions(-)
+
+diff --git a/behave/model.py b/behave/model.py
+index 51f9b56..3a8c646 100644
--- a/behave/model.py
+++ b/behave/model.py
-@@ -1203,7 +1203,7 @@ class Step(BasicStatement, Replayable):
+@@ -1432,17 +1432,20 @@ class Step(BasicStatement, Replayable):
if capture:
# -- CAPTURE-ONLY: Non-nested step failures.
if runner.config.stdout_capture:
- output = runner.stdout_capture.getvalue()
-+ output = runner.stdout_capture.getvalue().encode('utf_8')
++ output = unicode(runner.stdout_capture.getvalue(),
++ 'unicode-escape')
if output:
- error += '\nCaptured stdout:\n' + output
+- error += '\nCaptured stdout:\n' + output
++ error += u'\nCaptured stdout:\n' + output
if runner.config.stderr_capture:
---- a/behave/formatter/pretty.py
-+++ b/behave/formatter/pretty.py
-@@ -157,7 +157,8 @@ class PrettyFormatter(Formatter):
- location = self._match.location
- self.print_step(result.status, arguments, location, True)
- if result.error_message:
-- self.stream.write(indent(result.error_message.strip(), u' '))
-+ out = result.error_message.strip().decode('unicode-escape')
-+ self.stream.write(indent(out, 6 * u' '))
- self.stream.write('\n\n')
- self.stream.flush()
+- output = runner.stderr_capture.getvalue()
++ output = unicode(runner.stderr_capture.getvalue(),
++ 'unicode-escape')
+ if output:
+- error += '\nCaptured stderr:\n' + output
++ error += u'\nCaptured stderr:\n' + output
+ if runner.config.log_capture:
+- output = runner.log_capture.getvalue()
++ output = unicode(runner.log_capture.getvalue(),
++ 'unicode-escape')
+ if output:
+- error += '\nCaptured logging:\n' + output
++ error += u'\nCaptured logging:\n' + output
+ self.error_message = error
+ keep_going = False
+--
+1.8.3.1
+
More information about the scm-commits
mailing list