[TIP] using coverage with unittest and mock with python 3.6.7

Joe Holder joe.holder at gmail.com
Tue Apr 9 03:25:29 PDT 2019


Hi,

I have some test classes that run unittests and have use mock patch object
- I can run them ok from the command line - but when I run them via
coverage I get

import unittest.mock
ImportError: No module named mock

I am running the test class file which has a unittest.main in it.

I am running it from one directory up from the source (the source is in a
subdir called 'docker')

so
'python docker/test_svn_checker_writer.py '

runs the tests ok

but
'coverage run docker/test_svn_checker_writer.py' - fails with the import
error.  This is on ubunto btw.

Can anyone help?

Thanks

Joe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20190409/5a43c734/attachment.htm>


More information about the testing-in-python mailing list