Merge lp:~cjwatson/meliae/py3-test-intern-from-cache into lp:meliae

Proposed by Colin Watson
Status: Merged
Approved by: John A Meinel
Approved revision: 223
Merged at revision: 223
Proposed branch: lp:~cjwatson/meliae/py3-test-intern-from-cache
Merge into: lp:meliae
Diff against target: 27 lines (+10/-3)
1 file modified
meliae/tests/test__loader.py (+10/-3)
To merge this branch: bzr merge lp:~cjwatson/meliae/py3-test-intern-from-cache
Reviewer Review Type Date Requested Status
John A Meinel Approve
Review via email: mp+380587@code.launchpad.net

Commit message

Cope with constant folding improvements in Python >= 3.7.

Description of the change

Test_MemObjectProxy.test__intern_from_cache assumed that Python wouldn't notice certain opportunities for constant folding, but as of Python 3.7 this assumption no longer holds. Adjust the test slightly to cope with this.

To post a comment you must log in.
Revision history for this message
Colin Watson (cjwatson) wrote :

You'll probably be relieved to hear that, as of this merge proposal, https://code.launchpad.net/~cjwatson/meliae/+activereviews covers all the remaining substantive changes required for a Python 3 port. The only remaining pieces after that are trivial metadata changes, which I'll propose after everything else has landed.

Revision history for this message
John A Meinel (jameinel) wrote :

Thanks

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'meliae/tests/test__loader.py'
--- meliae/tests/test__loader.py 2020-01-30 13:04:35 +0000
+++ meliae/tests/test__loader.py 2020-03-11 20:56:26 +0000
@@ -339,13 +339,20 @@
339 t = cache['my type']339 t = cache['my type']
340 self.assertTrue(mop.type_str is t)340 self.assertTrue(mop.type_str is t)
341 del self.moc[addr]341 del self.moc[addr]
342 mop = self.moc.add(1234566+1, 'my ' + ' ty' + 'pe', 256)342 # We have to work a bit here to defeat the more aggressive constant
343 # folding in Python >= 3.7.
344 addr1234566 = 1234566
345 type_str = 'my ty'
346 type_str += 'pe'
347 mop = self.moc.add(addr1234566+1, type_str, 256)
343 addr876543 = 876543348 addr876543 = 876543
344 cache[addr876543] = addr876543349 cache[addr876543] = addr876543
345 addr654321 = 654321350 addr654321 = 654321
346 cache[addr654321] = addr654321351 cache[addr654321] = addr654321
347 mop.children = [876542+1, 654320+1]352 addr876542 = 876542
348 mop.parents = [876542+1, 654320+1]353 addr654320 = 654320
354 mop.children = [addr876542+1, addr654320+1]
355 mop.parents = [addr876542+1, addr654320+1]
349 self.assertFalse(mop.address is addr)356 self.assertFalse(mop.address is addr)
350 self.assertFalse(mop.type_str is t)357 self.assertFalse(mop.type_str is t)
351 rl = mop.children358 rl = mop.children

Subscribers

People subscribed via source and target branches

to all changes: