~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/lib/test_mode.py

Reverted 1103

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#! /usr/bin/env python
2
 
# -*- mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
3
 
# vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
 
#
5
 
# Copyright (C) 2010 Patrick Crews
6
 
#
7
 
# This program is free software; you can redistribute it and/or modify
8
 
# it under the terms of the GNU General Public License as published by
9
 
# the Free Software Foundation; either version 2 of the License, or
10
 
# (at your option) any later version.
11
 
#
12
 
# This program is distributed in the hope that it will be useful,
13
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 
# GNU General Public License for more details.
16
 
#
17
 
# You should have received a copy of the GNU General Public License
18
 
# along with this program; if not, write to the Free Software
19
 
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
20
 
 
21
 
"""test_mode.py
22
 
   code for dealing with testing modes
23
 
   A given mode should have a systemInitializer, testManager, and testExecutor
24
 
   that define how to setup, manage, and execute test cases
25
 
 
26
 
"""
27
 
 
28
 
# imports
29
 
import sys
30
 
 
31
 
def handle_mode(variables, system_manager):
32
 
    """ Deals with the 'mode' option and returns
33
 
        the appropriate code objects for the test-runner to play with
34
 
 
35
 
    """
36
 
    # drizzle-test-run mode - the default
37
 
    if variables['mode'] == 'dtr':
38
 
        # DTR mode - this is what we are coding to initially
39
 
        # We are just setting the code up this way to hopefully make
40
 
        # other coolness easier in the future
41
 
 
42
 
        system_manager.logging.info("Using testing mode: %s" %variables['mode'])
43
 
 
44
 
        # Set up our testManager
45
 
        from drizzle_test_run.dtr_test_management import testManager
46
 
        test_manager = testManager( variables['verbose'], variables['debug'] 
47
 
                                  , variables['defaultengine'], variables['dotest']
48
 
                                  , variables['skiptest'], variables['reorder']
49
 
                                  , variables['suitelist'], variables['suitepaths']
50
 
                                  , system_manager, variables['test_cases'])
51
 
 
52
 
        # get our mode-specific testExecutor
53
 
        from drizzle_test_run.dtr_test_execution import dtrTestExecutor
54
 
        
55
 
        return (test_manager, dtrTestExecutor)
56
 
 
57
 
    else:
58
 
        system_manager.logging.error("unknown mode argument: %s" %variables['mode'])
59
 
        sys.exit(1)