def main():
    exit_code = 0

    tender_file_path = os.path.join(PWD, "data/tender_data.json")
    run_auction(tender_file_path,
                auction_id="11111111111111111111111111111111")
    sleep(4)
    # with mock_patch('sys.exit') as exit_mock:
    try:
        run_cli([
            '-L',
            'DEBUG',
            '--exitonfailure',
            '-v',
            'tender_file_path:{}'.format(tender_file_path),
            '-v',
            'auction_worker_defaults:{0}/etc/auction_worker_defaults.yaml'.
            format(CWD),
            '-l',
            '{0}/logs/log_simple_auction'.format(CWD),
            '-r',
            '{0}/logs/report_simple_auction'.format(CWD),
            '-d',
            os.path.join(CWD, "logs"),
            PWD,
        ])
    except SystemExit, e:
        exit_code = e.code
Пример #2
0
def python(*opts):
    try:
        run_cli(['--outputdir', OUTPUT_PYTHON,
                '--include', 'pybot']
                + list(COMMON_OPTS + opts))
    except SystemExit:
        pass
 def run(self):
     for i in range(3):
         time.sleep(random.randint(1, 10))
         run_cli(self.cmd)
         name, status = self.check_test_result_from_output(self.rpt_path)
         if status == 'PASS':
             break
     self.status = status
Пример #4
0
def jython(*opts):
    try:
        run_cli([
            '--outputdir', OUTPUT_JYTHON, '--pythonpath', JAR_PATH,
            '--include', 'jybot'
        ] + list(COMMON_OPTS + opts))
    except SystemExit:
        pass
Пример #5
0
def jython(*opts):
    try:
        run_cli(['--outputdir', OUTPUT_JYTHON,
                '--pythonpath', JAR_PATH,
                '--include', 'jybot']
                + list(COMMON_OPTS + opts))
    except SystemExit:
        pass
Пример #6
0
def atest(attempt, extra_args):
    """ perform a single attempt of the acceptance tests
    """
    extra_args += OS_PY_ARGS.get((OS, PY), [])

    stem = get_stem(attempt, extra_args)

    for non_critical in NON_CRITICAL:
        extra_args += ["--noncritical", "AND".join(non_critical)]

    if attempt != 1:
        previous = OUT / f"{get_stem(attempt - 1, extra_args)}.robot.xml"
        if previous.exists():
            extra_args += ["--rerunfailed", str(previous)]

    out_dir = OUT / stem

    args = [
        "--name",
        f"{OS}{PY}",
        "--outputdir",
        out_dir,
        "--output",
        OUT / f"{stem}.robot.xml",
        "--log",
        OUT / f"{stem}.log.html",
        "--report",
        OUT / f"{stem}.report.html",
        "--xunitskipnoncritical",
        "--xunit",
        OUT / f"{stem}.xunit.xml",
        "--variable",
        f"OS:{OS}",
        "--variable",
        f"PY:{PY}",
        "--randomize",
        "all",
        *(extra_args or []),
        ATEST,
    ]

    print("Robot Arguments\n", " ".join(["robot"] + list(map(str, args))))

    os.chdir(ATEST)

    if out_dir.exists():
        print("trying to clean out {}".format(out_dir))
        try:
            shutil.rmtree(out_dir)
        except Exception as err:
            print("Error deleting {}, hopefully harmless: {}".format(
                out_dir, err))

    try:
        robot.run_cli(list(map(str, args)))
        return 0
    except SystemExit as err:
        return err.code
Пример #7
0
def run_atests(args):
    if '--help' in args:
        print(__doc__)
        return 251
    if not args or not exists(args[-1]):
        args.append(join(ROOT, 'atest'))
    try:
        run_cli(CONFIG + args)
    except SystemExit as exit:
        return exit.code
Пример #8
0
def run_atests(args):
    if '--help' in args:
        print(__doc__)
        return 251
    if not args or not exists(args[-1]):
        args.append(join(ROOT, 'atest'))
    try:
        run_cli(CONFIG + args)
    except SystemExit as exit:
        return exit.code
Пример #9
0
def run_cli(args):
    # abstracts away this change
    # https://code.google.com/p/robotframework/source/detail?r=ebc6fbb542e6
    # so we can test this lib against RF 2.6 and 2.7 w/o much config overhead

    import robot
    try:
        robot.run_cli(args)
    except Exception as e:
        print(e)
        import robot.runner
        robot.run_from_cli(args, robot.runner.__doc__)
def run_cli(args):
    # abstracts away this change
    # https://code.google.com/p/robotframework/source/detail?r=ebc6fbb542e6
    # so we can test this lib against RF 2.6 and 2.7 w/o much config overhead

    import robot
    try:
       robot.run_cli(args)
    except Exception, e:
       print e
       import robot.runner
       robot.run_from_cli(args, robot.runner.__doc__)
Пример #11
0
def run_tests(interpreter=None):
    test_path = os.path.join('src', 'test', 'robotframework', 'acceptance')
    if interpreter is None:
        sys.path.extend(list(get_env()))
        run_cli(['--loglevel', 'DEBUG', test_path])
    else:
        set_env()
        if sys.platform.startswith('win'):
            which_program = 'where'
        else:
            which_program = 'which'
        which_pybot = check_output([which_program, 'pybot']).rstrip()
        call([interpreter, which_pybot, '--loglevel', 'DEBUG', test_path])
Пример #12
0
def main():
    tender_file_path = os.path.join(PWD, "data/tender_data.json")
    auction_process = run_auction(tender_file_path)
    sleep(4)
    # with mock_patch('sys.exit') as exit_mock:
    exit_code = 0
    try:
        run_cli(['-L', 'DEBUG', '--exitonfailure',
                 '-v', 'tender_file_path:{}'.format(tender_file_path),
                 '-v', 'auction_worker_defaults:{0}/etc/auction_worker_defaults.json'.format(CWD),
                 '-d', os.path.join(CWD, "logs"), PWD,])
    except SystemExit, e:
        exit_code = e.code
Пример #13
0
def run_tests(interpreter=None):
    test_path = os.path.join('src', 'test', 'robotframework', 'acceptance')
    if interpreter is None:
        sys.path.extend(list(get_env()))
        run_cli(['--loglevel', 'DEBUG', test_path])
    else:
        set_env()
        if sys.platform.startswith('win'):
            which_program = 'where'
        else:
            which_program = 'which'
        which_pybot = check_output([which_program, 'pybot']).rstrip()
        call([interpreter, which_pybot, '--loglevel', 'DEBUG', test_path])
Пример #14
0
def run_robot_task(queue, args):
    exit_orig = sys.exit
    ret = 0

    def exit_new(r):
        nonlocal ret
        ret = r

    sys.exit = exit_new

    robot.run_cli(args)

    queue.put(ret)
    sys.exit = exit_orig
def pybot():
    # This code hides warnings for known Sphinx-only-directives when
    # executing pybot against Sphinx-documentation:
    from docutils.parsers.rst.directives import register_directive
    from docutils.parsers.rst.roles import register_local_role
    dummy_directive = lambda *args: []
    options = ('maxdepth', 'creates', 'numbered', 'hidden')
    setattr(dummy_directive, 'content', True)
    setattr(dummy_directive, 'options', dict([(opt, str) for opt in options]))
    register_directive('toctree', dummy_directive)
    register_directive('robotframework', dummy_directive)
    register_local_role('ref', dummy_directive)

    # Run pybot
    run_cli(sys.argv[1:])
Пример #16
0
def pybot():
    # This code hides warnings for known Sphinx-only-directives when
    # executing pybot against Sphinx-documentation:
    from docutils.parsers.rst.directives import register_directive
    from docutils.parsers.rst.roles import register_local_role
    dummy_directive = lambda *args: []
    options = ('maxdepth', 'creates', 'numbered', 'hidden')
    setattr(dummy_directive, 'content', True)
    setattr(dummy_directive, 'options', dict([(opt, str) for opt in options]))
    register_directive('toctree', dummy_directive)
    register_directive('robotframework', dummy_directive)
    register_local_role('ref', dummy_directive)

    # Run pybot
    run_cli(sys.argv[1:])
Пример #17
0
def pybot():
    # This code hides warnings for known Sphinx-only-directives when
    # executing pybot against Sphinx-documentation:
    from docutils.parsers.rst.directives import register_directive
    from docutils.parsers.rst.roles import register_local_role

    dummy_directive = lambda *args: []
    options = ("maxdepth", "creates", "numbered", "hidden")
    setattr(dummy_directive, "content", True)
    setattr(dummy_directive, "options", dict([(opt, str) for opt in options]))
    register_directive("toctree", dummy_directive)
    register_directive("robotframework", dummy_directive)
    register_local_role("ref", dummy_directive)

    # Run pybot
    run_cli(sys.argv[1:])
Пример #18
0
def shell():
    """A standalone robotframework shell"""

    import tempfile
    # ceate test suite file for REPL.
    source = tempfile.NamedTemporaryFile(prefix='robot_debug',
                                         suffix='.txt',
                                         delete=False)
    source.write(b'''*** Settings ***
Library  DebugLibrary

** test case **
RFDEBUG REPL
    debug
''')
    source.flush()

    args = '-l None -x None -o None -L None -r None ' + source.name
    from robot import run_cli
    rc = run_cli(args.split())

    source.close()
    if os.path.exists(source.name):
        os.unlink(source.name)
    sys.exit(rc)
Пример #19
0
def shell():
    """A standalone robotframework shell"""

    # ceate test suite file for REPL.
    source = tempfile.NamedTemporaryFile(prefix='robot_debug',
                                         suffix='.txt',
                                         delete=False)
    source.write(b'''*** Settings ***
Library  DebugLibrary

** test case **
RFDEBUG REPL
    debug
''')
    source.flush()

    default_no_logs = '-l None -x None -o None -L None -r None'
    if len(sys.argv) > 1:
        args = sys.argv[1:] + [source.name]
    else:
        args = default_no_logs.split() + [source.name]
    rc = run_cli(args)

    source.close()
    if os.path.exists(source.name):
        os.unlink(source.name)
    sys.exit(rc)
def shell():
    '''A standalone robotframework shell'''

    import tempfile
    # ceate test suite file for REPL.
    source = tempfile.NamedTemporaryFile(prefix='robot_debug',
                                         suffix='.txt', delete=False)
    source.write('''*** Settings ***
Library  DebugLibrary

** test case **
REPL
    debug
''')
    source.flush()

    args = '-l None -x None -o None -L None ' + source.name
    import robot
    try:
        from robot import run_cli
        rc = run_cli(args.split())
    except ImportError:
        import robot.runner
        rc = robot.run_from_cli(args.split(), robot.runner.__doc__)

    source.close()
    if os.path.exists(source.name):
        os.unlink(source.name)
    sys.exit(rc)
Пример #21
0
 def runTask(self, rowid, procsCount, lock):
     tasks = TasksDB(self.args.outputdir)
     suite = tasks.getTask(rowid)
     print(str(os.getpid()) + '|Running suite ' + suite + ' .....')
     with lock:
         procsCount.value += 1
     if suite == 'rebot':
         runArgs = ['-R','-d',self.args.outputdir,self.args.outputdir+'/*.xml']
         robot.rebot_cli(runArgs, exit=False)
     else:
         runArgs = self.robotArgs + ['-l','NONE','-r','NONE','-s',suite,'-o',suite+'.xml',self.args.main_suite]
         robot.run_cli(runArgs, exit=False)
     tasks.finishTask(rowid)
     tasks.printTableData()
     with lock:
         procsCount.value -= 1
Пример #22
0
def shell():
    """A standalone robotframework shell"""

    with tempfile.NamedTemporaryFile(prefix='robot-debug-',
                                     suffix='.txt',
                                     delete=False) as test_file:
        try:
            test_file.write(TEST_SUITE)
            test_file.flush()

            default_no_logs = '-l None -x None -o None -L None -r None'
            if len(sys.argv) > 1:
                args = sys.argv[1:] + [test_file.name]
            else:
                args = default_no_logs.split() + [test_file.name]
            rc = run_cli(args)

            sys.exit(rc)
        finally:
            test_file.close()
            # pybot will raise PermissionError on Windows NT or later
            # if NamedTemporaryFile called with `delete=True`,
            # deleting test file seperated will be OK.
            if os.path.exists(test_file.name):
                os.unlink(test_file.name)
