Skip to content

Commit cc720d8

Browse files
author
Ramiro Morales
committed
Try to make tests work on Python 3.x.
1 parent b84b32b commit cc720d8

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

tests/test_user_msghandler.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,17 @@
1010

1111
def user_msg_handler1(msgstate, severity, srvname, procname, line, msgtext):
1212
global msgs
13-
entry = ("msg_handler1: msgstate = %d, severity = %d, procname = '%s', "
13+
procname = procname.decode('ascii')
14+
msgtext = msgtext.decode('ascii')
15+
entry = (u"msg_handler1: msgstate = %d, severity = %d, procname = '%s', "
1416
"line = %d, msgtext = '%s'") % (msgstate, severity, procname, line, msgtext)
1517
msgs.append(entry)
1618

1719

1820
def user_msg_handler2(msgstate, severity, srvname, procname, line, msgtext):
1921
global msgs
22+
procname = procname.decode('ascii')
23+
msgtext = msgtext.decode('ascii')
2024
entry = ("msg_handler2: msgstate = %d, severity = %d, procname = '%s', "
2125
"line = %d, msgtext = '%s'") % (msgstate, severity, procname, line, msgtext)
2226
msgs.append(entry)
@@ -110,6 +114,8 @@ def test_per_conn_handlers(self):
110114
@staticmethod
111115
def user_msg_handler3(msgstate, severity, srvname, procname, line, msgtext):
112116
global msgs
117+
procname = procname.decode('ascii')
118+
msgtext = msgtext.decode('ascii')
113119
entry = ("msg_handler3 called")
114120
msgs.append(entry)
115121

0 commit comments

Comments
 (0)