Nick Coghlan added the comment:

I'll start with a bit of philosophical guidance :)

1. As much as possible, push logic testing down into the non-GUI tests. Where 
unittest.mock can help here is when you have a piece of code to test that is 
*almost* independent of the GUI, but needs to call an API to either get input 
from the user or to send something to the screen. unittest.mock can then be set 
up to intercept that call, either to check that it happened as expected 
(display operations) or to provide a predetermined answer (input operations).

2. For the GUI tests, unittest.mock is likely to be most useful in providing 
predetermined input. There's only so much you can do with this, it's ultimately 
about ensuring that the code tested against mocked out APIs in the lower level 
tests at least doesn't throw exceptions when tested against the real APIs. 
Proper GUI testing is actually a much harder test automation problem, so it 
probably makes sense to focus on the non-GUI tests for now.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue15392>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to