Merge lp:~cjwatson/storm/py3-misc-functions into lp:storm

Proposed by Colin Watson
Status: Merged
Merged at revision: 519
Proposed branch: lp:~cjwatson/storm/py3-misc-functions
Merge into: lp:storm
Diff against target: 120 lines (+10/-12)
6 files modified
tests/cache.py (+3/-3)
tests/database.py (+2/-2)
tests/helper.py (+2/-1)
tests/schema/schema.py (+1/-3)
tests/store/base.py (+1/-2)
tests/tracer.py (+1/-1)
To merge this branch: bzr merge lp:~cjwatson/storm/py3-misc-functions
Reviewer Review Type Date Requested Status
Kristian Glass (community) Approve
Storm Developers Pending
Review via email: mp+371167@code.launchpad.net

Commit message

Make various small adjustments to cope with changes in Python 3.

Description of the change

These are all small and hopefully uncontroversial, so I decided to just bundle them into a single MP.

To post a comment you must log in.
Revision history for this message
Kristian Glass (doismellburning) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'tests/cache.py'
--- tests/cache.py 2019-06-05 11:41:07 +0000
+++ tests/cache.py 2019-08-11 12:37:39 +0000
@@ -136,7 +136,7 @@
136 """136 """
137 size = 10137 size = 10
138 cache = self.Cache(size)138 cache = self.Cache(size)
139 for value in xrange(size):139 for value in range(size):
140 cache.add(StubObjectInfo(value))140 cache.add(StubObjectInfo(value))
141 self.assertEqual(len(cache.get_cached()), size)141 self.assertEqual(len(cache.get_cached()), size)
142142
@@ -257,7 +257,7 @@
257 """257 """
258 size = 10258 size = 10
259 cache = GenerationalCache(size)259 cache = GenerationalCache(size)
260 for value in xrange(5 * size):260 for value in range(5 * size):
261 cache.add(StubObjectInfo(value))261 cache.add(StubObjectInfo(value))
262 self.assertEquals(len(cache.get_cached()), size * 2)262 self.assertEquals(len(cache.get_cached()), size * 2)
263263
@@ -300,7 +300,7 @@
300 size = 10300 size = 10
301 cache = GenerationalCache(size * 100)301 cache = GenerationalCache(size * 100)
302 cache.set_size(size)302 cache.set_size(size)
303 for value in xrange(size * 10):303 for value in range(size * 10):
304 cache.add(StubObjectInfo(value))304 cache.add(StubObjectInfo(value))
305 self.assertEquals(len(cache.get_cached()), size * 2)305 self.assertEquals(len(cache.get_cached()), size * 2)
306306
307307
=== modified file 'tests/database.py'
--- tests/database.py 2019-06-25 21:33:26 +0000
+++ tests/database.py 2019-08-11 12:37:39 +0000
@@ -21,7 +21,7 @@
21from __future__ import print_function21from __future__ import print_function
2222
23import sys23import sys
24import new24import types
25import gc25import gc
2626
27from storm.exceptions import ClosedError, DatabaseError, DisconnectionError27from storm.exceptions import ClosedError, DatabaseError, DisconnectionError
@@ -522,7 +522,7 @@
522522
523 def setUp(self):523 def setUp(self):
524 TestHelper.setUp(self)524 TestHelper.setUp(self)
525 self.db_module = new.module("db_module")525 self.db_module = types.ModuleType("db_module")
526 self.uri = None526 self.uri = None
527 def create_from_uri(uri):527 def create_from_uri(uri):
528 self.uri = uri528 self.uri = uri
529529
=== modified file 'tests/helper.py'
--- tests/helper.py 2019-06-05 11:41:07 +0000
+++ tests/helper.py 2019-08-11 12:37:39 +0000
@@ -20,12 +20,13 @@
20#20#
21from __future__ import print_function21from __future__ import print_function
2222
23from cStringIO import StringIO
24import tempfile23import tempfile
25import logging24import logging
26import shutil25import shutil
27import sys26import sys
2827
28from six.moves import cStringIO as StringIO
29
29from tests import mocker30from tests import mocker
3031
3132
3233
=== modified file 'tests/schema/schema.py'
--- tests/schema/schema.py 2019-06-05 11:41:07 +0000
+++ tests/schema/schema.py 2019-08-11 12:37:39 +0000
@@ -67,9 +67,7 @@
67 for name in list(sys.modules):67 for name in list(sys.modules):
68 if name in self._package_names:68 if name in self._package_names:
69 del sys.modules[name]69 del sys.modules[name]
70 elif filter(70 elif any(name.startswith("%s." % x) for x in self._package_names):
71 None,
72 [name.startswith("%s." % x) for x in self._package_names]):
73 del sys.modules[name]71 del sys.modules[name]
7472
75 super(SchemaTest, self).tearDown()73 super(SchemaTest, self).tearDown()
7674
=== modified file 'tests/store/base.py'
--- tests/store/base.py 2019-06-07 17:14:33 +0000
+++ tests/store/base.py 2019-08-11 12:37:39 +0000
@@ -22,7 +22,6 @@
2222
23from __future__ import print_function23from __future__ import print_function
2424
25from cStringIO import StringIO
26import decimal25import decimal
27import gc26import gc
28import operator27import operator
@@ -30,7 +29,7 @@
30import weakref29import weakref
3130
32import six31import six
33from six.moves import cPickle as pickle32from six.moves import cPickle as pickle, cStringIO as StringIO
3433
35from storm.references import Reference, ReferenceSet, Proxy34from storm.references import Reference, ReferenceSet, Proxy
36from storm.database import Result, STATE_DISCONNECTED35from storm.database import Result, STATE_DISCONNECTED
3736
=== modified file 'tests/tracer.py'
--- tests/tracer.py 2019-06-05 11:41:07 +0000
+++ tests/tracer.py 2019-08-11 12:37:39 +0000
@@ -130,7 +130,7 @@
130130
131 def setUp(self):131 def setUp(self):
132 super(DebugTracerTest, self).setUp()132 super(DebugTracerTest, self).setUp()
133 self.stream = self.mocker.mock(file)133 self.stream = self.mocker.mock(type(sys.stderr))
134 self.tracer = DebugTracer(self.stream)134 self.tracer = DebugTracer(self.stream)
135135
136 datetime_mock = self.mocker.replace("datetime.datetime")136 datetime_mock = self.mocker.replace("datetime.datetime")

Subscribers

People subscribed via source and target branches

to status/vote changes: