]> khamidou — GitHub mirrors - imapclient.git/commitdiff
tests are now sorted out for use with eggs
authormsmits <none@none>
Tue, 16 Oct 2007 12:43:17 +0000 (12:43 +0000)
committermsmits <none@none>
Tue, 16 Oct 2007 12:43:17 +0000 (12:43 +0000)
IMAPClient/MANIFEST.in
IMAPClient/README
IMAPClient/TODO
IMAPClient/imapclient/test/__init__.py [new file with mode: 0644]
IMAPClient/imapclient/test/test_FetchParser.py
IMAPClient/livetest.py [moved from IMAPClient/imapclient/test/livetest.py with 100% similarity]
IMAPClient/run_tests.py [new file with mode: 0755]
IMAPClient/setup.py

index 9598dd20cb35919e5ee0e83af4c8422d9d324126..429cc388f6dcc4a1e24ffbfc38071b2f8ac57f55 100644 (file)
@@ -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 *
 
index 86d9ef9a18410d1b5539a5dd217c680a398de180..83a6ba98a0e44c708e32189d1af5bfaa58cb9cd1 100644 (file)
@@ -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".
index 4fb23f653ccc5db34c1d5f11c56af6cd8981a320..101f8457858907a8e2061eff7d727471b01f6e38 100644 (file)
@@ -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 (file)
index 0000000..34d30bc
--- /dev/null
@@ -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)
+
+
index 8de1ea0a8f41dcaad2592061a84d26ba72d61041..7db81ea6a7ae77f20cc065310a81731816a3838e 100644 (file)
@@ -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/run_tests.py b/IMAPClient/run_tests.py
new file mode 100755 (executable)
index 0000000..bede5ba
--- /dev/null
@@ -0,0 +1,4 @@
+#!/usr/bin/env python
+
+import imapclient.test
+imapclient.test.run_suite()
index 2d5f26bd468e1f49d931edb6910d33caaa3f75b7..2ff3d9eff8da46d53f5cb61e5bf0f32d87c3ae6f 100644 (file)
@@ -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 "