コード例 #1
0
ファイル: script.py プロジェクト: HackLinux/chandler
def run_startup_script_with_symbols(view, builtIns):
    # On Linux at the time we reach this point the screen has not
    # been updated, i.e. drawn -- and when the screen isn't drawn
    # the focus can't be set to a widget that hasn't been drawn
    # so we explicitely update the screen before running the tests
    app = wx.GetApp()
    mainFrame = app.mainFrame
    mainFrame.Update()
    app.Yield(True)
    mainFrame.Update()
    app.Yield(True)

    global global_cats_profiler

    # Execute new framework if chandlerTests option is called
    
    recordedTest = Globals.options.recordedTest
    if recordedTest is not None:
        if not hasattr(Globals, 'test_dict'):
            from datetime import datetime
            Globals.test_dict = {'starttime':datetime.now()}
        from osaf.framework.script_recording.run_recorded import execute_frame
        execute_frame(recordedTest)
    
    chandlerTests = Globals.options.chandlerTests
    if chandlerTests:
        logFileName = Globals.options.chandlerTestLogfile
        testDebug = Globals.options.chandlerTestDebug
        testMask = Globals.options.chandlerTestMask
        from tools.cats.framework.runTests import run_tests
        run_tests(chandlerTests, debug=testDebug, mask=testMask, logName=logFileName)

    # Execute new framework if chandlerPerformanceTests option is called
    chandlerPerformanceTests = Globals.options.chandlerPerformanceTests
    if chandlerPerformanceTests:
        logFileName = Globals.options.chandlerTestLogfile
        testDebug = Globals.options.chandlerTestDebug
        testMask = Globals.options.chandlerTestMask
        from tools.cats.framework.runTests import run_perf_tests
        run_perf_tests(chandlerPerformanceTests, debug=testDebug, mask=testMask, logName=logFileName)

    fileName = Globals.options.scriptFile
    if fileName:
        scriptFileText = script_file(fileName)
        if scriptFileText:
            # check if we should turn on the profiler for this script
            if Globals.options.catsProfile:
                profiler = hotshot.Profile(Globals.options.catsProfile)
                global_cats_profiler = profiler
                profiler.runcall(run_script_with_symbols,
                                 scriptFileText,
                                 fileName=fileName,
                                 profiler=profiler,
                                 builtIns=builtIns)
                profiler.close()
                global_cats_profiler = None
            else:
                run_script_with_symbols(scriptFileText, fileName = fileName,
                                        builtIns=builtIns)
コード例 #2
0
#   Copyright (c) 2003-2008 Open Source Applications Foundation
#
#   Licensed under the Apache License, Version 2.0 (the "License");
#   you may not use this file except in compliance with the License.
#   You may obtain a copy of the License at
#
#       http://www.apache.org/licenses/LICENSE-2.0
#
#   Unless required by applicable law or agreed to in writing, software
#   distributed under the License is distributed on an "AS IS" BASIS,
#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#   See the License for the specific language governing permissions and
#   limitations under the License.

from tools.cats.framework.runTests import run_tests
from tools.cats.Functional import tests
import application.Globals as Globals
import os

functional_dir = os.path.join(Globals.chandlerDirectory,"tools/cats/Functional")

teststring = ''.join(['%s:%s,' % (test, klass) for test, klass in tests.tests_to_run])[:-1]

run_tests(teststring)
コード例 #3
0
def run_startup_script_with_symbols(view, builtIns):
    # On Linux at the time we reach this point the screen has not
    # been updated, i.e. drawn -- and when the screen isn't drawn
    # the focus can't be set to a widget that hasn't been drawn
    # so we explicitely update the screen before running the tests
    app = wx.GetApp()
    mainFrame = app.mainFrame
    mainFrame.Update()
    app.Yield(True)
    mainFrame.Update()
    app.Yield(True)

    global global_cats_profiler

    # Execute new framework if chandlerTests option is called

    recordedTest = Globals.options.recordedTest
    if recordedTest is not None:
        if not hasattr(Globals, 'test_dict'):
            from datetime import datetime
            Globals.test_dict = {'starttime': datetime.now()}
        from osaf.framework.script_recording.run_recorded import execute_frame
        execute_frame(recordedTest)

    chandlerTests = Globals.options.chandlerTests
    if chandlerTests:
        logFileName = Globals.options.chandlerTestLogfile
        testDebug = Globals.options.chandlerTestDebug
        testMask = Globals.options.chandlerTestMask
        from tools.cats.framework.runTests import run_tests
        run_tests(chandlerTests,
                  debug=testDebug,
                  mask=testMask,
                  logName=logFileName)

    # Execute new framework if chandlerPerformanceTests option is called
    chandlerPerformanceTests = Globals.options.chandlerPerformanceTests
    if chandlerPerformanceTests:
        logFileName = Globals.options.chandlerTestLogfile
        testDebug = Globals.options.chandlerTestDebug
        testMask = Globals.options.chandlerTestMask
        from tools.cats.framework.runTests import run_perf_tests
        run_perf_tests(chandlerPerformanceTests,
                       debug=testDebug,
                       mask=testMask,
                       logName=logFileName)

    fileName = Globals.options.scriptFile
    if fileName:
        scriptFileText = script_file(fileName)
        if scriptFileText:
            # check if we should turn on the profiler for this script
            if Globals.options.catsProfile:
                profiler = hotshot.Profile(Globals.options.catsProfile)
                global_cats_profiler = profiler
                profiler.runcall(run_script_with_symbols,
                                 scriptFileText,
                                 fileName=fileName,
                                 profiler=profiler,
                                 builtIns=builtIns)
                profiler.close()
                global_cats_profiler = None
            else:
                run_script_with_symbols(scriptFileText,
                                        fileName=fileName,
                                        builtIns=builtIns)