Merge lp:~cjwatson/storm/six-moves into lp:storm

Proposed by Colin Watson
Status: Merged
Merged at revision: 507
Proposed branch: lp:~cjwatson/storm/six-moves
Merge into: lp:storm
Diff against target: 185 lines (+18/-14)
8 files modified
storm/uri.py (+1/-1)
storm/variables.py (+1/-1)
tests/databases/base.py (+2/-1)
tests/databases/proxy.py (+6/-5)
tests/mocker.py (+3/-2)
tests/store/base.py (+1/-1)
tests/variables.py (+1/-1)
tests/wsgi.py (+3/-2)
To merge this branch: bzr merge lp:~cjwatson/storm/six-moves
Reviewer Review Type Date Requested Status
Simon Poirier (community) Approve
Review via email: mp+368561@code.launchpad.net

Commit message

Import from six.moves where appropriate.

Description of the change

There are still a few imports that won't work on Python 3 and are a bit less trivial (cStringIO), but this at least lets the test suite just about start up.

To post a comment you must log in.
Revision history for this message
Simon Poirier (simpoir) wrote :

+1

review: Approve
Revision history for this message
Colin Watson (cjwatson) :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'storm/uri.py'
2--- storm/uri.py 2019-06-05 11:41:07 +0000
3+++ storm/uri.py 2019-06-07 17:23:07 +0000
4@@ -20,7 +20,7 @@
5 #
6 from __future__ import print_function
7
8-from urllib import quote
9+from six.moves.urllib.parse import quote
10
11 from storm.exceptions import URIError
12
13
14=== modified file 'storm/variables.py'
15--- storm/variables.py 2019-06-05 11:41:07 +0000
16+++ storm/variables.py 2019-06-07 17:23:07 +0000
17@@ -23,12 +23,12 @@
18 from datetime import datetime, date, time, timedelta
19 from decimal import Decimal
20 from functools import partial
21-import cPickle as pickle
22 import re
23 import uuid
24 import weakref
25
26 import six
27+from six.moves import cPickle as pickle
28
29 from storm.compat import json
30 from storm.exceptions import NoneError
31
32=== modified file 'tests/databases/base.py'
33--- tests/databases/base.py 2019-06-05 11:41:07 +0000
34+++ tests/databases/base.py 2019-06-07 17:23:07 +0000
35@@ -23,11 +23,12 @@
36 from __future__ import print_function
37
38 from datetime import datetime, date, time, timedelta
39-import cPickle as pickle
40 import shutil
41 import sys
42 import os
43
44+from six.moves import cPickle as pickle
45+
46 from storm.uri import URI
47 from storm.expr import Select, Column, SQLToken, SQLRaw, Count, Alias
48 from storm.variables import (Variable, PickleVariable, RawStrVariable,
49
50=== modified file 'tests/databases/proxy.py'
51--- tests/databases/proxy.py 2019-06-05 11:41:07 +0000
52+++ tests/databases/proxy.py 2019-06-07 17:23:07 +0000
53@@ -25,19 +25,20 @@
54 import os
55 import select
56 import socket
57-import SocketServer
58 import threading
59
60+from six.moves import socketserver
61+
62
63 TIMEOUT = 0.1
64
65
66-class ProxyRequestHandler(SocketServer.BaseRequestHandler):
67+class ProxyRequestHandler(socketserver.BaseRequestHandler):
68 """A request handler that proxies traffic to another TCP port."""
69
70 def __init__(self, request, client_address, server):
71 self._generation = server._generation
72- SocketServer.BaseRequestHandler.__init__(
73+ socketserver.BaseRequestHandler.__init__(
74 self, request, client_address, server)
75
76 def handle(self):
77@@ -68,12 +69,12 @@
78 self.request.shutdown(socket.SHUT_WR)
79
80
81-class ProxyTCPServer(SocketServer.ThreadingTCPServer):
82+class ProxyTCPServer(socketserver.ThreadingTCPServer):
83
84 allow_reuse_address = True
85
86 def __init__(self, proxy_dest):
87- SocketServer.ThreadingTCPServer.__init__(
88+ socketserver.ThreadingTCPServer.__init__(
89 self, ("127.0.0.1", 0), ProxyRequestHandler)
90 # Python 2.4 doesn't retrieve the socket details, so record
91 # them here. We need to do this so we can recreate the socket
92
93=== modified file 'tests/mocker.py'
94--- tests/mocker.py 2019-06-07 12:17:35 +0000
95+++ tests/mocker.py 2019-06-07 17:23:07 +0000
96@@ -5,7 +5,6 @@
97 """
98 from __future__ import print_function
99
100-import __builtin__
101 import tempfile
102 import unittest
103 import inspect
104@@ -14,6 +13,8 @@
105 import os
106 import gc
107
108+from six.moves import builtins
109+
110
111 __all__ = ["Mocker", "expect", "IS", "CONTAINS", "IN", "MATCH",
112 "ANY", "ARGS", "KWARGS"]
113@@ -576,7 +577,7 @@
114 if spec is True:
115 spec = object
116 if type is True:
117- type = __builtin__.type(object)
118+ type = builtins.type(object)
119 return Mock(self, spec=spec, type=type, object=object,
120 name=name, count=count, passthrough=passthrough)
121
122
123=== modified file 'tests/store/base.py'
124--- tests/store/base.py 2019-06-05 11:41:07 +0000
125+++ tests/store/base.py 2019-06-07 17:23:07 +0000
126@@ -22,7 +22,6 @@
127
128 from __future__ import print_function
129
130-import cPickle as pickle
131 from cStringIO import StringIO
132 import decimal
133 import gc
134@@ -31,6 +30,7 @@
135 import weakref
136
137 import six
138+from six.moves import cPickle as pickle
139
140 from storm.references import Reference, ReferenceSet, Proxy
141 from storm.database import Result, STATE_DISCONNECTED
142
143=== modified file 'tests/variables.py'
144--- tests/variables.py 2019-06-05 11:41:07 +0000
145+++ tests/variables.py 2019-06-07 17:23:07 +0000
146@@ -22,12 +22,12 @@
147
148 from datetime import datetime, date, time, timedelta
149 from decimal import Decimal
150-import cPickle as pickle
151 import gc
152 import weakref
153 import uuid
154
155 import six
156+from six.moves import cPickle as pickle
157
158 from storm.compat import json
159 from storm.exceptions import NoneError
160
161=== modified file 'tests/wsgi.py'
162--- tests/wsgi.py 2019-06-05 11:41:07 +0000
163+++ tests/wsgi.py 2019-06-07 17:23:07 +0000
164@@ -1,10 +1,11 @@
165 from __future__ import print_function
166
167-import Queue
168 from unittest import TestCase
169 import threading
170 import time
171
172+from six.moves import queue
173+
174 from storm.wsgi import make_app
175
176 class TestMakeApp(TestCase):
177@@ -67,7 +68,7 @@
178 # with two threads in a request at once, each only sees their own
179 # timeline.
180 app, find_timeline = make_app(self.stub_app)
181- errors = Queue.Queue()
182+ errors = queue.Queue()
183 sync = threading.Condition()
184 waiting = []
185 def check_timeline():

Subscribers

People subscribed via source and target branches

to status/vote changes: