Closed GuillaumeSeren closed 4 years ago
As far as I understand, pytest is a third party module and setuptools (and by extension, alot) uses the unittest module for tests.
So, python3.7 setup.py test
is the correct way to run our test suite and pytest
is not.
Perhaps pytest has some conflict with the mock library unittest.mock
?
In any case, I cannot reproduce this on my machine (python 3.8.2) nor does this happen on Travis, even for python 3.7 as far as I can see. So I'm not sure how to help you here..
Hey @pazz thank you for the reply.
As far as I understand, pytest is a third party module and setuptools (and by extension, alot) uses the unittest module for tests.
Yes my explanation was a bit confuse, but I used unittest in the package, and got this issue, in my package building env, like
FAIL: test_no_spawn_no_stdin_attached (tests.commands.test_global.TestExternalCommand)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/var/tmp/portage/mail-client/alot-0.9.1/work/alot-0.9.1/tests/utilities.py", line 189, in _actual
return loop.run_until_complete(coro(*args, **kwargs))
File "/usr/lib/python3.7/asyncio/base_events.py", line 587, in run_until_complete
return future.result()
File "/var/tmp/portage/mail-client/alot-0.9.1/work/alot-0.9.1/tests/commands/test_global.py", line 129, in test_no_spawn_no_stdin_attached
ui.notify.assert_not_called()
File "/usr/lib/python3.7/unittest/mock.py", line 840, in assert_not_called
raise AssertionError(msg)
AssertionError: Expected 'notify' to not have been called. Called 1 times.
----------------------------------------------------------------------
Ran 345 tests in 10.530s
FAILED (failures=1, expected failures=9
While testing in the userspace I discovered a that I can reproduce the issue on test_no_spawn_no_stdin_attached
from the package building env.
_______________________________________________________________ TestExternalCommand.test_no_spawn_no_stdin_attached _______________________________________________________________
self = <tests.commands.test_global.TestExternalCommand testMethod=test_no_spawn_no_stdin_attached>
@utilities.async_test
async def test_no_spawn_no_stdin_attached(self):
ui = utilities.make_ui()
cmd = g_commands.ExternalCommand('test -t 0', refocus=False)
await cmd.apply(ui)
> ui.notify.assert_not_called()
tests/commands/test_global.py:129:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_mock_self = <Mock name='mock.notify' id='140589940215696'>
def assert_not_called(_mock_self):
"""assert that the mock was never called.
"""
self = _mock_self
if self.call_count != 0:
msg = ("Expected '%s' to not have been called. Called %s times." %
(self._mock_name or 'mock', self.call_count))
> raise AssertionError(msg)
E AssertionError: Expected 'notify' to not have been called. Called 1 times.
/usr/lib/python3.7/unittest/mock.py:840: AssertionError
Running the testsuite, 'setup.py test' works whithout errors.
Maybe there is some permission mechanism similar in pytest and the package building env, I am investigating and will report here.
After investingating a bit more, I think the origin is the sandbox mechanism in the test phase, so I am keeping this test disabled for now.
Hello, Thank you for alot, my favorite MUA :rocket:
The issue append when I run the test-suite (in the gentoo package), here the error log:
The issue append on 0.9 / 0.9.1 / and master.
Software Versions
To Reproduce The issue append also in userspace, when running pytest, see
But userspace works with the following:
It is the only test failing, maybe it is one the dependencies: