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
1=== modified file 'meliae/tests/test__loader.py'
2--- meliae/tests/test__loader.py 2020-01-30 13:04:35 +0000
3+++ meliae/tests/test__loader.py 2020-03-11 20:56:26 +0000
4@@ -339,13 +339,20 @@
5 t = cache['my type']
6 self.assertTrue(mop.type_str is t)
7 del self.moc[addr]
8- mop = self.moc.add(1234566+1, 'my ' + ' ty' + 'pe', 256)
9+ # We have to work a bit here to defeat the more aggressive constant
10+ # folding in Python >= 3.7.
11+ addr1234566 = 1234566
12+ type_str = 'my ty'
13+ type_str += 'pe'
14+ mop = self.moc.add(addr1234566+1, type_str, 256)
15 addr876543 = 876543
16 cache[addr876543] = addr876543
17 addr654321 = 654321
18 cache[addr654321] = addr654321
19- mop.children = [876542+1, 654320+1]
20- mop.parents = [876542+1, 654320+1]
21+ addr876542 = 876542
22+ addr654320 = 654320
23+ mop.children = [addr876542+1, addr654320+1]
24+ mop.parents = [addr876542+1, addr654320+1]
25 self.assertFalse(mop.address is addr)
26 self.assertFalse(mop.type_str is t)
27 rl = mop.children

Subscribers

People subscribed via source and target branches

to all changes: