From: msmits Date: Tue, 16 Oct 2007 12:43:17 +0000 (+0000) Subject: tests are now sorted out for use with eggs X-Git-Tag: 0.7~118 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=6e3ac9f708924238711735adbc959f1b263e4285;p=imapclient.git tests are now sorted out for use with eggs --- diff --git a/IMAPClient/MANIFEST.in b/IMAPClient/MANIFEST.in index 9598dd2..429cc38 100644 --- a/IMAPClient/MANIFEST.in +++ b/IMAPClient/MANIFEST.in @@ -1,7 +1,7 @@ -include README COPYING AUTHORS THANKS example.py +include README COPYING AUTHORS THANKS include run_tests.py +include livetest.py include ez_setup.py include make_release.py -recursive-include doc * recursive-include examples * diff --git a/IMAPClient/README b/IMAPClient/README index 86d9ef9..83a6ba9 100644 --- a/IMAPClient/README +++ b/IMAPClient/README @@ -44,7 +44,7 @@ XXX Install the single source file (imapclient.py) in your Python site-packages directory or where it makes sense for your application. -See example.py for a simple example of how to use IMAPClient. +See examples/example.py for a simple example of how to use IMAPClient. The code is well documented. See the docstrings for more usage information. @@ -71,4 +71,4 @@ Unit Tests ---------- There are fairly comprehensive unit tests for the FETCH response parser and related code in test_FetchParser.py. These tests use unittest and can be run -using "python test_FetchParser.py". +using "python setup.py test" or "python run_tests.py". diff --git a/IMAPClient/TODO b/IMAPClient/TODO index 4fb23f6..101f845 100644 --- a/IMAPClient/TODO +++ b/IMAPClient/TODO @@ -1,9 +1,7 @@ -- package as an egg +- fix MANIFEST +- update install instructions in README +- update testing instructions - rename to IMAPClient(et), be consistent in the docs, update cheeseshop - - script to run tests - - include test_suite - - update install instructions in README - - update testing instructions - automatic changelog generation - support for more IMAP functions: sort, examine etc - write a comparision of imaplib vs imapclient.py diff --git a/IMAPClient/imapclient/test/__init__.py b/IMAPClient/imapclient/test/__init__.py new file mode 100644 index 0000000..34d30bc --- /dev/null +++ b/IMAPClient/imapclient/test/__init__.py @@ -0,0 +1,27 @@ +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/IMAPClient/imapclient/test/test_FetchParser.py b/IMAPClient/imapclient/test/test_FetchParser.py index 8de1ea0..7db81ea 100644 --- a/IMAPClient/imapclient/test/test_FetchParser.py +++ b/IMAPClient/imapclient/test/test_FetchParser.py @@ -20,7 +20,7 @@ Unit tests for the FetchTokeniser and FetchParser classes import unittest import datetime -from imapclient import FetchParser, FetchTokeniser, Literal +from imapclient.imapclient import FetchParser, FetchTokeniser, Literal from pprint import pformat #TODO: test timezone handling diff --git a/IMAPClient/imapclient/test/livetest.py b/IMAPClient/livetest.py similarity index 100% rename from IMAPClient/imapclient/test/livetest.py rename to IMAPClient/livetest.py diff --git a/IMAPClient/run_tests.py b/IMAPClient/run_tests.py new file mode 100755 index 0000000..bede5ba --- /dev/null +++ b/IMAPClient/run_tests.py @@ -0,0 +1,4 @@ +#!/usr/bin/env python + +import imapclient.test +imapclient.test.run_suite() diff --git a/IMAPClient/setup.py b/IMAPClient/setup.py index 2d5f26b..2ff3d9e 100644 --- a/IMAPClient/setup.py +++ b/IMAPClient/setup.py @@ -30,6 +30,7 @@ setup( url="http://freshfoo.com/wiki/CodeIndex", download_url='http://freshfoo.com/projects/imapclient/IMAPClient-%s.tar.gz' % version, packages=['imapclient', 'imapclient.test'], + test_suite='imapclient.test.load_suite', py_modules=[], install_requires=[], description="Easy-to-use, Pythonic and complete IMAP client library with "