Пример #23
0
def robot():
    # Enable nbreader
    if 'ipynb' not in populators.READERS:
        populators.READERS['ipynb'] = NotebookReader
        TEST_EXTENSIONS.add('ipynb')
        RESOURCE_EXTENSIONS.add('ipynb')
    return run_cli(sys.argv[1:])
Пример #24
0
def shell():
    '''A standalone robotframework shell'''

    import tempfile
    # ceate test suite file for REPL.
    source = tempfile.NamedTemporaryFile(prefix='robot_debug',
                                         suffix='.txt',
                                         delete=False)
    source.write(b'''*** Settings ***
Library  DebugLibrary

** test case **
REPL
    debug
''')
    source.flush()

    args = '-l None -x None -o None -L None ' + source.name
    import robot
    try:
        from robot import run_cli
        rc = run_cli(args.split())
    except ImportError:
        import robot.runner
        rc = robot.run_from_cli(args.split(), robot.runner.__doc__)

    source.close()
    if os.path.exists(source.name):
        os.unlink(source.name)
    sys.exit(rc)
Пример #25
0
def runner():
    args = sys.argv[1:]
    if '-d' not in args:
        directory = os.path.join(os.getcwd(), 'test_output')
        if not os.path.exists(directory):
            os.mkdir(directory)
        args += ['-d', directory]
    args.append(os.path.join(os.path.dirname(__file__), 'tests_files'))
    return run_cli(args)
Пример #26
0
def run(suite, env, project = "", version = "", cycle = ""):
     print "running tests using settings: ", env
     #rm -f ROBOT_DIR + "/output/*.*"
     if (os.path.exists(OUTPUT_DIR)):
         shutil.rmtree(OUTPUT_DIR)

     # generate robomachine tests for this suite
     subprocess.call(["python", os.path.join(SCRIPT_DIR, "generate_robomachine_tests.py"), suite])

     # robot arguments
     arg_list = ["--variablefile", os.path.join(SETTINGS_DIR, env +".py"),
                 "--pythonpath", PYTHONLIBS_DIR + ":" + RESOURCE_DIR + ":" + SETTINGS_DIR,
                 "--outputdir", OUTPUT_DIR,
                 "--exclude", "Draft",
#                 "--include", "RDC-647",
                 "--nostatusrc",
                 "--xunit", "xunit.xml"]

     # if project name is specified test run results will be reported to JIRA using Zephyr
     if project != "":
         arg_list.append("--listener")
         arg_list.append("realtest.zephyr.ZephyrLibrary")

         arg_list.append("--metadata")
         arg_list.append("Project:" + project)

     if version != "":
         arg_list.append("--metadata")
         arg_list.append("Version:" + version)

     if cycle != "":
         arg_list.append("--metadata")
         arg_list.append("Testcycle:" + cycle)

     # specify test suite
     arg_list.append(os.path.join(SUITES_DIR, suite))

     # append generated suite if exists
     if (os.path.isdir(GENERATED_DIR)):
         arg_list.append(os.path.join(SUITES_DIR, "generated"))

     # run tests
     robot.run_cli(arg_list)
Пример #27
0
 def execute(self):
     if self.debug:
         print("Environment: %s" % self.full_environment)
         print("Commandline: %s" % self.commandline)
     # pylint: disable=unused-variable
     for key, value in self.new_environment_variables.items():
         newpaths = value.split(os.pathsep)
         for path in newpaths:
             pythonpathsetter.add_path(path, True)
     return run_cli(self.commandline[1:], exit=False)  # pylint: disable=unsubscriptable-object
