livetest.py
-----------
-This is a standalone Python script which exercises IMAPClient against
-a live IMAP account. It performs operations and then attempts to
-confirm that these have been successful.
-
-It must be used with an account that has an INBOX folder and write
-access to the account. The folders and contents of the account don't
-matter.
+This script contains a series of functional tests which exercise
+IMAPClient against a live IMAP account. It is useful for ensuring
+compatibility with a given IMAP server implementation. livetest.py
+must be used with an account that has an INBOX folder and write access
+to the account.
WARNING: The operations performed by livetest.py are
destructive. Emails and folders in the test account WILL BE
Run livetest.py with the --help option to see usage.
-Please send me the output of livetest.py if it fails to run
-successfully against a particular IMAP server. Reports of successful
-runs are also welcome. Please include the type and version of the
-IMAP server.
+Please send the output of livetest.py to the mailing list if it fails
+to run successfully against a particular IMAP server. Reports of
+successful runs are also welcome. Please include the type and version
+of the IMAP server.
Unit Tests
----------
There are comprehensive unit tests for the FETCH response parser and a
growing number of other parts of the code. These tests use the
-unittest package from the standard library and can be run using
-"python run_tests.py".
+unittest2 package which is also included as the standard unittest
+package in Python 2.7 and 3.2.
+
+Where unittest2 is included in the standard library (eg. Python 2.7
+and 3.2) you can run all unit tests like this (starting from the root
+directory of the IMAPClient source):
+
+ python -m unittest discover
+
+Alternatively, if unittest2 is installed separately use the unit2
+script (for Unix-like systems) or the unit2.py script:
+
+ unit2 discover
+ unit2.py discover
# Copyright (c) 2010, Menno Smits
# Released subject to the New BSD License
# Please see http://en.wikipedia.org/wiki/BSD_licenses
-
-import sys
-import glob
-import imp
-import unittest
-from os.path import abspath, dirname, basename, join as joinpath
-
-_mydir = abspath(joinpath(dirname(__file__)))
-
-# Make sure that imapclient is imported from the right place
-_import_dir = abspath(joinpath(_mydir, '..', '..'))
-sys.path.insert(0, _import_dir)
-
-def load_suite():
- full_suite = unittest.TestSuite()
- for modpath in glob.glob(joinpath(_mydir, 'test_*.py')):
- module_name = basename(modpath).split('.', 1)[0]
- module = imp.load_source(module_name, modpath)
- suite = unittest.defaultTestLoader.loadTestsFromModule(module)
- full_suite.addTest(suite)
- return full_suite
-
-def run_suite():
- suite = load_suite()
- runner = unittest.TextTestRunner(verbosity=1)
- runner.run(suite)
-
-