コード例 #1
0
ファイル: browser.py プロジェクト: sshveta/cfme_tests
def browser_session(*args, **kwargs):
    """A context manager that can be used to start and stop a browser.

    Usage:

        with browser_session as browser:
            # do stuff with browser here
        # Browser will be closed here

    """
    conf.env['base_url'] = kwargs['base_url']
    browser = start(*args, **kwargs)
    yield browser
    quit()
    conf.clear()
コード例 #2
0
ファイル: test_config.py プロジェクト: jkrocil/cfme_tests
def test_conf_runtime_override(random_string):
    # sanity check: If the random string is in conf.env, INSTANITY.
    assert random_string not in conf.env
    # Add the random string to the runtime dict, as well as a junk value to
    # prove we can add more than one thing via the ConfTree
    conf.runtime['env'][random_string] = True
    conf.runtime['foo'] = 'bar'
    # the override is in place
    assert random_string in conf.env
    conf.clear()
    # the override is still in place
    assert random_string in conf.env
    # deleting works
    del(conf.runtime['env'][random_string])
    assert random_string not in conf.env
コード例 #3
0
ファイル: browser.py プロジェクト: jkrocil/integration_tests
def browser_session(*args, **kwargs):
    """A context manager that can be used to start and stop a browser.

    Usage:

        with browser_session as browser:
            # do stuff with browser here
        # Browser will be closed here

    """
    conf.env['base_url'] = kwargs['base_url']
    browser = start(*args, **kwargs)
    try:
        yield browser
    finally:
        quit()
        conf.clear()
コード例 #4
0
ファイル: test_config.py プロジェクト: rlandy/cfme_tests
def create_test_yaml(request, contents, filename, local=False):
    if local:
        suffix = '.local.yaml'
    else:
        suffix = '.yaml'
    filename += suffix

    confdir = request.session.fspath.join('conf')
    full_path = str(confdir.join(filename))

    test_yaml = open(full_path, 'w')
    test_yaml.write(contents)
    test_yaml.flush()
    test_yaml.seek(0)

    request.addfinalizer(lambda: os.remove(full_path))
    request.addfinalizer(lambda: conf.clear())

    return test_yaml
コード例 #5
0
def init():
    conf.clear()
コード例 #6
0
 def _clear_conf(self):
     from utils import conf
     conf.clear()
コード例 #7
0
def init():
    conf.clear()
コード例 #8
0
ファイル: test_config.py プロジェクト: jkrocil/cfme_tests
def clear_conf():
    # Ensure the conf is cleared before every test
    conf.clear()