Пример #28
0
def atest(attempt, extra_args):
    """ perform a single attempt of the acceptance tests
    """
    stem = "_".join([OS, PY, str(attempt)]).replace(".", "_").lower()
    out_dir = OUT / stem

    args = [
        "--name",
        f"{OS}{PY}",
        "--outputdir",
        out_dir,
        "--output",
        OUT / f"{stem}.robot.xml",
        "--log",
        OUT / f"{stem}.log.html",
        "--report",
        OUT / f"{stem}.report.html",
        "--xunit",
        OUT / f"{stem}.xunit.xml",
        "--variable",
        f"OS:{OS}",
        "--variable",
        f"PY:{PY}",
        *(extra_args or []),
        ATEST,
    ]

    os.chdir(ATEST)

    if out_dir.exists():
        print("trying to clean out {}".format(out_dir))
        try:
            shutil.rmtree(out_dir)
        except Exception as err:
            print("Error deleting {}, hopefully harmless: {}".format(
                out_dir, err))

    try:
        robot.run_cli(list(map(str, args)))
        return 0
    except SystemExit as err:
        return err.code
Пример #29
0
    def run(self):
        import robot  # type: ignore

        code = robot.run_cli(
            [
                "--outputdir=%s" % (self.dap_logs_dir, ),
                "--listener=robotframework_debug_adapter.listeners.DebugListener",
                self.target,
            ],
            exit=False,
        )
        self.result_code = code
Пример #30
0
    def run(target):
        import robot

        code = robot.run_cli(
            [
                "--outputdir=%s" % (dap_logs_dir, ),
                "--listener=robotframework_debug_adapter.listeners.DebugListener",
                target,
            ],
            exit=False,
        )
        return code
