py35: TestCheckForMutableDefaultArgs fails

Bug #1603236 reported by Eric Brown
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Identity (keystone)
Fix Released
High
Eric Brown

Bug Description

The py35 gate fails on TestCheckForMutableDefaultArgs.

http://logs.openstack.org/52/337952/7/check/gate-keystone-python35-db-nv/2e9682b/testr_results.html.gz

ft125.1: keystone.tests.unit.test_hacking_checks.TestCheckForMutableDefaultArgs.test_StringException: Traceback (most recent call last):
  File "/home/jenkins/workspace/gate-keystone-python35-db-nv/keystone/tests/unit/test_hacking_checks.py", line 64, in test
    self.assert_has_errors(code, expected_errors=errors)
  File "/home/jenkins/workspace/gate-keystone-python35-db-nv/keystone/tests/unit/test_hacking_checks.py", line 53, in assert_has_errors
    self.assertItemsEqual(expected_errors or [], actual_errors)
  File "/home/jenkins/workspace/gate-keystone-python35-db-nv/.tox/py35/lib/python3.5/site-packages/unittest2/case.py", line 1182, in assertItemsEqual
    return self.assertSequenceEqual(expected, actual, msg=msg)
  File "/home/jenkins/workspace/gate-keystone-python35-db-nv/.tox/py35/lib/python3.5/site-packages/unittest2/case.py", line 1014, in assertSequenceEqual
    self.fail(msg)
  File "/home/jenkins/workspace/gate-keystone-python35-db-nv/.tox/py35/lib/python3.5/site-packages/unittest2/case.py", line 690, in fail
    raise self.failureException(msg)
AssertionError: Sequences differ: [(7, [201 chars] 'K001'), (28, 27, 'K001'), (29, 21, 'K001'), (32, 11, 'K001')] != [(7, [201 chars] 'K001'), (28, 26, 'K001'), (29, 21, 'K001'), (32, 10, 'K001')]

First differing element 12:
(28, 27, 'K001')
(28, 26, 'K001')
  [(7, 10, 'K001'),
   (10, 15, 'K001'),
   (10, 29, 'K001'),
   (13, 15, 'K001'),
   (16, 15, 'K001'),
   (16, 31, 'K001'),
   (22, 14, 'K001'),
   (22, 31, 'K001'),
   (22, 53, 'K001'),
   (25, 14, 'K001'),
   (25, 36, 'K001'),
   (28, 10, 'K001'),
- (28, 27, 'K001'),
? ^
+ (28, 26, 'K001'),
? ^
   (29, 21, 'K001'),
- (32, 11, 'K001')]
? ^
+ (32, 10, 'K001')]
? ^

The root cause is a difference the in the ast node col_offset value. Python 3.4 and earlier were incorrect whereas 3.5 is fixed. It only affected two of the function definitions in the code sample.

Here is a sample piece of code that illustrates the difference in the ast module between Pythong 3.5 and earlier versions:

http://paste.openstack.org/show/532929/

Changed in keystone:
assignee: nobody → Eric Brown (ericwb)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to keystone (master)

Reviewed: https://review.openstack.org/337952
Committed: https://git.openstack.org/cgit/openstack/keystone/commit/?id=05b5dfe144958b70331a84118440d6bb0e2863e2
Submitter: Jenkins
Branch: master

commit 05b5dfe144958b70331a84118440d6bb0e2863e2
Author: Eric Brown <email address hidden>
Date: Tue Jul 5 18:53:52 2016 -0700

    Handle Py35 fix of ast.node.col_offset bug

    In 3.5, the ast module returns the correct value for the col_offset
    of a function definition whereas earlier versions did not. The value
    is off by one column.

    Closes-Bug: #1603236

    Change-Id: I7835d7ed8d652a6bd585e8e0372fab402424038d

Changed in keystone:
status: In Progress → Fix Released
Revision history for this message
Thierry Carrez (ttx) wrote : Fix included in openstack/keystone 10.0.0.0b3

This issue was fixed in the openstack/keystone 10.0.0.0b3 development milestone.

Changed in keystone:
importance: Undecided → High
milestone: none → newton-3
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.