Changeset 197:4501a1820322

Show
Ignore:
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:
1 removed
2 modified

Legend:

Unmodified
Added
Removed
  • README

    r178 r197  
    104104livetest.py 
    105105----------- 
    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. 
     106This script contains a series of functional tests which exercise 
     107IMAPClient against a live IMAP account. It is useful for ensuring 
     108compatibility with a given IMAP server implementation. livetest.py 
     109must be used with an account that has an INBOX folder and write access 
     110to the account. 
    113111 
    114112WARNING: The operations performed by livetest.py are 
     
    119117Run livetest.py with the --help option to see usage. 
    120118 
    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. 
     119Please send the output of livetest.py to the mailing list if it fails 
     120to run successfully against a particular IMAP server. Reports of 
     121successful runs are also welcome.  Please include the type and version 
     122of the IMAP server. 
    125123 
    126124 
     
    129127There are comprehensive unit tests for the FETCH response parser and a 
    130128growing 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". 
     129unittest2 package which is also included as the standard unittest 
     130package in Python 2.7 and 3.2. 
     131 
     132Where unittest2 is included in the standard library (eg. Python 2.7 
     133and 3.2) you can run all unit tests like this (starting from the root 
     134directory of the IMAPClient source): 
     135 
     136     python -m unittest discover 
     137 
     138Alternatively, if unittest2 is installed separately use the unit2 
     139script (for Unix-like systems) or the unit2.py script: 
     140 
     141     unit2 discover 
     142     unit2.py discover 
  • imapclient/test/__init__.py

    r156 r197  
    22# Released subject to the New BSD License 
    33# 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