def main():
    try:
        import robotframework_ls
    except ImportError:
        # Automatically add it to the path if __main__ is being executed.
        sys.path.append(
            os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
        import robotframework_ls  # @UnusedImport

    from robotframework_ls.robotframework_log import (
        configure_logger,
        log_args_and_python,
    )
    from robotframework_ls.robotframework_log import get_logger

    configure_logger("robot")
    log = get_logger("robotframework_debug_adapter.run_robot__main__.py")
    log_args_and_python(log, sys.argv)

    from robotframework_ls.options import DEFAULT_TIMEOUT

    args = sys.argv[1:]
    assert args[0] == "--port"
    port = args[1]

    robot_args = args[2:]

    s = connect(int(port))
    processor = _DAPCommandProcessor(s)
    processor.start_communication_threads()
    if not processor.configuration_done.wait(DEFAULT_TIMEOUT):
        sys.stderr.write(
            "Process not configured for launch in the available timeout.\n")
        sys.exit(1)

    try:
        from robot import run_cli

        exitcode = run_cli(robot_args, exit=False)
    finally:
        processor.terminate()
        if processor.terminated.wait(2):
            log.debug("Processed dap terminate event in robot.")
    sys.exit(exitcode)
Пример #32
0
def atest(attempt=0):
    """ run the acceptance tests once
    """
    # pylint: disable=broad-except
    stem = "_".join([OS, PY, str(attempt)]).replace(".", "_").lower()
    out_dir = OUT / stem

    args = [
        "--name",
        f"{OS}{PY}",
        "--outputdir",
        out_dir,
        "--output",
        OUT / f"{stem}.robot.xml",
        "--log",
        OUT / f"{stem}.log.html",
        "--report",
        OUT / f"{stem}.report.html",
        "--xunit",
        OUT / f"{stem}.xunit.xml",
        "--variable",
        f"OS:{OS}",
        "--variable",
        f"PY:{PY}",
        "--noncritical",
        "ospy:windows38",
        "--xunitskipnoncritical",
        *sys.argv[1:],
        ATEST,
    ]

    os.chdir(ATEST)

    if out_dir.exists():
        print("trying to clean out {}".format(out_dir))
        try:
            shutil.rmtree(out_dir)
        except Exception as err:
            print("Error deleting {}, hopefully harmless: {}".format(
                out_dir, err))

    return robot.run_cli(list(map(str, args)), exit=False)
def shell():
    """A standalone robotframework shell"""

    with tempfile.NamedTemporaryFile(prefix='robot-debug-',
                                     suffix='.txt',
                                     delete=True) as test_file:
        test_file.write(b'''*** Settings ***
Library  DebugLibrary

** test case **
RFDEBUG REPL
    debug
''')
        test_file.flush()

        default_no_logs = '-l None -x None -o None -L None -r None'
        if len(sys.argv) > 1:
            args = sys.argv[1:] + [test_file.name]
        else:
            args = default_no_logs.split() + [test_file.name]
        rc = run_cli(args)

        sys.exit(rc)
Пример #34
0
    def run(self, args, opts):
        """Sub command 'debug' runner"""
        source = tempfile.NamedTemporaryFile(prefix='robot_debug',
                                             suffix='.txt', delete=False)
        source.write('''*** Settings ***
Library    robotx.lib.DebugLibrary.Debug

** Test Cases **
A Debug Case
    debug
''')
        source.flush()
        args = '-L TRACE ' + source.name
        try:
            from robot import run_cli
            rc = run_cli(args.split())
        except ImportError:
            import robot.runner
            rc = robot.run_from_cli(args.split(), robot.runner.__doc__)
        source.close()
        if os.path.exists(source.name):
            os.unlink(source.name)
        sys.exit(rc)
Пример #35
0
    def run(self, args, opts):
        """Sub command 'debug' runner"""
        source = tempfile.NamedTemporaryFile(prefix='robot_debug',
                                             suffix='.txt',
                                             delete=False)
        source.write('''*** Settings ***
Library    robotx.lib.DebugLibrary.Debug

** Test Cases **
A Debug Case
    debug
''')
        source.flush()
        args = '-L TRACE ' + source.name
        try:
            from robot import run_cli
            rc = run_cli(args.split())
        except ImportError:
            import robot.runner
            rc = robot.run_from_cli(args.split(), robot.runner.__doc__)
        source.close()
        if os.path.exists(source.name):
            os.unlink(source.name)
        sys.exit(rc)
def shell():
    '''A standalone robotframework shell'''

    import tempfile
    # ceate test suite file for REPL.
    source = tempfile.NamedTemporaryFile(prefix='robot_debug', suffix='.txt')
    source.write('''*** Settings ***
Library  DebugLibrary

** test case **
REPL
    debug
''')
    source.flush()

    import robot
    import robot.runner
    args = '-l None -x None -o None -L None ' + source.name
    robot_version = robot.version.get_version()
    if robot_version > '2.7':
        rc = robot.run_cli(args.split())
    else:
        rc = robot.run_from_cli(args.split(), robot.runner.__doc__)
    sys.exit(rc)
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys

from os.path import abspath, dirname, join as path_join

from robot import run_cli

if __name__ == '__main__':
    curdir = abspath(dirname(__file__))
    sys.path.insert(1, abspath(path_join(curdir, '..', '..', 'src')))
    from ImageHorizonLibrary.utils import *

    if is_windows():
        tag = 'windows'
    elif is_mac():
        tag = 'mac'
    elif is_linux():
        tag = 'linux'

run_cli(sys.argv[1:] + ['--include', tag, '.'])
 def test_run_cli_optionally_returns_rc(self):
     rc = run_cli([self.data], exit=False)
     assert_equal(rc, 1)
Пример #39
0
def pybot():
    run_cli(sys.argv[1:])
def main(cli_args):
    extend_python_path()
    cli_args.extend(DEFAULT_ARGS.split())
    return run_cli(cli_args)
Пример #41
0
def robot_debug():
    run_cli(
        ["--listener", "plone.app.robotframework.RobotListener", "-v", "SELENIUM_RUN_ON_FAILURE:Debug"] + sys.argv[1:]
    )
def robot_debug():
    run_cli(['--listener', 'plone.app.robotframework.RobotListener',
             '-v', 'SELENIUM_RUN_ON_FAILURE:Debug']
            + sys.argv[1:])
def robot():
    run_cli(['--listener', 'plone.app.robotframework.RobotListener']
            + sys.argv[1:])
 def test_run_cli_optionally_returns_rc(self):
     rc = run_cli(['-d', TEMP, self.data], exit=False)
     assert_equal(rc, 1)
Пример #45
0
def robot_debug():
    run_cli([
        '--listener', 'plone.app.robotframework.RobotListener', '-v',
        'SELENIUM_RUN_ON_FAILURE:Debug'
    ] + sys.argv[1:])
Пример #46
0
def main(cli_args):
    extend_python_path()
    cli_args.extend(DEFAULT_ARGS.split())
    return run_cli(cli_args)
Пример #47
0
#  Copyright 2008-2012 Nokia Siemens Networks Oyj
#
#  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.

import sys

# Allows running as a script. __name__ check needed with multiprocessing:
# http://code.google.com/p/robotframework/issues/detail?id=1137
if 'robot' not in sys.modules and __name__ == '__main__':
    import pythonpathsetter

from robot import run_cli
from robot.output import LOGGER

LOGGER.warn("'robot/runner.py' entry point is deprecated and will be removed "
            "in Robot Framework 2.8. Use new 'robot/run.py' instead.")

if __name__ == '__main__':
    run_cli(sys.argv[1:])
Пример #48
0
def robot():
    run_cli(['--listener', 'plone.app.robotframework.RobotListener'] +
            sys.argv[1:])
Пример #49
0
try:
    from robot import run_cli
except:
    sys.stderr.write("ERROR: Robot Framework is not installed\n")
    exit(1)

from robot.api import logger

TESTHOME = os.path.dirname(argv[0])
testsuites_path = os.path.join(TESTHOME, "implementation/testsuites/")

# If no argument given, run the whole testsuite
if len(argv) == 1:
    logger.warn("Running the whole testsuite")
    argv.append(testsuites_path)
    run_cli(argv[1:])
    exit(0)

# If "-s" or "--suite" given as arguments, exit
if set.intersection(set(["-s", "--suite"]), set(argv)):
    logger.warn("-s/--suite command line argument is disabled." \
                " Please give the direct path to the testsuite")
    exit(1)

# Determine run_cli arguments
args = []
isopt = False
suitename = ""
for i in xrange(1, len(argv)):

    arg = argv[i]
Пример #50
0
def robot():
    run_cli(["--listener", "plone.app.robotframework.RobotListener"] + sys.argv[1:])
def main():
    TESTS = {}
    for entry_point in iter_entry_points('openprocurement.auction.robottests'):
        suite = entry_point.load()
        TESTS.update(suite())

    parser = argparse.ArgumentParser('Auction test runner')
    parser.add_argument('suite',
                        choices=TESTS.keys(),
                        default='simple',
                        nargs='?',
                        help='test_suite')

    parser.add_argument('--browser',
                        dest='browser',
                        choices=['firefox', 'chrome', 'phantomjs'],
                        default='chrome',
                        nargs='?',
                        help='supported browsers')

    parser.add_argument('--ip',
                        dest='ip',
                        nargs='?',
                        help='ip of the remote server where tests will be run')

    parser.add_argument('--port',
                        dest='port',
                        nargs='?',
                        help='port of the remote server where tests will be '
                             'run')

    args = parser.parse_args()

    if args.port and (not args.ip):
        parser.error('The --port argument requires the --ip')

    if args.ip and (args.browser != 'chrome'):
        parser.error('Only chrome is allowed for remote test running')

    port = getattr(args, 'port', '4444')
    remote_url = 'None' if not args.ip else 'http://{}:{}/wd/hub'\
        .format(args.ip, port)

    desired_capabilities = DesiredCapabilities.CHROME if \
        args.browser == 'chrome' else 'None'

    test = TESTS[args.suite]

    test['runner'](test['worker_cmd'], test['tender_file_path'],
                   test['auction_id'])

    auction_worker_defaults = test['auction_worker_defaults']
    cli_args = [
        '-L',
        'TRACE',
        '--exitonfailure',
        '-v', 'tender_file_path:{}'.format(test['tender_file_path']),
        '-v', auction_worker_defaults.format(CWD),
        '-v', 'auction_id:{}'.format(test['auction_id']),
        '-v', 'BROWSER:{}'.format(args.browser),
        '-v', 'remote_url:{}'.format(remote_url),
        '-v', 'desired_capabilities:{}'.format(desired_capabilities),
        '-l', '{0}/logs/log_{1}'.format(CWD, args.suite),
        '-r', '{0}/logs/report_{1}'.format(CWD, args.suite),
        '-P', test['suite'],
        '-d', os.path.join(CWD, "logs"),
        test['suite']
    ]
    sleep(4)
    try:
        run_cli(cli_args)
    except SystemExit, e:
        exit_code = e.code