Fix Python3 unitests/syntax checker

Bug #1647337 reported by Lucas Alvares Gomes
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
VirtualBMC
Fix Released
Low
Lucas Alvares Gomes

Bug Description

If you run "tox -epep8" when Python3 is your default interpreter you will get:

$ tox -epep8
...
pep8 runtests: PYTHONHASHSEED='25646210'
pep8 runtests: commands[0] | flake8
./virtualbmc/tests/unit/test_manager.py:89:33: F821 undefined name 'file'
./virtualbmc/tests/unit/test_manager.py:215:33: F821 undefined name 'file'
./virtualbmc/tests/unit/test_manager.py:237:33: F821 undefined name 'file'

Similarly, when running "tox -epy35" you will get:

virtualbmc.tests.unit.test_manager.VirtualBMCManagerTestCase.test_stop_pid_file_not_found
-----------------------------------------------------------------------------------------

Captured traceback:
~~~~~~~~~~~~~~~~~~~
    b'Traceback (most recent call last):'
    b' File "/home/lucas/Projects/virtualbmc/virtualbmc/manager.py", line 184, in stop'
    b" with open(pidfile_path, 'r') as f:"
    b' File "/home/lucas/Projects/virtualbmc/.tox/py35/lib/python3.5/site-packages/mock/mock.py", line 1062, in __call__'
    b' return _mock_self._mock_call(*args, **kwargs)'
    b' File "/home/lucas/Projects/virtualbmc/.tox/py35/lib/python3.5/site-packages/mock/mock.py", line 1118, in _mock_call'
    b' raise effect'
    b'OSError: boom'
    b''
    b'During handling of the above exception, another exception occurred:'
    b''
    b'Traceback (most recent call last):'
    b' File "/home/lucas/Projects/virtualbmc/.tox/py35/lib/python3.5/site-packages/mock/mock.py", line 1305, in patched'
    b' return func(*args, **keywargs)'
    b' File "/home/lucas/Projects/virtualbmc/virtualbmc/tests/unit/test_manager.py", line 242, in test_stop_pid_file_not_found'
    b' self.manager.stop, self.domain_name0)'
    b' File "/home/lucas/Projects/virtualbmc/.tox/py35/lib/python3.5/site-packages/testtools/testcase.py", line 485, in assertRaises'
    b' self.assertThat(our_callable, matcher)'
    b' File "/home/lucas/Projects/virtualbmc/.tox/py35/lib/python3.5/site-packages/testtools/testcase.py", line 496, in assertThat'
    b' mismatch_error = self._matchHelper(matchee, matcher, message, verbose)'
    b' File "/home/lucas/Projects/virtualbmc/.tox/py35/lib/python3.5/site-packages/testtools/testcase.py", line 547, in _matchHelper'
    b' mismatch = matcher.match(matchee)'
    b' File "/home/lucas/Projects/virtualbmc/.tox/py35/lib/python3.5/site-packages/testtools/matchers/_exception.py", line 108, in match'
    b' mismatch = self.exception_matcher.match(exc_info)'
    b' File "/home/lucas/Projects/virtualbmc/.tox/py35/lib/python3.5/site-packages/testtools/matchers/_higherorder.py", line 62, in match'
    b' mismatch = matcher.match(matchee)'
    b' File "/home/lucas/Projects/virtualbmc/.tox/py35/lib/python3.5/site-packages/testtools/testcase.py", line 475, in match'
    b' reraise(*matchee)'
    b' File "/home/lucas/Projects/virtualbmc/.tox/py35/lib/python3.5/site-packages/testtools/_compat3x.py", line 16, in reraise'
    b' raise exc_obj.with_traceback(exc_tb)'
    b' File "/home/lucas/Projects/virtualbmc/.tox/py35/lib/python3.5/site-packages/testtools/matchers/_exception.py", line 101, in match'
    b' result = matchee()'
    b' File "/home/lucas/Projects/virtualbmc/.tox/py35/lib/python3.5/site-packages/testtools/testcase.py", line 1049, in __call__'
    b' return self._callable_object(*self._args, **self._kwargs)'
    b' File "/home/lucas/Projects/virtualbmc/virtualbmc/manager.py", line 189, in stop'
    b" 'found' % domain_name)"
    b' File "/home/lucas/Projects/virtualbmc/virtualbmc/exception.py", line 17, in __init__'
    b' if self.message and kwargs:'
    b"AttributeError: 'VirtualBMCError' object has no attribute 'message'"

Changed in virtualbmc:
assignee: nobody → Lucas Alvares Gomes (lucasagomes)
importance: Undecided → Low
summary: - PEP8 fails for Python 3
+ Fix Python3 unitests/syntax checker
description: updated
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/virtualbmc 1.0.0

This issue was fixed in the openstack/virtualbmc 1.0.0 release.

Changed in virtualbmc:
status: New → Fix Committed
status: Fix Committed → Fix Released
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.