mox3 fails for context manager based mock testing

Bug #1396144 reported by Davanum Srinivas (DIMS)
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
python-mox3
New
Undecided
Unassigned

Bug Description

Apparently, we (OpenStack) own mox3 :) as our CI pushed the mox3 release into pypi.

It seems like the code is from Monty's repo:
https://github.com/emonty/pymox

There is no entries for mox3 in git.openstack.org or on launchpad....So i am logging the bug here for now.

Please see attached test case, based on code from here:
http://stackoverflow.com/questions/8905472/python-unit-test-how-to-use-mox-to-mock-the-gzip-with-statement

I stumbled into this one when updating Nova to use mox3:
https://review.openstack.org/#/c/135944/

======================================================================
FAIL: mox3.tests.test_gzip.MockContextManagerTest.test_generate_gzip_file
tags: worker-0
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/dims/openstack/pymox/mox3/tests/test_gzip.py", line 43, in test_generate_gzip_file
    self._generate_gzip_file()
  File "/Users/dims/openstack/pymox/mox3/tests/test_gzip.py", line 30, in _generate_gzip_file
    with gzip.GzipFile('file_name.txt.gz', 'wb') as f:
AttributeError: __exit__
Ran 1 (-185) tests in 0.001s (-0.100s)
FAILED (id=1, failures=1 (-29))
error: testr failed (1)

Revision history for this message
Davanum Srinivas (DIMS) (dims-v) wrote :
affects: openstack-ci → python-mox3
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.