Merge lp:~thomir-deactivatedaccount/txfixtures/trunk-py3 into lp:~canonical-launchpad-branches/txfixtures/trunk

Proposed by Thomi Richards
Status: Work in progress
Proposed branch: lp:~thomir-deactivatedaccount/txfixtures/trunk-py3
Merge into: lp:~canonical-launchpad-branches/txfixtures/trunk
Diff against target: 70 lines (+7/-7)
3 files modified
txfixtures/osutils.py (+5/-5)
txfixtures/tachandler.py (+1/-1)
txfixtures/tests/test_tachandler.py (+1/-1)
To merge this branch: bzr merge lp:~thomir-deactivatedaccount/txfixtures/trunk-py3
Reviewer Review Type Date Requested Status
Thomi Richards (community) Disapprove
Launchpad code reviewers Pending
Review via email: mp+284377@code.launchpad.net

Commit message

Add python3 support.

Description of the change

Add python3 support.

To post a comment you must log in.
Revision history for this message
Thomi Richards (thomir-deactivatedaccount) wrote :

Turns out there's some pretty serious twisted / py3 issues. Until those are sorted out, this will have to wait.

review: Disapprove

Unmerged revisions

14. By Thomi Richards

Add python3 compatibility.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'txfixtures/osutils.py'
2--- txfixtures/osutils.py 2011-12-01 21:09:30 +0000
3+++ txfixtures/osutils.py 2016-01-29 01:44:03 +0000
4@@ -20,7 +20,7 @@
5 """Kill a pid accepting that it may not exist."""
6 try:
7 os.kill(pid, signal_number)
8- except OSError, e:
9+ except OSError as e:
10 if e.errno in (errno.ESRCH, errno.ECHILD):
11 # Process has already been killed.
12 return
13@@ -62,7 +62,7 @@
14 if new_pid:
15 return result
16 time.sleep(poll_interval)
17- except OSError, e:
18+ except OSError as e:
19 if e.errno in (errno.ESRCH, errno.ECHILD):
20 # Raised if the process is gone by the time we try to get the
21 # return value.
22@@ -90,7 +90,7 @@
23 """Remove the given file if it exists."""
24 try:
25 os.remove(path)
26- except OSError, e:
27+ except OSError as e:
28 if e.errno != errno.ENOENT:
29 raise
30
31@@ -109,11 +109,11 @@
32 for i in range(retries):
33 try:
34 return function(*args, **kwargs)
35- except (IOError, OSError), e:
36+ except (IOError, OSError) as e:
37 if e.errno == errno.EINTR:
38 continue
39 raise
40- except socket.error, e:
41+ except socket.error as e:
42 # In Python 2.6 we can use IOError instead. It also has
43 # reason.errno but we might be using 2.5 here so use the
44 # index hack.
45
46=== modified file 'txfixtures/tachandler.py'
47--- txfixtures/tachandler.py 2011-12-01 21:38:07 +0000
48+++ txfixtures/tachandler.py 2016-01-29 01:44:03 +0000
49@@ -135,7 +135,7 @@
50 s.connect((host, port))
51 s.close()
52 return True
53- except socket.error, e:
54+ except socket.error as e:
55 if e.errno == errno.ECONNREFUSED:
56 return False
57 else:
58
59=== modified file 'txfixtures/tests/test_tachandler.py'
60--- txfixtures/tests/test_tachandler.py 2011-11-04 07:53:26 +0000
61+++ txfixtures/tests/test_tachandler.py 2016-01-29 01:44:03 +0000
62@@ -126,7 +126,7 @@
63
64 # Put the (now bogus) pid in the pid file.
65 with open(fixture.pidfile, "wb") as pidfile:
66- pidfile.write(str(process.pid))
67+ pidfile.write(str(process.pid).encode())
68
69 # Fire up the fixture, capturing warnings.
70 with warnings.catch_warnings(record=True) as warnings_log:

Subscribers

No one subscribed via source and target branches