root/imapclient/test/util.py
| Revision 304:239f24fbd17c, 0.6 KB (checked in by Menno Smits <menno@…>, 2 weeks ago) |
|---|
| Line | |
|---|---|
| 1 | # Copyright (c) 2012, Menno Smits |
| 2 | # Released subject to the New BSD License |
| 3 | # Please see http://en.wikipedia.org/wiki/BSD_licenses |
| 4 | |
| 5 | def find_unittest2(): |
| 6 | import unittest |
| 7 | if hasattr(unittest, 'skip') and hasattr(unittest, 'loader'): |
| 8 | return unittest # unittest from stdlib is unittest2, use that |
| 9 | try: |
| 10 | import unittest2 # try for a separately installed unittest2 package |
| 11 | except ImportError: |
| 12 | raise ImportError('unittest2 not installed and unittest in standard library is not unittest2') |
| 13 | else: |
| 14 | return unittest2 |
| 15 | |
| 16 | unittest = find_unittest2() |
Note: See TracBrowser
for help on using the browser.
