comparison test/__init__.py @ 1873:f63aa57386b0

Backend improvements. - using Zope3's test runner now, allowing GC checks, nicer controls and coverage analysis - all RDMBS backends now have indexes on several columns - added testing of schema mutation, fixed rdbms backends handling of a couple of cases - !BETA! added postgresql backend, needs work !BETA!
author Richard Jones <richard@users.sourceforge.net>
date Sat, 25 Oct 2003 22:53:26 +0000
parents c1eec970d5c0
children
comparison
equal deleted inserted replaced
1872:c085b4f4f0c0 1873:f63aa57386b0
1 # 1 # make this dir a package
2 # Copyright (c) 2001 Bizar Software Pty Ltd (http://www.bizarsoftware.com.au/)
3 # This module is free software, and you may redistribute it and/or modify
4 # under the same terms as Python, so long as this copyright message and
5 # disclaimer are retained in their original form.
6 #
7 # IN NO EVENT SHALL BIZAR SOFTWARE PTY LTD BE LIABLE TO ANY PARTY FOR
8 # DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING
9 # OUT OF THE USE OF THIS CODE, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE
10 # POSSIBILITY OF SUCH DAMAGE.
11 #
12 # BIZAR SOFTWARE PTY LTD SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS"
15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
17 #
18 # $Id: __init__.py,v 1.19 2003-09-07 20:37:33 jlgijsbers Exp $
19
20 import os, tempfile, unittest, shutil, errno
21 import roundup.roundupdb
22 roundup.roundupdb.SENDMAILDEBUG=os.environ['SENDMAILDEBUG']=tempfile.mktemp()
23
24 from roundup import init
25
26 # figure all the modules available
27 dir = os.path.split(__file__)[0]
28 test_mods = {}
29 for file in os.listdir(dir):
30 if file.startswith('test_') and file.endswith('.py'):
31 name = file[5:-3]
32 test_mods[name] = __import__(file[:-3], globals(), locals(), [])
33 all_tests = test_mods.keys()
34
35 dirname = '_empty_instance'
36 def create_empty_instance():
37 remove_empty_instance()
38 init.install(dirname, 'templates/classic')
39 init.write_select_db(dirname, 'anydbm')
40 init.initialise(dirname, 'sekrit')
41
42 def remove_empty_instance():
43 try:
44 shutil.rmtree(dirname)
45 except OSError, error:
46 if error.errno not in (errno.ENOENT, errno.ESRCH): raise
47
48 def go(tests=all_tests):
49 try:
50 l = []
51 needs_instance = 0
52 for name in tests:
53 mod = test_mods[name]
54 if hasattr(mod, 'NEEDS_INSTANCE'):
55 needs_instance = 1
56 l.append(test_mods[name].suite())
57
58 if needs_instance:
59 create_empty_instance()
60
61 suite = unittest.TestSuite(l)
62 runner = unittest.TextTestRunner()
63 runner.run(suite)
64 finally:
65 remove_empty_instance()
66
67 # vim: set filetype=python ts=4 sw=4 et si

Roundup Issue Tracker: http://roundup-tracker.org/