naftulikay / ansible-role-degoss

An Ansible role for installing, running, and removing Goss from a system without leaving any traces.
Other
42 stars 12 forks source link

Broken tests #45

Closed nicholasamorim closed 5 years ago

nicholasamorim commented 5 years ago

Running the tests on both Py27 and 37 yielded 4 errors on the mocking of library.degoss.open.

I know they are passing in the official build but they failed on both 2.7 and 3.7 for me. Changing the patching to use mock_open made it pass on both versions.

.............E..EEE....
======================================================================
ERROR: test_install (__main__.DegossTestCase)
Tests that degoss can install Goss successfully.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/nicholas/.virtualenvs/otcas27/lib/python2.7/site-packages/mock.py", line 1193, in patched
    arg = patching.__enter__()
  File "/Users/nicholas/.virtualenvs/otcas27/lib/python2.7/site-packages/mock.py", line 1268, in __enter__
    original, local = self.get_original()
  File "/Users/nicholas/.virtualenvs/otcas27/lib/python2.7/site-packages/mock.py", line 1242, in get_original
    "%s does not have the attribute %r" % (target, name)
AttributeError: <module 'library.degoss' from '/Users/nicholas/src/ansible-role-degoss/library/degoss.py'> does not have the attribute 'open'

======================================================================
ERROR: test_run_tests_error (__main__.DegossTestCase)
Tests that degoss can handle error cases when running tests.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/nicholas/.virtualenvs/otcas27/lib/python2.7/site-packages/mock.py", line 1193, in patched
    arg = patching.__enter__()
  File "/Users/nicholas/.virtualenvs/otcas27/lib/python2.7/site-packages/mock.py", line 1268, in __enter__
    original, local = self.get_original()
  File "/Users/nicholas/.virtualenvs/otcas27/lib/python2.7/site-packages/mock.py", line 1242, in get_original
    "%s does not have the attribute %r" % (target, name)
AttributeError: <module 'library.degoss' from '/Users/nicholas/src/ansible-role-degoss/library/degoss.py'> does not have the attribute 'open'

======================================================================
ERROR: test_run_tests_failure (__main__.DegossTestCase)
Tests that degoss can handle failed tests appropriately.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/nicholas/.virtualenvs/otcas27/lib/python2.7/site-packages/mock.py", line 1193, in patched
    arg = patching.__enter__()
  File "/Users/nicholas/.virtualenvs/otcas27/lib/python2.7/site-packages/mock.py", line 1268, in __enter__
    original, local = self.get_original()
  File "/Users/nicholas/.virtualenvs/otcas27/lib/python2.7/site-packages/mock.py", line 1242, in get_original
    "%s does not have the attribute %r" % (target, name)
AttributeError: <module 'library.degoss' from '/Users/nicholas/src/ansible-role-degoss/library/degoss.py'> does not have the attribute 'open'

======================================================================
ERROR: test_run_tests_success (__main__.DegossTestCase)
Tests that degoss can handle successful tests appropriately.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/nicholas/.virtualenvs/otcas27/lib/python2.7/site-packages/mock.py", line 1193, in patched
    arg = patching.__enter__()
  File "/Users/nicholas/.virtualenvs/otcas27/lib/python2.7/site-packages/mock.py", line 1268, in __enter__
    original, local = self.get_original()
  File "/Users/nicholas/.virtualenvs/otcas27/lib/python2.7/site-packages/mock.py", line 1242, in get_original
    "%s does not have the attribute %r" % (target, name)
AttributeError: <module 'library.degoss' from '/Users/nicholas/src/ansible-role-degoss/library/degoss.py'> does not have the attribute 'open'

----------------------------------------------------------------------
Ran 23 tests in 0.036s

FAILED (errors=4)
naftulikay commented 5 years ago

Do you have more context on why it's failing? Looking at the last build log, I don't see any failures. Tests there appear to be passing on Python 3.6. Looking at the PR next.