File: python3.patch

package info (click to toggle)
6tunnel 1%3A0.13-4
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 184 kB
  • sloc: ansic: 687; sh: 180; python: 106; makefile: 8
file content (31 lines) | stat: -rw-r--r-- 1,259 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
--- a/test.py
+++ b/test.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 import os
 import socket
@@ -9,6 +9,13 @@
 labels = ["success", "command fail", "connection fail", "disconnection", "accept fail", "data mismatch"]
 
 def test(expect, client_af, server_af, from_ip, to_ip, args="", client_sends_first="NICK nick\r\n", server_receives="NICK nick\r\n", app_responds="", app_inserts="", server_sends_then=":localhost 001 nick :Welcome\r\n"):
+
+    client_sends_first = client_sends_first.encode('ascii')
+    server_receives = server_receives.encode('ascii')
+    app_responds = app_responds.encode('ascii')
+    app_inserts = app_inserts.encode('ascii')
+    server_sends_then = server_sends_then.encode('ascii')
+
     # Open and close a socket to get random port available
 
     client_sock = socket.socket(client_af, socket.SOCK_STREAM, 0)
@@ -26,7 +33,7 @@
     server_port = server_sock.getsockname()[1]
 
     all_args = "-1 %s %d %s %d" % (args, client_port, to_ip, server_port)
-    print "Running with %s" % all_args
+    print("Running with %s" % all_args)
     if os.system("./6tunnel " + all_args) != 0:
         if expect != COMMAND_FAIL:
             raise Exception("expected %s yet command failed" % labels[expect])