run.py :  » Database » Modeling-Framework » Modeling-0.9 » Modeling » tests » Python Open Source

Home
Python Open Source
1.3.1.2 Python
2.Ajax
3.Aspect Oriented
4.Blog
5.Build
6.Business Application
7.Chart Report
8.Content Management Systems
9.Cryptographic
10.Database
11.Development
12.Editor
13.Email
14.ERP
15.Game 2D 3D
16.GIS
17.GUI
18.IDE
19.Installer
20.IRC
21.Issue Tracker
22.Language Interface
23.Log
24.Math
25.Media Sound Audio
26.Mobile
27.Network
28.Parser
29.PDF
30.Project Management
31.RSS
32.Search
33.Security
34.Template Engines
35.Test
36.UML
37.USB Serial
38.Web Frameworks
39.Web Server
40.Web Services
41.Web Unit
42.Wiki
43.Windows
44.XML
Python Open Source » Database » Modeling Framework 
Modeling Framework » Modeling 0.9 » Modeling » tests » run.py
#!/usr/bin/env python
# -*- coding: iso-8859-1 -*-
#-----------------------------------------------------------------------------
# Modeling Framework: an Object-Relational Bridge for python
#
# Copyright (c) 2001-2004 Sbastien Bigaret <sbigaret@users.sourceforge.net>
# All rights reserved.
#
# This file is part of the Modeling Framework.
#
# This code is distributed under a "3-clause BSD"-style license;
# see the LICENSE file for details.
#-----------------------------------------------------------------------------


"""Run all tests."""
__version__='$Revision: 950 $'[11:-2]
import sys, getopt
import utils
import unittest

if __name__ == "__main__":
  utils.disable_model_cache() # test_EntityClassDescription requires it
  if '-c' in sys.argv or '-C' in sys.argv \
     or '-m' in sys.argv or '-M' in sys.argv:
    utils.fixpath(include_testPackages=0)
    utils.dynamically_build_test_packages(sys.argv)
  else:
    utils.fixpath(include_testPackages=1)

 
# 
import test_delegation
# Modeling Layer
import test_Model
import test_Attribute
import test_Entity
import test_Relationship
import test_ImportExport
import test_PyModel
# Control Layer
import test_GlobalID # before EditingContext
import test_KeyValueCoding
import test_RelationshipManipulation  # Needs KeyValueC.
import test_Validation
import test_Qualifier
import test_FetchSpecification
import test_SortOrderings
import test_ObserverCenter
import test_EntityClassDescription
import test_EditingContext # srement  deplacer vers le bas (ou alors split)
import test_DatabaseContext

# Ordre de mise en place?
# Access Layer
import test_FaultHandler
import test_Adaptor
import test_SQLExpression
import test_SchemaGeneration

import test_dynamic

def usage(prgName, exitStatus=None):
  _usage="""%s [-v] [-V]
Runs the tests for the Modeling package

Options
--------
  -v  Minimally verbose
  -V  Really verbose
  -g  run the so-called 'global' tests as well -- they are called 'global'
       because they need the whole framework (including the
       PostgresqlAdaptorLayer and a postgresql DB) to be functional.
  -p  profile
  -h  Prints this message
""" % prgName
  if exitStatus is not None:
    print _usage
    sys.exit(exitStatus)
  else:
    return _usage

def test_suite():
  suite=unittest.TestSuite()
  if global_tests: # should be the first one, or this is pretty useless
    import test_CooperatingObjectStoreNeededNotification
    suite.addTest(test_CooperatingObjectStoreNeededNotification.test_suite())
  suite.addTest(test_delegation.test_suite())
  suite.addTest(test_Model.test_suite())
  suite.addTest(test_Entity.test_suite())
  suite.addTest(test_Attribute.test_suite())
  suite.addTest(test_Relationship.test_suite())
  suite.addTest(test_ImportExport.test_suite())
  suite.addTest(test_PyModel.test_suite())
  suite.addTest(test_GlobalID.test_suite())
  suite.addTest(test_KeyValueCoding.test_suite())
  suite.addTest(test_RelationshipManipulation.test_suite()) # Needs KeyValueC.
  suite.addTest(test_Validation.test_suite())
  suite.addTest(test_Qualifier.test_suite())
  suite.addTest(test_SortOrderings.test_suite())
  suite.addTest(test_ObserverCenter.test_suite())
  suite.addTest(test_EntityClassDescription.test_suite())
  suite.addTest(test_EditingContext.test_suite())
  suite.addTest(test_DatabaseContext.test_suite())
  suite.addTest(test_FaultHandler.test_suite())
  suite.addTest(test_Adaptor.test_suite())
  suite.addTest(test_SQLExpression.test_suite())
  suite.addTest(test_SchemaGeneration.test_suite())
  suite.addTest(test_dynamic.test_suite())
  # global
  if global_tests:
    import test_EditingContext_Global
    suite.addTest(test_EditingContext_Global.test_suite())
    
  return suite

verbose=0 # we need this to be global, for use by profile.run()
global_tests=0

def main(args):
  me=args[0]
  try: options, args = getopt.getopt(sys.argv[1:], 'hvVpg')
  except: usage(me, 1)
  global verbose
  global global_tests
  profile=0
  for k, v in options:
    if k=='-h': usage(me, 1)
    if k=='-v': verbose=1; continue
    if k=='-V': verbose="Y"; continue
    if k=='-p': profile=1; continue
    if k=='-g': global_tests=1;  continue
  if args: usage(me, 1) #raise 'Unexpected arguments', args

  
  if profile:
    import profile
    profile.run('utils.run_suite(test_suite(), verbosity=verbose)',
                'profile.out')
    return 
  else:
      return utils.run_suite(test_suite(), verbosity=verbose)

if __name__ == "__main__":
  errs = main(sys.argv)
  sys.exit(errs and 1 or 0)
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.