← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~thomir/txfixtures/trunk-py3 into lp:txfixtures

 

Thomi Richards has proposed merging lp:~thomir/txfixtures/trunk-py3 into lp:txfixtures.

Commit message:
Add python3 support.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~thomir/txfixtures/trunk-py3/+merge/284377

Add python3 support.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~thomir/txfixtures/trunk-py3 into lp:txfixtures.
=== modified file 'txfixtures/osutils.py'
--- txfixtures/osutils.py	2011-12-01 21:09:30 +0000
+++ txfixtures/osutils.py	2016-01-29 01:44:03 +0000
@@ -20,7 +20,7 @@
     """Kill a pid accepting that it may not exist."""
     try:
         os.kill(pid, signal_number)
-    except OSError, e:
+    except OSError as e:
         if e.errno in (errno.ESRCH, errno.ECHILD):
             # Process has already been killed.
             return
@@ -62,7 +62,7 @@
             if new_pid:
                 return result
             time.sleep(poll_interval)
-        except OSError, e:
+        except OSError as e:
             if e.errno in (errno.ESRCH, errno.ECHILD):
                 # Raised if the process is gone by the time we try to get the
                 # return value.
@@ -90,7 +90,7 @@
     """Remove the given file if it exists."""
     try:
         os.remove(path)
-    except OSError, e:
+    except OSError as e:
         if e.errno != errno.ENOENT:
             raise
 
@@ -109,11 +109,11 @@
     for i in range(retries):
         try:
             return function(*args, **kwargs)
-        except (IOError, OSError), e:
+        except (IOError, OSError) as e:
             if e.errno == errno.EINTR:
                 continue
             raise
-        except socket.error, e:
+        except socket.error as e:
             # In Python 2.6 we can use IOError instead.  It also has
             # reason.errno but we might be using 2.5 here so use the
             # index hack.

=== modified file 'txfixtures/tachandler.py'
--- txfixtures/tachandler.py	2011-12-01 21:38:07 +0000
+++ txfixtures/tachandler.py	2016-01-29 01:44:03 +0000
@@ -135,7 +135,7 @@
             s.connect((host, port))
             s.close()
             return True
-        except socket.error, e:
+        except socket.error as e:
             if e.errno == errno.ECONNREFUSED:
                 return False
             else:

=== modified file 'txfixtures/tests/test_tachandler.py'
--- txfixtures/tests/test_tachandler.py	2011-11-04 07:53:26 +0000
+++ txfixtures/tests/test_tachandler.py	2016-01-29 01:44:03 +0000
@@ -126,7 +126,7 @@
 
         # Put the (now bogus) pid in the pid file.
         with open(fixture.pidfile, "wb") as pidfile:
-            pidfile.write(str(process.pid))
+            pidfile.write(str(process.pid).encode())
 
         # Fire up the fixture, capturing warnings.
         with warnings.catch_warnings(record=True) as warnings_log:


Follow ups