From 92eb48506318a8387d95d30a5dddd893e034e903 Mon Sep 17 00:00:00 2001 From: Matěj Cepl Date: Sep 15 2014 13:27:44 +0000 Subject: Add another patch to fix an Unicode error (thanks for vbenes for fixing my earlier proposal). --- diff --git a/python-behave.spec b/python-behave.spec index 1a92c55..cd571a7 100644 --- a/python-behave.spec +++ b/python-behave.spec @@ -12,7 +12,7 @@ Name: python-%{modname} Version: 1.2.4 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Tools for the behavior-driven development, Python style License: BSD @@ -29,6 +29,8 @@ Patch2: Embedding-support-link-caption-and-video-tags.patch Patch3: Don-t-crash-on-invalid-XML-chars-in-embed.patch # Fix for unnecessary relpath compatibility library Patch4: Fix-relpath-imports.patch +# Fix for https://github.com/behave/behave/issues/251 +Patch5: yet-another-unicode-error.patch BuildArch: noarch Requires: python-setuptools @@ -89,6 +91,7 @@ brief feature-examples. %patch2 -p1 -b .EmbeddedVideo %patch3 -p1 -b .NoCrash %patch4 -p1 -b .relpath +%patch5 -p1 -b .UnicodeError # Remove bundled egg-info in case it exists rm -rf %{modname}*.egg-info @@ -158,6 +161,10 @@ nosetests -v %changelog +* Fri Sep 12 2014 Matěj Cepl - 1.2.4-3 +- Add another patch to fix an Unicode error (thanks for vbenes for + fixing my earlier proposal). + * Thu Jul 17 2014 Matěj Cepl - 1.2.4-2 - Build documentation even on EPEL-7. diff --git a/yet-another-unicode-error.patch b/yet-another-unicode-error.patch new file mode 100644 index 0000000..7dc1754 --- /dev/null +++ b/yet-another-unicode-error.patch @@ -0,0 +1,23 @@ +--- a/behave/model.py ++++ b/behave/model.py +@@ -1203,7 +1203,7 @@ 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') + if output: + error += '\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() +