mox3 doesn't pass tests with Python 3.4

Bug #1403214 reported by Miro Hrončok
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
heat-cfntools
Fix Released
Medium
Unassigned
python-mox3
Confirmed
High
Doug Hellmann

Bug Description

First of all, sorry for assigning this to heat-cfntools. However, the mox3 module was not listed. In case mox3 has a different issue tracking, let me know, on PyPI, all I get is that it is part of OpenStack project. I've chosen heat-cfntools as it uses mox3 for tests.

https://pypi.python.org/pypi/mox3

There's also a link in CONTRIBUTING.md:

https://bugs.launchpad.net/mox3 - but it is dead.

I'm trying to package mox3 for Fedora. When I run the tests in mox3 0.7.0, I get this exception:

+ PYTHON=/usr/bin/python3
+ /usr/bin/python3 setup.py testr --slowest
running testr
running=OS_STDOUT_CAPTURE=1 OS_STDERR_CAPTURE=1 OS_TEST_TIMEOUT=60 ${PYTHON:-python} -m subunit.run discover -t ./ ./ --list
running=OS_STDOUT_CAPTURE=1 OS_STDERR_CAPTURE=1 OS_TEST_TIMEOUT=60 ${PYTHON:-python} -m subunit.run discover -t ./ ./ --load-list /tmp/tmpbjtco4ow
running=OS_STDOUT_CAPTURE=1 OS_STDERR_CAPTURE=1 OS_TEST_TIMEOUT=60 ${PYTHON:-python} -m subunit.run discover -t ./ ./ --load-list /tmp/tmp2luere5f
running=OS_STDOUT_CAPTURE=1 OS_STDERR_CAPTURE=1 OS_TEST_TIMEOUT=60 ${PYTHON:-python} -m subunit.run discover -t ./ ./ --load-list /tmp/tmpwkeburha
running=OS_STDOUT_CAPTURE=1 OS_STDERR_CAPTURE=1 OS_TEST_TIMEOUT=60 ${PYTHON:-python} -m subunit.run discover -t ./ ./ --load-list /tmp/tmpla8ia91g
======================================================================
FAIL: mox3.tests.test_mox.MoxTest.testStubOutClass_OldStyle
tags: worker-1
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/python3-python-mox3-0.7.0-1.fc22/mox3/tests/test_mox.py", line 1915, in testStubOutClass_OldStyle
    mock_instance.Value().AndReturn('mock instance')
  File "/builddir/build/BUILD/python3-python-mox3-0.7.0-1.fc22/mox3/mox.py", line 1107, in __call__
    self._checker.Check(params, named_params)
  File "/builddir/build/BUILD/python3-python-mox3-0.7.0-1.fc22/mox3/mox.py", line 1029, in Check
    % (' '.join(sorted(still_needed))))
AttributeError: No values given for arguments: self
Expecting a string b'2014-12-16 20:42:25.441886Z'
error: testr failed (3)

description: updated
description: updated
Revision history for this message
Miro Hrončok (churchyard) wrote :

So, this is caused by inspect.ismethod() returning false even on methods.

Revision history for this message
Miro Hrončok (churchyard) wrote :
Revision history for this message
Miro Hrončok (churchyard) wrote :

I've managed to get this somehow working by:

1. adding `or self._args[0] == 'self'` to the problematic condition (hackish)
2. disabling testUnboundMethodsRequiresInstance test (don't know how it works and what exactly is the problem here)

I guess this needs a proper fix, but I have no idea how to do such thing, apparently, it is impossible in Python >= 3.3 :D

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to heat-cfntools (master)

Related fix proposed to branch: master
Review: https://review.openstack.org/157558

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to heat-cfntools (master)

Reviewed: https://review.openstack.org/157558
Committed: https://git.openstack.org/cgit/openstack/heat-cfntools/commit/?id=57f8ae8997d614c5eebe65987e9a6e0b1e691510
Submitter: Jenkins
Branch: master

commit 57f8ae8997d614c5eebe65987e9a6e0b1e691510
Author: Miro Hrončok <email address hidden>
Date: Thu Feb 19 20:02:51 2015 +0100

    Ported tests from mox3 to mock to support Python >= 3.3

    Change-Id: I55579328adc7003f78e78161aa6e047524a5c805
    Related-Bug: 1403214

Revision history for this message
Miro Hrončok (churchyard) wrote :

heat-cfntools no longer uses mox3

Changed in heat-cfntools:
status: New → Fix Committed
Alan Pevec (apevec)
affects: heat-cfntools → openstack-ci
affects: openstack-ci → heat-cfntools
Revision history for this message
Alan Pevec (apevec) wrote :

So where is mox3 source repository??
mox3-0.7.0.tar.gz was uploaded on 2013-08-15 and owner is openstackci but I don't see it in https://git.openstack.org/cgit/openstack-infra/project-config/tree/gerrit/projects.yaml

Revision history for this message
Miro Hrončok (churchyard) wrote :

Exactly the problem.

Revision history for this message
Alan Pevec (apevec) wrote :

Hopefully oslotest team will know more about mox3 whereabouts...

Revision history for this message
Alan Pevec (apevec) wrote :

BTW Keystone test-requirements has this comment:

# mox was removed in favor of mock. We should not re-enable this module. See
# discussion: http://lists.openstack.org/pipermail/openstack-dev/2013-July/012484.html

What's the status of this migration to mock? If done, could oslottest just drop moxstubout ?

Changed in heat-cfntools:
importance: Undecided → Medium
milestone: none → v1.3.0
Changed in heat-cfntools:
status: Fix Committed → Fix Released
Revision history for this message
Doug Hellmann (doug-hellmann) wrote :
Changed in python-mox3:
assignee: nobody → Doug Hellmann (doug-hellmann)
importance: Undecided → High
status: New → In Progress
no longer affects: oslotest
Changed in python-mox3:
status: In Progress → Fix Committed
Revision history for this message
Alan Pevec (apevec) wrote :

This was only worked around in https://review.openstack.org/190718

> 3. Skip a test that is failing for 3.4 until we have more time to debug.

Changed in python-mox3:
status: Fix Committed → Confirmed
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.