Mercurial > p > roundup > code
changeset 613:d77b82588bf0
Fixed the unit tests for the mailgw re: the x-roundup-name header.
Also made the test runner more user-friendly:
./run_tests - detect all tests in test/test_<name>.py and run them
./run_tests <name> - run only test/test_<name>.py
eg ./run_tests mailgw - run the mailgw test from test/test_mailgw.py
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Thu, 14 Feb 2002 23:38:12 +0000 |
| parents | a2aeebf3d6bd |
| children | 5fdf95e6c20a |
| files | run_tests test/__init__.py test/test_mailgw.py |
| diffstat | 3 files changed, 39 insertions(+), 24 deletions(-) [+] |
line wrap: on
line diff
--- a/run_tests Thu Feb 14 22:33:15 2002 +0000 +++ b/run_tests Thu Feb 14 23:38:12 2002 +0000 @@ -9,13 +9,20 @@ # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # -# $Id: run_tests,v 1.3 2002-01-23 20:09:41 jhermann Exp $ +# $Id: run_tests,v 1.4 2002-02-14 23:38:12 richard Exp $ -import test -test.go() +from test import go +import sys +if len(sys.argv) > 1: + go(sys.argv[1:]) +else: + go() # # $Log: not supported by cvs2svn $ +# Revision 1.3 2002/01/23 20:09:41 jhermann +# Proper fix for failing test +# # Revision 1.2 2002/01/23 11:08:52 grubert # . run_tests testReldate_date failed if LANG is 'german' #
--- a/test/__init__.py Thu Feb 14 22:33:15 2002 +0000 +++ b/test/__init__.py Thu Feb 14 23:38:12 2002 +0000 @@ -15,33 +15,33 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: __init__.py,v 1.15 2002-01-22 00:12:20 richard Exp $ +# $Id: __init__.py,v 1.16 2002-02-14 23:38:12 richard Exp $ -import unittest -import os, tempfile +import os, tempfile, unittest, shutil os.environ['SENDMAILDEBUG'] = tempfile.mktemp() -import test_dates, test_schema, test_db, test_multipart, test_mailsplit -import test_init, test_token, test_mailgw, test_htmltemplate +# figure all the modules available +dir = os.path.split(__file__)[0] +test_mods = {} +for file in os.listdir(dir): + if file.startswith('test_') and file.endswith('.py'): + name = file[5:-3] + test_mods[name] = __import__(file[:-3], globals(), locals(), []) +all_tests = test_mods.keys() -def go(): - suite = unittest.TestSuite(( - test_dates.suite(), - test_schema.suite(), - test_db.suite(), - test_init.suite(), - test_multipart.suite(), - test_mailsplit.suite(), - test_mailgw.suite(), - test_token.suite(), - test_htmltemplate.suite(), - )) +def go(tests=all_tests): + l = [] + for name in tests: + l.append(test_mods[name].suite()) + suite = unittest.TestSuite(l) runner = unittest.TextTestRunner() - result = runner.run(suite) - return result.wasSuccessful() + runner.run(suite) # # $Log: not supported by cvs2svn $ +# Revision 1.15 2002/01/22 00:12:20 richard +# oops +# # Revision 1.14 2002/01/22 00:12:06 richard # Wrote more unit tests for htmltemplate, and while I was at it, I polished # off the implementation of some of the functions so they behave sanely.
--- a/test/test_mailgw.py Thu Feb 14 22:33:15 2002 +0000 +++ b/test/test_mailgw.py Thu Feb 14 23:38:12 2002 +0000 @@ -8,7 +8,7 @@ # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # -# $Id: test_mailgw.py,v 1.10 2002-02-12 08:08:55 grubert Exp $ +# $Id: test_mailgw.py,v 1.11 2002-02-14 23:38:12 richard Exp $ import unittest, cStringIO, tempfile, os, shutil, errno, imp, sys @@ -86,6 +86,7 @@ Reply-To: Roundup issue tracker <issue_tracker@fill.me.in.> MIME-Version: 1.0 Message-Id: <dummy_test_message_id> +X-Roundup-Name: Roundup issue tracker New submission from Chef <chef@bork.bork.bork>: @@ -113,7 +114,7 @@ # the ip address of the test machine. # BUG should test some binary attamchent too. - + def testFollowup(self): self.testNewIssue() message = cStringIO.StringIO('''Content-Type: text/plain; @@ -140,6 +141,7 @@ MIME-Version: 1.0 Message-Id: <followup_dummy_id> In-Reply-To: <dummy_test_message_id> +X-Roundup-Name: Roundup issue tracker richard <richard@test> added the comment: @@ -182,6 +184,7 @@ MIME-Version: 1.0 Message-Id: <followup_dummy_id> In-Reply-To: <dummy_test_message_id> +X-Roundup-Name: Roundup issue tracker mary <mary@test> added the comment: @@ -227,6 +230,7 @@ MIME-Version: 1.0 Message-Id: <followup_dummy_id> In-Reply-To: <dummy_test_message_id> +X-Roundup-Name: Roundup issue tracker mary <mary@test> added the comment: @@ -279,6 +283,7 @@ MIME-Version: 1.0 Message-Id: <followup_dummy_id> In-Reply-To: <dummy_test_message_id> +X-Roundup-Name: Roundup issue tracker mary <mary@test> added the comment: @@ -305,6 +310,9 @@ # # $Log: not supported by cvs2svn $ +# Revision 1.10 2002/02/12 08:08:55 grubert +# . Clean up mail handling, multipart handling. +# # Revision 1.9 2002/02/05 14:15:29 grubert # . respect encodings in non multipart messages. #
