From: Menno Smits Date: Tue, 25 Jan 2011 17:20:18 +0000 (+0000) Subject: Removed unit test running plumbing X-Git-Tag: 0.7~3^2~2 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=874c3c9b6b3062d1d6e683585ef18adf68b066ff;p=imapclient.git Removed unit test running plumbing People can just use the unit2 script or "python -m unittest". Updated documentation to match. Also fixed up the docs for livetest.py to better match current reality. --- diff --git a/README b/README index 3041ff0..cd5844f 100644 --- a/README +++ b/README @@ -103,13 +103,11 @@ code.interact() function from the standard library is used. 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 @@ -118,15 +116,27 @@ about. 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 diff --git a/imapclient/test/__init__.py b/imapclient/test/__init__.py index 9ffc375..db53cb6 100644 --- a/imapclient/test/__init__.py +++ b/imapclient/test/__init__.py @@ -1,31 +1,3 @@ # 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) - - diff --git a/run_tests.py b/run_tests.py deleted file mode 100644 index 69abb5d..0000000 --- a/run_tests.py +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env python - -# Copyright (c) 2010, Menno Smits -# Released subject to the New BSD License -# Please see http://en.wikipedia.org/wiki/BSD_licenses - -import imapclient.test -imapclient.test.run_suite()