Changeset 197:4501a1820322
- Timestamp:
- 01/25/11 17:20:18 (16 months ago)
- Author:
- Menno Smits <menno@…>
- Branch:
- default
- Message:
-
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.
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r178
|
r197
|
|
| 104 | 104 | livetest.py |
| 105 | 105 | ----------- |
| 106 | | This is a standalone Python script which exercises IMAPClient against |
| 107 | | a live IMAP account. It performs operations and then attempts to |
| 108 | | confirm that these have been successful. |
| 109 | | |
| 110 | | It must be used with an account that has an INBOX folder and write |
| 111 | | access to the account. The folders and contents of the account don't |
| 112 | | matter. |
| | 106 | This script contains a series of functional tests which exercise |
| | 107 | IMAPClient against a live IMAP account. It is useful for ensuring |
| | 108 | compatibility with a given IMAP server implementation. livetest.py |
| | 109 | must be used with an account that has an INBOX folder and write access |
| | 110 | to the account. |
| 113 | 111 | |
| 114 | 112 | WARNING: The operations performed by livetest.py are |
| … |
… |
|
| 119 | 117 | Run livetest.py with the --help option to see usage. |
| 120 | 118 | |
| 121 | | Please send me the output of livetest.py if it fails to run |
| 122 | | successfully against a particular IMAP server. Reports of successful |
| 123 | | runs are also welcome. Please include the type and version of the |
| 124 | | IMAP server. |
| | 119 | Please send the output of livetest.py to the mailing list if it fails |
| | 120 | to run successfully against a particular IMAP server. Reports of |
| | 121 | successful runs are also welcome. Please include the type and version |
| | 122 | of the IMAP server. |
| 125 | 123 | |
| 126 | 124 | |
| … |
… |
|
| 129 | 127 | There are comprehensive unit tests for the FETCH response parser and a |
| 130 | 128 | growing number of other parts of the code. These tests use the |
| 131 | | unittest package from the standard library and can be run using |
| 132 | | "python run_tests.py". |
| | 129 | unittest2 package which is also included as the standard unittest |
| | 130 | package in Python 2.7 and 3.2. |
| | 131 | |
| | 132 | Where unittest2 is included in the standard library (eg. Python 2.7 |
| | 133 | and 3.2) you can run all unit tests like this (starting from the root |
| | 134 | directory of the IMAPClient source): |
| | 135 | |
| | 136 | python -m unittest discover |
| | 137 | |
| | 138 | Alternatively, if unittest2 is installed separately use the unit2 |
| | 139 | script (for Unix-like systems) or the unit2.py script: |
| | 140 | |
| | 141 | unit2 discover |
| | 142 | unit2.py discover |
-
|
r156
|
r197
|
|
| 2 | 2 | # Released subject to the New BSD License |
| 3 | 3 | # Please see http://en.wikipedia.org/wiki/BSD_licenses |
| 4 | | |
| 5 | | import sys |
| 6 | | import glob |
| 7 | | import imp |
| 8 | | import unittest |
| 9 | | from os.path import abspath, dirname, basename, join as joinpath |
| 10 | | |
| 11 | | _mydir = abspath(joinpath(dirname(__file__))) |
| 12 | | |
| 13 | | # Make sure that imapclient is imported from the right place |
| 14 | | _import_dir = abspath(joinpath(_mydir, '..', '..')) |
| 15 | | sys.path.insert(0, _import_dir) |
| 16 | | |
| 17 | | def load_suite(): |
| 18 | | full_suite = unittest.TestSuite() |
| 19 | | for modpath in glob.glob(joinpath(_mydir, 'test_*.py')): |
| 20 | | module_name = basename(modpath).split('.', 1)[0] |
| 21 | | module = imp.load_source(module_name, modpath) |
| 22 | | suite = unittest.defaultTestLoader.loadTestsFromModule(module) |
| 23 | | full_suite.addTest(suite) |
| 24 | | return full_suite |
| 25 | | |
| 26 | | def run_suite(): |
| 27 | | suite = load_suite() |
| 28 | | runner = unittest.TextTestRunner(verbosity=1) |
| 29 | | runner.run(suite) |
| 30 | | |
| 31 | | |