def run(): mainLoop = glib.MainLoop() #@UndefinedVariable gobject.threads_init() #@UndefinedVariable args = parseRunArgs() count = 0 def wrapArgs(args): for index, script in enumerate(args.script): args.script[index] = TVector(filename=os.path.realpath(script), root=os.path.realpath(args.script_root)) # Now dynamically create the apis in the factory: ApiFactory.create(args.api_types) if args.nose==True: discover(args) if len(args.script_root)>0: sys.path.append(os.path.realpath(args.script_root)) args.project_root = os.path.join(os.path.dirname(__file__), "..") error = 0 # Single iteration for now: while (count<1) and (error==0): terminate = False autoStepper = AutoStepper(lambda: (terminate!=0)) runner = TestPlayback(args, notifier=autoStepper.func) debugger = runner.debugger() runner.setup(mainLoop, Queue()) try: runner.run(count) except UITestFailure as e: debugger.error("FAIL: %(E)s."%{"E":str(e)}) error = 1 finally: terminate = True runner.teardown() autoStepper.kill() count += 1 sys.exit(error)
def run(): mainLoop = glib.MainLoop() #@UndefinedVariable gobject.threads_init() #@UndefinedVariable args = parseRunArgs() count = 0 def wrapArgs(args): for index, script in enumerate(args.script): args.script[index] = TVector(filename=os.path.realpath(script), root=os.path.realpath( args.script_root)) # Now dynamically create the apis in the factory: ApiFactory.create(args.api_types) if args.nose == True: discover(args) if len(args.script_root) > 0: sys.path.append(os.path.realpath(args.script_root)) args.project_root = os.path.join(os.path.dirname(__file__), "..") error = 0 # Single iteration for now: while (count < 1) and (error == 0): terminate = False autoStepper = AutoStepper(lambda: (terminate != 0)) runner = TestPlayback(args, notifier=autoStepper.func) debugger = runner.debugger() runner.setup(mainLoop, Queue()) try: runner.run(count) except UITestFailure as e: debugger.error("FAIL: %(E)s." % {"E": str(e)}) error = 1 finally: terminate = True runner.teardown() autoStepper.kill() count += 1 sys.exit(error)
def discover(args): result = [] if args.nose == True: # Now use nose to 'discover' tests: oldcwd = os.getcwd() NSs = ["__requires__"] try: testRoot = args.script_root sys.path.append(testRoot) tmpFile = os.path.realpath("test_cases.txt") cargs = [ "", "-v", "--collect-only", "--exe", "--with-id", "--id-file=%(F)s" % { "F": tmpFile } ] try: apids = [] for apiType in args.api_types: apid = ApiFactory.emptyApi(apiType) apids.append(apid) api = apid.api() NS = api.NAMESPACE NSs.append(NS) __builtins__[NS] = api __builtins__["__requires__"] = ApiComparitor(apids) result = nose.run(defaultTest=testRoot, argv=cargs) except Exception, _e: raise else: if result is True: args.script = [] # Now query the selector: s = pickle.loads(file(tmpFile).read())["ids"] if os.path.exists(tmpFile): os.remove(tmpFile) for testCase in s.values(): filepath, relativeModuleSignature, test = testCase testPath = filepath.strip() if test is not None: testName = test.strip() # Now we have: testPath, relativeModuleSignature, test args.script.append( TVector(filename=testPath, moduleSig=relativeModuleSignature, methodName=testName, root=args.script_root, nose=True))
def discover(args): result = [] if args.nose==True: # Now use nose to 'discover' tests: oldcwd = os.getcwd() NSs = ["__requires__"] try: testRoot = args.script_root sys.path.append(testRoot) tmpFile = os.path.realpath("test_cases.txt") cargs=["", "-v" , "--collect-only", "--exe", "--with-id", "--id-file=%(F)s"%{"F":tmpFile}] try: apids = [] for apiType in args.api_types: apid = ApiFactory.emptyApi(apiType) apids.append(apid) api = apid.api() NS = api.NAMESPACE NSs.append(NS) __builtins__[NS] = api __builtins__["__requires__"] = ApiComparitor(apids) result = nose.run(defaultTest=testRoot, argv=cargs) except Exception, _e: raise else: if result is True: args.script = [] # Now query the selector: s = pickle.loads(file(tmpFile).read())["ids"] if os.path.exists(tmpFile): os.remove(tmpFile) for testCase in s.values(): filepath, relativeModuleSignature, test = testCase testPath = filepath.strip() if test is not None: testName = test.strip() # Now we have: testPath, relativeModuleSignature, test args.script.append(TVector(filename=testPath, moduleSig=relativeModuleSignature, methodName=testName, root=args.script_root, nose=True))