]> khamidou — GitHub mirrors - imapclient.git/commitdiff
Added some guidance on writing unit tests to HACKING.rst
authorMenno Smits <menno@freshfoo.com>
Tue, 30 Jun 2015 02:40:59 +0000 (14:40 +1200)
committerMenno Smits <menno@freshfoo.com>
Tue, 30 Jun 2015 02:40:59 +0000 (14:40 +1200)
Fixes #149.

HACKING.rst

index 78c331cf84cfbde5f48c4f744edec1a28cb63a63..90b2646853d2b7d3576fff42fd7835351cdf6113 100644 (file)
@@ -89,3 +89,12 @@ the unit tests against the Python versions officially supported by
 IMAPClient (provided these versions of Python are installed!).
 
 .. _`tox`: http://testrun.org/tox/
+
+Writing Unit Tests
+==================
+Protocol level unit tests should not act against a real IMAP server
+but should use canned data instead. The IMAPClientTest base class
+should typically be used as the base class for any tests - it provides
+a mock IMAPClient instance at `self.client`. See the tests in
+imapclient/tests/test_imapclient.py for examples of how to write unit
+tests using this approach.