Hi,

attaching patch to fix failing test in ipatests/test_ipalib/test_errors.py. Failures were caused by comparing unicode and non-unicode strings, hence I modified responsible non-unicode strings to unicode.


Lenka

From 28f4860fc22307e9e16937b0e748aa16c2e85937 Mon Sep 17 00:00:00 2001
From: Lenka Doudova <ldoud...@redhat.com>
Date: Mon, 20 Jun 2016 10:29:26 +0200
Subject: [PATCH] Tests: Fix failing ipatests/test_ipalib/test_errors.py

Some strings in the testsuite are unicode which wasn't reflected in the tests. This patch fixes the problem by changing concerned strings to unicode.
---
 ipatests/test_ipalib/test_errors.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/ipatests/test_ipalib/test_errors.py b/ipatests/test_ipalib/test_errors.py
index 7ad07b0418c8f1b1bb89397aa7bf6c8c2f87ab6d..8bf2cba450f26ba12d116725cca4f377029f05db 100644
--- a/ipatests/test_ipalib/test_errors.py
+++ b/ipatests/test_ipalib/test_errors.py
@@ -244,8 +244,8 @@ class test_PublicError(PublicExceptionTester):
         message = u'The translated, interpolated message'
         format = 'key=%(key1)r and key2=%(key2)r'
         uformat = u'Translated key=%(key1)r and key2=%(key2)r'
-        val1 = 'Value 1'
-        val2 = 'Value 2'
+        val1 = u'Value 1'
+        val2 = u'Value 2'
         kw = dict(key1=val1, key2=val2)
 
         # Test with format=str, message=None
@@ -304,7 +304,7 @@ class test_PublicError(PublicExceptionTester):
             format = '%(true)r %(text)r %(number)r'
 
         uformat = u'Translated %(true)r %(text)r %(number)r'
-        kw = dict(true=True, text='Hello!', number=18)
+        kw = dict(true=True, text=u'Hello!', number=18)
 
         # Test with format=str, message=None
         e = raises(ValueError, subclass, format, **kw)
@@ -342,7 +342,7 @@ class test_PublicError(PublicExceptionTester):
                             '$')
         inst = subclass(instructions=instructions, **kw)
         assert inst.format is subclass.format
-        assert_equal(inst.instructions, instructions)
+        assert_equal(inst.instructions, unicode(instructions))
         inst_match = regexp.match(inst.strerror).groups()
         assert_equal(list(inst_match),list(instructions))
 
-- 
2.7.4

-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to