code
stringlengths
1
1.72M
language
stringclasses
1 value
#!/usr/bin/python2.4 # # Copyright 2010 Google Inc. All Rights Reserved. # # 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...
Python
#!/usr/bin/python2.4 # # Copyright 2010 Google Inc. All Rights Reserved. # # 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...
Python
#!/usr/bin/python2.4 # # Copyright 2010 Google Inc. All Rights Reserved. # # 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...
Python
#!/usr/bin/python2.4 # # Copyright 2010 Google Inc. All Rights Reserved. # # 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...
Python
#!/usr/bin/python2.4 # # Copyright 2010 Google Inc. All Rights Reserved. # # 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...
Python
#!/usr/bin/python2.4 # # Copyright 2010 Google Inc. All Rights Reserved. # # 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...
Python
#!/usr/bin/python2.4 # # Copyright 2010 Google Inc. All Rights Reserved. # # 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...
Python
#!/usr/bin/python2.4 # # Copyright 2010 Google Inc. All Rights Reserved. # # 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...
Python
#!/usr/bin/python2.4 # # Copyright 2010 Google Inc. All Rights Reserved. # # 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...
Python
#!/usr/bin/python2.4 # # Copyright 2010 Google Inc. All Rights Reserved. # # 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...
Python
#!/usr/bin/python2.4 # # Copyright 2010 Google Inc. All Rights Reserved. # # 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...
Python
#!/usr/bin/python2.4 # # Copyright 2010 Google Inc. All Rights Reserved. # # 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...
Python
#!/usr/bin/python2.4 # # Copyright 2010 Google Inc. All Rights Reserved. # # 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...
Python
#!/usr/bin/python2.4 # # Copyright 2010 Google Inc. All Rights Reserved. # # 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...
Python
#!/usr/bin/python2.4 # # Copyright 2010 Google Inc. All Rights Reserved. # # 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...
Python
#!/usr/bin/python2.4 # # Copyright 2010 Google Inc. All Rights Reserved. # # 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...
Python
#!/usr/bin/python2.4 # # Copyright 2010 Google Inc. All Rights Reserved. # # 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...
Python
#!/usr/bin/python2.4 # # Copyright 2011 Google Inc. All Rights Reserved. # # 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...
Python
#!/usr/bin/python2.4 # # Copyright 2010 Google Inc. All Rights Reserved. # # 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...
Python
#!/usr/bin/python2.4 # # Copyright 2010 Google Inc. All Rights Reserved. # # 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...
Python
#!/usr/bin/python2.4 # # Copyright 2010 Google Inc. All Rights Reserved. # # 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...
Python
#!/usr/bin/python2.4 # # Copyright 2011 Google Inc. All Rights Reserved. # # 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...
Python
# Copyright 2011 Google Inc. All Rights Reserved. # # 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 a...
Python
#!/usr/bin/python2.4 # # Copyright 2011 Google Inc. All Rights Reserved. # # 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...
Python
#!/usr/bin/python2.4 # # Copyright 2010 Google Inc. All Rights Reserved. # # 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...
Python
#!/usr/bin/python2.4 # # Copyright 2010 Google Inc. All Rights Reserved. # # 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...
Python
#!/usr/bin/python2.4 # # Copyright 2010 Google Inc. All Rights Reserved. # # 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...
Python
#!/usr/bin/python2.4 # # Copyright 2010 Google Inc. All Rights Reserved. # # 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...
Python
#!/usr/bin/python2.4 # # Copyright 2010 Google Inc. All Rights Reserved. # # 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...
Python
#!/usr/bin/python2.4 # # Copyright 2010 Google Inc. All Rights Reserved. # # 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...
Python
#!/usr/bin/python2.4 # # Copyright 2010 Google Inc. All Rights Reserved. # # 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...
Python
# Copyright 2011 Google Inc. All Rights Reserved. # # 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 a...
Python
# Copyright 2011 Google Inc. All Rights Reserved. # # 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 a...
Python
# -*- mode: python; -*- # Copyright 2011 Google Inc. All Rights Reserved. # # 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 require...
Python
# -*- mode: python; -*- # Copyright 2011 Google Inc. All Rights Reserved. # # 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 require...
Python
import random import math import pickle from libs.munkres import Munkres def createQtable(): FILE = open('agent4_qtable.txt','w') pickle.dump({},FILE) FILE.close() #tactics class GlobalLevel(): m = Munkres() matrix=[] #default tasks of agents task = [0,1,2,0,1,2] teamdata = None st...
Python
""" Main file """ g_settings = 0 #Enumerated variables for the roles of the agents _Loitering = 0 _LookingForAmmo = 1 _GrabbingAmmo = 2 _AttackMove = 3 _Camping = 4 _Combat = 5 _Shooting = 6 _CapturingCP = 7 ################################################################################ # Module: ...
Python
import random import math import pickle from libs.munkres import Munkres def createQtable(): FILE = open('agent4_qtable.txt','w') pickle.dump({},FILE) FILE.close() #tactics class GlobalLevel(): m = Munkres() matrix=[] #default tasks of agents task = [0,1,2,0,1,2] teamdata = None st...
Python
import random import math import pickle from libs.munkres import Munkres def createQtable(): FILE = open('agent4_qtable.txt','w') pickle.dump({},FILE) FILE.close() #tactics class GlobalLevel(): m = Munkres() matrix=[] #default tasks of agents task = [0,0,1,1,2,2] teamdata = None st...
Python
import random import math import pickle from libs.munkres import Munkres def createQtable(): FILE = open('agent4_qtable.txt','w') pickle.dump({},FILE) FILE.close() #tactics class GlobalLevel(): m = Munkres() matrix=[] #default tasks of agents task = [0,0,1,1,2,2] teamdata = None st...
Python
import random import math import pickle from libs.munkres import Munkres def createQtable(): FILE = open('agent4_qtable.txt','w') pickle.dump({},FILE) FILE.close() #tactics class GlobalLevel(): m = Munkres() matrix=[] #default tasks of agents task = [0,0,1,1,2,2] teamdata = None st...
Python
import random import math import pickle from libs.munkres import Munkres def createQtable(): FILE = open('agent4_qtable.txt','w') pickle.dump({},FILE) FILE.close() #tactics class GlobalLevel(): m = Munkres() matrix=[] #default tasks of agents task = [0,0,1,1,2,2] teamda...
Python
##################### # run.py - 22 feb 2012 - Hessel van der Molen # Runs & tests 2 defined agent in the domination game. ##### # USAGE: # # shell> python run.py [elements] # [elements] is: # -r <redagent.py> ( default: defaultAgent) # -b <blueagent.py> ( default:...
Python
##################### # run2.py - 27 feb 2012 - Hessel van der Molen # Runs & tests 2 identical self-learning agents in the domination-game # each 5 runs of a game, the cumaltive scores are compared. # The Q-table with the agent of the higest score is inserted in both agents ##### # USAGE: # # shell> p...
Python
import random import math import pickle def createQtable(): module = LocalLevel(None, None, 0, None, None) qtable = module.initQtable() FILE = open('Qtable_agent3_dict.txt','w') pickle.dump(qtable,FILE) FILE.close() #tactics class GlobalLevel(): #default tasks of agents task = [0,0,1...
Python
import random import math import pickle from libs.munkres import Munkres def createQtable(): FILE = open('agent4_qtable.txt','w') pickle.dump({},FILE) FILE.close() #tactics class GlobalLevel(): m = Munkres() matrix=[] #default tasks of agents task = [0,1,2,0,1,2] teamdata = None st...
Python
import random import math import pickle from libs.munkres import Munkres def createQtable(): FILE = open('agent4_qtable.txt','w') pickle.dump({},FILE) FILE.close() #tactics class GlobalLevel(): m = Munkres() matrix=[] #default tasks of agents task = [0,1,2,0,1,2] teamdata = None st...
Python
# usage: # - SVN DIR # shell> python replay.py <replay-file.gz> [f/false] # - REPLAY DIR # shell> python ../replay.py <replay-file.gz> [f/false] # - SUB-REPLAY DIR # shell> python ../../replay.py <replay-file.gz> [f/false] # # [f / false] = optional, if added, rendered=False # # import Domination directo...
Python
import random import math import pickle def createQtable(): module = LocalLevel(None, None, 0, None, None) qtable = module.initQtable() FILE = open('Qtable_agent3_dict.txt','w') pickle.dump(qtable,FILE) FILE.close() #tactics class GlobalLevel(): #default tasks of agents task = [0,0,1...
Python
import random import math import pickle def createQtable(): module = LocalLevel(None, None, 0, None, None) qtable = module.initQtable() FILE = open('Qtable_agent3_dict.txt','w') pickle.dump(qtable,FILE) FILE.close() #tactics class GlobalLevel(): #default tasks of agents task = [0,0,1...
Python
import pickle FILE = open('Qtable_agent3_vs_default_10000_14000.txt','rb') Qtable = pickle.loads(FILE.read()) FILE.close() b = [] for i,j in Qtable.iteritems(): b.append(i) b.sort() for i in b: print str(i)
Python
##################### # run.py - 5 march 2012 - Hessel van der Molen # Runs & tests 2 defined agents in the domination game. ##### # USAGE: # # shell> python run.py [elements] # [elements] is: # -r <redagent.py> (pythonfile default: defaultAgent) # -b <blueagent.py> (pythonfile ...
Python
class Agent(object): NAME = "default_agent" def __init__(self, id, team, settings=None, field_rects=None, field_grid=None, nav_mesh=None): """ Each agent is initialized at the beginning of each game. The first agent (id==0) can use this to set up global variables. Note...
Python
import random import math import cPickle class Agent(object): NAME = "Agent_007" Gamma = 0.9 Alpha = 0.1 num_of_actions = 4 # states features: # [a] AmmoAmount = 3 values [0:0, 1:1-2, 2:3+] # [b] TaskDistance = 4 values [0:0, 1:1, 2:2, 3:3+] # Qtable[a][b][action...
Python
class Agent(object): NAME = "KR1702_agent" ammo_pos = [] agent_goal=[0,0,0,0,0,0] def __init__(self, id, team, settings=None, field_rects=None, field_grid=None, nav_mesh=None): """ Each agent is initialized at the beginning of each game. The first agent (id==0) can use this t...
Python
class Agent(object): NAME = "default_agent" def __init__(self, id, team, settings=None, field_rects=None, field_grid=None, nav_mesh=None): """ Each agent is initialized at the beginning of each game. The first agent (id==0) can use this to set up global variables. Note...
Python
import random import math import cPickle class Agent(object): NAME = "Agent_007" Gamma = 0.9 Alpha = 0.1 num_of_actions = 4 # states features: # [a] AmmoAmount = 3 values [0:0, 1:1-2, 2:3+] # [b] TaskDistance = 4 values [0:0, 1:1, 2:2, 3:3+] # Qtable[a][b][action...
Python
class Agent(object): NAME = "KR1702_agent" ammo_pos = [] agent_goal=[0,0,0,0,0,0] my_CP = [0,0] agent_ammo=[0,0,0,0,0,0] def __init__(self, id, team, settings=None, field_rects=None, field_grid=None, nav_mesh=None): """ Each agent is initialized at the beginning of each game. ...
Python
class Agent(object): NAME = "KR1802_agent" ammo_pos = [] agent_goal1=[0,0,0] agent_goal2=[0,0,0] my_CP = [0,0] agent_ammo1=[0,0,0] agent_ammo2=[0,0,0] def __init__(self, id, team, settings=None, field_rects=None, field_grid=None, nav_mesh=None): """ Each agent is initiali...
Python
#==================================================================== # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you ...
Python
#!/usr/bin/env python import codecs import re import jinja2 import markdown def process_slides(): with codecs.open('../../presentation-output.html', 'w', encoding='utf8') as outfile: md = codecs.open('slides.md', encoding='utf8').read() md_slides = md.split('\n---\n') print 'Compiled %s slides.' % len(m...
Python
import os, time class MyException(Exception): pass def passing(*args): pass def sleeping(s): seconds = s while seconds > 0: time.sleep(min(seconds, 0.1)) seconds -= 0.1 os.environ['ROBOT_THREAD_TESTING'] = str(s) return s def returning(arg): return arg def failing(msg='...
Python
#!/usr/bin/env python """Helper script to run all Robot Framework's unit tests. usage: run_utest.py [options] options: -q, --quiet Minimal output -v, --verbose Verbose output -d, --doc Show test's doc string instead of name and class (implies verbosity) -h, --help ...
Python
#!/usr/bin/env python import urllib2 import shutil import os from os.path import join, exists, dirname, abspath from glob import glob from subprocess import call from zipfile import ZipFile JASMINE_REPORTER_URL='https://github.com/larrymyers/jasmine-reporters/zipball/0.2.1' BASE = abspath(dirname(__file__)) REPORT_DI...
Python
import os THIS_PATH = os.path.dirname(__file__) GOLDEN_OUTPUT = os.path.join(THIS_PATH, 'golden_suite', 'output.xml') GOLDEN_OUTPUT2 = os.path.join(THIS_PATH, 'golden_suite', 'output2.xml') GOLDEN_JS = os.path.join(THIS_PATH, 'golden_suite', 'expected.js')
Python
__author__ = 'janne'
Python
#!/usr/bin/env python import fileinput from os.path import join, dirname, abspath import sys import os BASEDIR = dirname(abspath(__file__)) OUTPUT = join(BASEDIR, 'output.xml') sys.path.insert(0, join(BASEDIR, '..', '..', '..', '..', 'src')) import robot from robot.conf.settings import RebotSettings from robot.repo...
Python
"""Robot Framework post-install script for Windows. This script is executed as the last part of the graphical Windows installation and during un-installation started from `Add/Remote Programs`. For more details: http://docs.python.org/distutils/builtdist.html#postinstallation-script """ from __future__ import with_s...
Python
#!/usr/bin/env python import sys import os from os.path import join, dirname from distutils.core import setup execfile(join(dirname(__file__), 'src', 'robot', 'version.py')) # Maximum width in Windows installer seems to be 70 characters -------| DESCRIPTION = """ Robot Framework is a generic test automation framewor...
Python
#!/usr/bin/env python """A script for running Robot Framework's acceptance tests. Usage: run_atests.py interpreter [options] datasource(s) Data sources are paths to directories or files under `robot` folder. Available options are the same that can be used with Robot Framework. See its help (e.g. `pybot --help`) fo...
Python
import subprocess import os import signal import ctypes class ProcessManager(object): def __init__(self): self._process = None self._stdout = None self._stderr = None def start_process(self, *args): self._process = subprocess.Popen(args, stderr=subprocess.PIPE, ...
Python
from __future__ import with_statement import os import re from os.path import abspath, dirname, join from subprocess import call, STDOUT import tempfile from robot.utils.asserts import assert_equals, assert_true from robot.utils import decode_output ROBOT_SRC = join(dirname(abspath(__file__)), '..', '..', '..', 'sr...
Python
import json import os import pprint import tempfile from os.path import join, dirname, abspath from subprocess import call, STDOUT from robot.api import logger from robot.utils import decode_output ROBOT_SRC = join(dirname(abspath(__file__)), '..', '..', '..', 'src') class LibDocLib(object): def __init__(self, ...
Python
from __future__ import with_statement import os from robot.utils import utf8open def output_should_have_correct_line_separators(path): with utf8open(path) as infile: content = infile.read() content = content.replace(os.linesep, '') extra_r = content.count('\r') extra_n = content.count('\n') ...
Python
from __future__ import with_statement from robot.api import logger class WrongStat(AssertionError): ROBOT_CONTINUE_ON_FAILURE = True def get_total_stats(path): return get_all_stats(path)[0] def get_tag_stats(path): return get_all_stats(path)[1] def get_suite_stats(path): return get_all_stats(path)...
Python
from robot.libraries.BuiltIn import BuiltIn BIN = BuiltIn() def start_keyword(*args): if BIN.get_variables()['${TESTNAME}'] == 'Listener Using BuiltIn': BIN.set_test_variable('${SET BY LISTENER}', 'quux')
Python
from __future__ import with_statement from os.path import abspath, dirname, join from fnmatch import fnmatchcase from operator import eq from robot.api import logger CURDIR = dirname(abspath(__file__)) def verify_output(actual, expected): actual = _read_file(actual, 'Actual') expected = _read_file(join(CURD...
Python
import os import time class ListenAll: ROBOT_LISTENER_API_VERSION = '2' def __init__(self, *path): path = ':'.join(path) if path else self._get_default_path() self.outfile = open(path, 'w') def _get_default_path(self): return os.path.join(os.getenv('TEMPDIR'), 'listen_all.txt') ...
Python
import os class OldListenAll: def __init__(self, *path): if not path: path = os.path.join(os.getenv('TEMPDIR'), 'listen_all.txt') else: path = ':'.join(path) self.outfile = open(path, 'w') def start_suite(self, name, doc): self.outfile.write("SUITE STA...
Python
import os outpath = os.path.join(os.getenv('TEMPDIR'), 'listen_by_module.txt') OUTFILE = open(outpath, 'w') ROBOT_LISTENER_API_VERSION = 2 def start_suite(name, attrs): metastr = ' '.join('%s: %s' % (k, v) for k, v in attrs['metadata'].items()) OUTFILE.write("SUITE START: %s '%s' [%s]\n" % ...
Python
import os class ListenSome: def __init__(self): outpath = os.path.join(os.getenv('TEMPDIR'), 'listen_some.txt') self.outfile = open(outpath, 'w') def startTest(self, name, doc, tags): self.outfile.write(name + '\n') def endSuite(self, stat, msg): self.outfile.write(msg +...
Python
import os from robot.libraries.BuiltIn import BuiltIn class ListenSome: ROBOT_LISTENER_API_VERSION = '2' def __init__(self): outpath = os.path.join(os.getenv('TEMPDIR'), 'listen_some.txt') self.outfile = open(outpath, 'w') def startTest(self, name, attrs): self.outfile.write(nam...
Python
import os outpath = os.path.join(os.getenv('TEMPDIR'), 'listen_by_module.txt') OUTFILE = open(outpath, 'w') def start_suite(name, doc): OUTFILE.write("SUITE START: %s '%s'\n" % (name, doc)) def start_test(name, doc, tags): tags = [ str(tag) for tag in tags ] OUTFILE.write("TEST START: %s '%s' %s\n" % (n...
Python
import os ROBOT_LISTENER_API_VERSION = '2' OUTFILE = open(os.path.join(os.getenv('TEMPDIR'), 'listener_attrs.txt'), 'w') START_ATTRS = 'doc starttime ' END_ATTRS = START_ATTRS + 'endtime elapsedtime status ' EXPECTED_TYPES = {'elapsedtime': (int, long), 'tags': list, 'args': list, 'metadata': dict, ...
Python
def get_variables(*args): return { 'PPATH_VARFILE_2' : ' '.join(args), 'LIST__PPATH_VARFILE_2' : args }
Python
PPATH_VARFILE = "Variable from variable file in PYTHONPATH"
Python
list1 = [1, 2, 3, 4, 'foo', 'bar'] dictionary1 = {'a': 1} dictionary2 = {'a': 1, 'b': 2}
Python
class TraceLogArgsLibrary(object): def only_mandatory(self, mand1, mand2): pass def mandatory_and_default(self, mand, default="default value"): pass def multiple_default_values(self, a=1, a2=2, a3=3, a4=4): pass def mandatory_and_varargs(self, mand, *varargs): pass ...
Python
class FailUntilSucceeds: ROBOT_LIBRARY_SCOPE = 'TESTCASE' def __init__(self, times_to_fail=0): self.times_to_fail = int(times_to_fail) def fail_until_retried_often_enough(self, message="Hello"): self.times_to_fail -= 1 if self.times_to_fail >= 0: raise Exce...
Python
import exceptions class ObjectToReturn: def __init__(self, name): self.name = name def __str__(self): return self.name def exception(self, name, msg=""): exception = getattr(exceptions, name) raise exception, msg
Python
class SameNamesAsInBuiltIn: def noop(self): """Using this keyword without libname causes an error"""
Python
from robot.libraries.BuiltIn import BuiltIn class NamespaceUsingLibrary(object): def __init__(self): self._importing_suite = BuiltIn().get_variable_value('${SUITE NAME}') self._easter = BuiltIn().get_library_instance('Easter') def get_importing_suite(self): return self._importing_suit...
Python
class ZipLib: def kw_from_zip(self, arg): print '*INFO*', arg return arg * 2
Python
class PythonVarArgsConstructor: def __init__(self, mandatory, *varargs): self.mandatory = mandatory self.varargs = varargs def get_args(self): return self.mandatory, ' '.join(self.varargs)
Python
import os _dirs = __file__.split(os.sep) while True: if _dirs.pop() == 'atest': break _BITMAP = os.path.join(os.sep.join(_dirs), 'robot.bmp') class BinaryDataLibrary: def print_bytes(self): """Prints all bytes in range 0-255. Many of them are control chars.""" for i in range(256...
Python
import ExampleJavaLibrary import DefaultArgs class ExtendJavaLib(ExampleJavaLibrary): def kw_in_java_extender(self, arg): return arg*2 def javaSleep(self, secs): raise Exception('Overridden kw executed!') def using_method_from_java_parent(self): self.divByZero() class ExtendJa...
Python
import os # Tests that standard modules can be imported from libraries import sys class ImportRobotModuleTestLibrary: """Tests that robot internal modules can't be imported accidentally""" def import_logging(self): try: import logging except ImportError: if os.name ==...
Python
class ArgumentsPython: # method docs are used in unit tests as expected min and max args def a_0(self): """(0,0)""" return 'a_0' def a_1(self, arg): """(1,1)""" return 'a_1: ' + arg def a_3(self, arg1, arg2, arg3): """(3,3)""" return ' ...
Python
from robot import utils class RunKeywordLibrary: ROBOT_LIBRARY_SCOPE = 'TESTCASE' def __init__(self): self.kw_names = ['Run Keyword That Passes', 'Run Keyword That Fails'] def get_keyword_names(self): return self.kw_names def run_keyword(self, name, args): try: m...
Python
def keyword_from_deeper_submodule(): return 'hi again' class Sub: def keyword_from_class_in_deeper_submodule(self): return 'bye'
Python