Exemple #1
0
def pytest_collection_modifyitems(session, config, items):
    # XXX: This also handles moving long_running tests to the front of the test module
    # There are a few different ways to handle this batter, but rather than building in logic
    # for both smoke and long_running marks to make sure each one reorders tests with respect to
    # the other, it made sense to just combine this here for now and organize these marks better
    # later on.
    yield

    # Split marked and unmarked tests
    split_tests = defaultdict(list)
    for item in items:
        for mark in ('smoke', 'long_running'):
            if mark in item.keywords:
                key = mark
                break
        else:
            key = None

        split_tests[key].append(item)

    # Now rebuild the items list with the smoke tests first, followed by long_running
    # with unmarked tests at the end
    session.items = split_tests['smoke'] + split_tests['long_running'] + split_tests[None]

    if split_tests['smoke']:
        # If there are smoke tests, use the fancy smoke test reporter
        smoke_tests = config.pluginmanager.getplugin('smoke_tests')
        reporter(config).write_sep('=', 'Running smoke tests')
        smoke_tests.start_time = time()
        smoke_tests.halt_on_fail = config.getvalue('haltonsmokefail')
Exemple #2
0
def pytest_collection_modifyitems(session, config, items):
    # XXX: This also handles moving long_running tests to the front of the test module
    # There are a few different ways to handle this batter, but rather than building in logic
    # for both smoke and long_running marks to make sure each one reorders tests with respect to
    # the other, it made sense to just combine this here for now and organize these marks better
    # later on.
    yield

    # Split marked and unmarked tests
    split_tests = defaultdict(list)
    for item in items:
        for mark in ('smoke', 'long_running'):
            if mark in item.keywords:
                key = mark
                break
        else:
            key = None

        split_tests[key].append(item)

    # Now rebuild the items list with the smoke tests first, followed by long_running
    # with unmarked tests at the end
    session.items = split_tests['smoke'] + split_tests['long_running'] + split_tests[None]

    if split_tests['smoke']:
        # If there are smoke tests, use the fancy smoke test reporter
        smoke_tests = config.pluginmanager.getplugin('smoke_tests')
        reporter(config).write_sep('=', 'Running smoke tests')
        smoke_tests.start_time = time()
        smoke_tests.halt_on_fail = config.getvalue('haltonsmokefail')
Exemple #3
0
def pytest_collection_modifyitems(session, config, items):
    # Just to print out the appliance's streams
    reporter(config).write("\nAppliance's streams: [{}]\n".format(", ".join(get_streams_id())))
    # Bail out if the appliance stream or version do not match
    check_stream = config.getvalue("check_stream").lower().strip()
    if check_stream:
        curr = current_stream()
        if check_stream != curr:
            raise Exception(
                "Stream mismatch - wanted {} but appliance is {}".format(check_stream, curr))
def pytest_collection_modifyitems(session, config, items):
    # Just to print out the appliance's streams
    reporter(config).write("\nAppliance's streams: [{}]\n".format(", ".join(
        get_streams_id())))
    # Bail out if the appliance stream or version do not match
    check_stream = config.getvalue("check_stream").lower().strip()
    if check_stream:
        curr = current_stream()
        if check_stream != curr:
            raise Exception(
                "Stream mismatch - wanted {} but appliance is {}".format(
                    check_stream, curr))
Exemple #5
0
def pytest_collection_modifyitems(session, config, items):
    # Split marked and unmarked tests
    split_tests = defaultdict(list)
    for item in items:
        key = 'smoke' if 'smoke' in item.keywords else 'non_smoke'
        split_tests[key].append(item)

    # Now rebuild the items list with the smoke tests first
    session.items = split_tests['smoke'] + split_tests['non_smoke']

    if split_tests['smoke']:
        smoke_tests = config.pluginmanager.getplugin('smoke_tests')
        reporter(config).write_sep('=', 'Running smoke tests')
        smoke_tests.start_time = time()
        smoke_tests.halt_on_fail = config.getvalue('haltonsmokefail')
Exemple #6
0
def pytest_configure(config):
    """Configures the parallel session, then fires pytest_parallel_configured."""
    reporter = terminalreporter.reporter()
    if not config.option.appliances:
        appliances = load_appliances_from_config(conf.env)
        reporter.write_line('Retrieved these appliances from the conf.env', red=True)
    else:
        appliance_config = {
            'appliances': [{'base_url': base_url} for base_url in config.option.appliances]}
        # Grab the possible globals from the conf.env
        for key, value in (
                (key, value)
                for key, value in conf.env.items()
                if key in IPAppliance.CONFIG_MAPPING and key not in IPAppliance.CONFIG_NONGLOBAL):
            appliance_config[key] = value
        appliances = load_appliances_from_config(appliance_config)
        reporter.write_line('Retrieved these appliances from the --appliance parameters', red=True)
    for appliance in appliances:
        reporter.write_line('* {!r}'.format(appliance), cyan=True)
    if len(appliances) > 1:
        session = ParallelSession(config, appliances)
        config.pluginmanager.register(session, "parallel_session")
        store.parallelizer_role = 'master'
        reporter.write_line(
            'As a parallelizer master kicking off parallel session for these {} appliances'.format(
                len(appliances)),
            green=True)
        config.hook.pytest_parallel_configured(parallel_session=session)
    else:
        reporter.write_line('No parallelization required', green=True)
        config.hook.pytest_parallel_configured(parallel_session=None)
Exemple #7
0
def pytest_sessionfinish(session, exitstatus):
    udf_log_file = log_path.join('unused_data_files.log')

    if udf_log_file.check():
        # Clean up old udf log if it exists
        udf_log_file.remove()

    if session.config.option.udf_report is False:
        # Short out here if not making a report
        return

    # Output an unused data files log after a test run
    data_files = set()
    for dirpath, dirnames, filenames in os.walk(str(data_path)):
        for filename in filenames:
            filepath = os.path.join(dirpath, filename)
            data_files.add(filepath)
    unused_data_files = data_files - seen_data_files

    if unused_data_files:
        # Write the log of unused data files out, minus the data dir prefix
        udf_log = ''.join(
            (line[len(str(data_path)):] + '\n' for line in unused_data_files)
        )
        udf_log_file.write(udf_log + '\n')

        # Throw a notice into the terminal reporter to check the log
        tr = reporter()
        tr.write_line('')
        tr.write_sep(
            '-',
            '%d unused data files after test run, check %s' % (
                len(unused_data_files), udf_log_file.basename
            )
        )
def pytest_configure(config):

    reporter = terminalreporter.reporter()
    if config.getoption('--dummy-appliance'):
        appliances = [DummyAppliance.from_config(config)]
        reporter.write_line('Retrieved Dummy Appliance', red=True)
    elif stack.top:
        appliances = [stack.top]
    elif config.option.appliances:
        appliances = appliances_from_cli(config.option.appliances)
        reporter.write_line('Retrieved these appliances from the --appliance parameters', red=True)
    elif config.getoption('--use-sprout'):
        from .sprout.plugin import mangle_in_sprout_appliances

        mangle_in_sprout_appliances(config)
        appliances = appliances_from_cli(config.option.appliances)
        reporter.write_line('Retrieved these appliances from the --sprout-* parameters', red=True)
    else:
        appliances = load_appliances_from_config(conf.env)
        reporter.write_line('Retrieved these appliances from the conf.env', red=True)

    if not stack.top:
        for appliance in appliances:
            reporter.write_line('* {!r}'.format(appliance), cyan=True)
    appliance = appliances[0]
    if not appliance.is_dev:
        appliance.set_session_timeout(86400)
    stack.push(appliance)
    plugin = ApplianceHolderPlugin(appliance, appliances)
    config.pluginmanager.register(plugin, PLUGIN_KEY)
Exemple #9
0
def pytest_configure(config):

    reporter = terminalreporter.reporter()
    if config.getoption('--dummy-appliance'):
        appliances = [DummyAppliance.from_config(config)]
        reporter.write_line('Retrieved Dummy Appliance', red=True)
    elif stack.top:
        appliances = [stack.top]
    elif config.option.appliances:
        appliances = appliances_from_cli(config.option.appliances)
        reporter.write_line('Retrieved these appliances from the --appliance parameters', red=True)
    elif config.getoption('--use-sprout'):
        from .sprout.plugin import mangle_in_sprout_appliances
        mangle_in_sprout_appliances(config)
        appliances = appliances_from_cli(config.option.appliances)
        reporter.write_line('Retrieved these appliances from the --sprout-* parameters', red=True)
    else:
        appliances = load_appliances_from_config(conf.env)
        reporter.write_line('Retrieved these appliances from the conf.env', red=True)

    if not stack.top:
        for appliance in appliances:
            reporter.write_line('* {!r}'.format(appliance), cyan=True)
    appliance = appliances[0]
    appliance.set_session_timeout(86400)
    stack.push(appliance)
    plugin = ApplianceHolderPlugin(appliance, appliances)
    config.pluginmanager.register(plugin, "appliance-holder")
Exemple #10
0
def pytest_sessionfinish(session, exitstatus):
    udf_log_file = log_path.join('unused_data_files.log')

    if udf_log_file.check():
        # Clean up old udf log if it exists
        udf_log_file.remove()

    if session.config.option.udf_report is False:
        # Short out here if not making a report
        return

    # Output an unused data files log after a test run
    data_files = set()
    for dirpath, dirnames, filenames in os.walk(str(data_path)):
        for filename in filenames:
            filepath = os.path.join(dirpath, filename)
            data_files.add(filepath)
    unused_data_files = data_files - seen_data_files

    if unused_data_files:
        # Write the log of unused data files out, minus the data dir prefix
        udf_log = ''.join(
            (line[len(str(data_path)):] + '\n' for line in unused_data_files))
        udf_log_file.write(udf_log + '\n')

        # Throw a notice into the terminal reporter to check the log
        tr = reporter()
        tr.write_line('')
        tr.write_sep(
            '-', '%d unused data files after test run, check %s' %
            (len(unused_data_files), udf_log_file.basename))
def pytest_configure(config):
    """Configures the parallel session, then fires pytest_parallel_configured."""
    reporter = terminalreporter.reporter()
    if not config.option.appliances:
        appliances = load_appliances_from_config(conf.env)
        reporter.write_line('Retrieved these appliances from the conf.env', red=True)
    else:
        appliance_config = {
            'appliances': [{'base_url': base_url} for base_url in config.option.appliances]}
        # Grab the possible globals from the conf.env
        for key, value in (
                (key, value)
                for key, value in conf.env.items()
                if key in IPAppliance.CONFIG_MAPPING and key not in IPAppliance.CONFIG_NONGLOBAL):
            appliance_config[key] = value
        appliances = load_appliances_from_config(appliance_config)
        reporter.write_line('Retrieved these appliances from the --appliance parameters', red=True)
    for appliance in appliances:
        reporter.write_line('* {!r}'.format(appliance), cyan=True)
    if len(appliances) > 1:
        session = ParallelSession(config, appliances)
        config.pluginmanager.register(session, "parallel_session")
        store.parallelizer_role = 'master'
        reporter.write_line(
            'As a parallelizer master kicking off parallel session for these {} appliances'.format(
                len(appliances)),
            green=True)
        config.hook.pytest_parallel_configured(parallel_session=session)
    else:
        reporter.write_line('No parallelization required', green=True)
        config.hook.pytest_parallel_configured(parallel_session=None)
def pytest_configure(config):
    global appliance
    global pool_id
    global sprout
    if not config.option.appliances and (config.option.use_sprout and
                                         config.option.sprout_appliances == 1):
        terminal = reporter()
        sprout = SproutClient.from_config()
        terminal.write("Requesting a single appliance from sprout...\n")
        pool_id = sprout.request_appliances(
            config.option.sprout_group,
            count=config.option.sprout_appliances,
            version=config.option.sprout_version,
            date=config.option.sprout_date,
            lease_time=config.option.sprout_timeout)
        terminal.write(
            "Appliance pool {}. Waiting for fulfillment ...\n".format(pool_id))
        at_exit(destroy_the_pool)
        if config.option.sprout_desc is not None:
            sprout.set_pool_description(pool_id,
                                        str(config.option.sprout_desc))
        try:
            result = wait_for(
                lambda: sprout.request_check(pool_id)["fulfilled"],
                num_sec=config.option.sprout_provision_timeout * 60,
                delay=5,
                message="requesting appliance was fulfilled")
        except:
            pool = sprout.request_check(pool_id)
            dump_pool_info(lambda x: terminal.write("{}\n".format(x)), pool)
            terminal.write("Destroying the pool on error.\n")
            sprout.destroy_pool(pool_id)
            raise
        terminal.write("Provisioning took {0:.1f} seconds\n".format(
            result.duration))
        request = sprout.request_check(pool_id)
        ip_address = request["appliances"][0]["ip_address"]
        terminal.write(
            "Appliance requested at address {} ...\n".format(ip_address))
        reset_timer(sprout, pool_id, config.option.sprout_timeout)
        terminal.write("Appliance lease timer is running ...\n")
        appliance = IPAppliance(address=ip_address)
        appliance.push()
        # Retrieve and print the template_name for Jenkins to pick up
        template_name = request["appliances"][0]["template_name"]
        conf.runtime["cfme_data"]["basic_info"][
            "appliance_template"] = template_name
        terminal.write("appliance_template=\"{}\";\n".format(template_name))
        with project_path.join('.appliance_template').open(
                'w') as template_file:
            template_file.write(
                'export appliance_template="{}"'.format(template_name))
        terminal.write("Single appliance Sprout setup finished.\n")
        # And set also the appliances_provider
        provider = request["appliances"][0]["provider"]
        terminal.write("appliance_provider=\"{}\";\n".format(provider))
        conf.runtime["cfme_data"]["basic_info"][
            "appliances_provider"] = provider
    yield
Exemple #13
0
def pytest_sessionstart(session):
    config = session.config
    # Just to print out the appliance's streams
    from fixtures.terminalreporter import reporter
    holder = config.pluginmanager.getplugin('appliance-holder')

    reporter(config).write("\nAppliance's streams: [{}]\n".format(", ".join(
        get_streams_id(holder.held_appliance))))
    # Bail out if the appliance stream or version do not match
    check_stream = config.getvalue("check_stream").lower().strip()
    if check_stream:
        holder = config.pluginmanager.get_plugin("appliance-holder")
        curr = holder.held_appliance.version.stream()
        if check_stream != curr:
            raise Exception(
                "Stream mismatch - wanted {} but appliance is {}".format(
                    check_stream, curr))
def pytest_sessionstart(session):
    config = session.config
    # Just to print out the appliance's streams
    from fixtures.terminalreporter import reporter
    holder = config.pluginmanager.getplugin('appliance-holder')

    reporter(config).write(
        "\nAppliance's streams: [{}]\n".format(
            ", ".join(get_streams_id(holder.held_appliance))))
    # Bail out if the appliance stream or version do not match
    check_stream = config.getvalue("check_stream").lower().strip()
    if check_stream:
        holder = config.pluginmanager.get_plugin("appliance-holder")
        curr = holder.held_appliance.version.stream()
        if check_stream != curr:
            raise Exception(
                "Stream mismatch - wanted {} but appliance is {}".format(
                    check_stream, curr))
Exemple #15
0
 def __init__(self, config):
     self.config = config
     self.shuttingdown = False
     self.countfailures = 0
     self.log = create_sublogger('dsession')
     self.maxfail = config.getvalue("maxfail")
     self.queue = queue.Queue()
     self._failed_collection_errors = {}
     self.terminal = reporter()
     self.trdist = TerminalDistReporter(config)
     config.pluginmanager.register(self.trdist, "terminaldistreporter")
def pytest_configure(config):
    global appliance
    global pool_id
    global sprout
    yield
    if not config.option.appliances and (config.option.use_sprout
            and config.option.sprout_appliances == 1):
        terminal = reporter()
        sprout = SproutClient.from_config()
        terminal.write("Requesting single appliance from sprout...\n")
        pool_id = sprout.request_appliances(
            config.option.sprout_group,
            count=config.option.sprout_appliances,
            version=config.option.sprout_version,
            date=config.option.sprout_date,
            lease_time=config.option.sprout_timeout
        )
        terminal.write("Appliance pool {}. Waiting for fulfillment ...\n".format(pool_id))
        at_exit(destroy_the_pool)
        if config.option.sprout_desc is not None:
            sprout.set_pool_description(pool_id, str(config.option.sprout_desc))
        try:
            result = wait_for(
                lambda: sprout.request_check(pool_id)["fulfilled"],
                num_sec=config.option.sprout_provision_timeout * 60,
                delay=5,
                message="requesting appliance was fulfilled"
            )
        except:
            pool = sprout.request_check(pool_id)
            dump_pool_info(lambda x: terminal.write("{}\n".format(x)), pool)
            terminal.write("Destroying the pool on error.\n")
            sprout.destroy_pool(pool_id)
            raise
        terminal.write("Provisioning took {0:.1f} seconds\n".format(result.duration))
        request = sprout.request_check(pool_id)
        ip_address = request["appliances"][0]["ip_address"]
        terminal.write("Appliance requested at address {} ...\n".format(ip_address))
        reset_timer(sprout, pool_id, config.option.sprout_timeout)
        terminal.write("Appliance lease timer is running ...\n")
        appliance = IPAppliance(address=ip_address)
        # Retrieve and print the template_name for Jenkins to pick up
        template_name = request["appliances"][0]["template_name"]
        conf.runtime["cfme_data"]["basic_info"]["appliance_template"] = template_name
        terminal.write("appliance_template=\"{}\";\n".format(template_name))
        with project_path.join('.appliance_template').open('w') as template_file:
            template_file.write('export appliance_template="{}"'.format(template_name))
        terminal.write("Single appliance Sprout setup finished.\n")
        # And set also the appliances_provider
        provider = request["appliances"][0]["provider"]
        terminal.write("appliance_provider=\"{}\";\n".format(provider))
        conf.runtime["cfme_data"]["basic_info"]["appliances_provider"] = provider
def destroy_the_pool():
    global sprout
    global pool_id
    terminal = reporter()
    if sprout is not None and pool_id is not None and sprout.pool_exists(pool_id):
        terminal.write("Destroying pool {}\n".format(pool_id))
        try:
            sprout.destroy_pool(pool_id)
            wait_for(lambda: not sprout.pool_exists(pool_id), num_sec=300, delay=10)
        except Exception as e:
            terminal.write("Exception raised: {} - {}\n".format(type(e).__name__, str(e)))
        sprout = None
        pool_id = None
def pytest_collection_modifyitems(session, config, items):
    len_collected = len(items)
    items[:] = filter(lambda item: not item.get_marker('uncollect'), items)
    len_filtered = len(items)
    filtered_count = len_collected - len_filtered
    if filtered_count:
        # A warning should go into log/cfme.log when a test has this mark applied.
        # It might be good to write uncollected test names out via terminalreporter,
        # but I suspect it would be extremely spammy. It might be useful in the
        # --collect-only output?
        terminalreporter = reporter(config)
        terminalreporter.write('collected %d items' % len_filtered, bold=True)
        terminalreporter.write(' (uncollected %d items)\n' % filtered_count)
Exemple #19
0
    def pytest_unconfigure(self, config):
        """ Collect and clean up the testing.

        If the event testing is active, collects results, stops the listener
        and generates the report.
        """
        if config.getoption("event_testing_enabled"):
            # Collect results
            try:
                # Report to the terminal
                termreporter = reporter(config)
                termreporter.write_sep('-', 'Stopping event listener')
            finally:
                self.stop()
Exemple #20
0
def pytest_collection_modifyitems(session, config, items):
    if not config.getvalue("bugzilla"):
        return
    loose = cfme_data.get("bugzilla", {}).get("loose", [])

    if isinstance(loose, basestring):
        loose = [i.strip() for i in loose.strip().split(",")]

    terminalreporter = reporter(config)
    terminalreporter.write("\nChecking bugs in Bugzilla...\n")
    bugz = _bz.Bugzilla(
        url=config.getvalue("bugzilla_url"),
        user=config.getvalue("bugzilla_user"),
        password=config.getvalue("bugzilla_password"),
        cookiefile=None, tokenfile=None)
    progress = ("-", "\\", "|", "/")  # Very simple eye-candy to not pollute tests output
    progressbar = 0
    last_line_length = 0

    try:
        for item in filter(lambda item: item.get_marker("bugzilla") is not None, items):
            marker = item.get_marker("bugzilla")
            item._bugzilla = bugz
            terminalreporter.write("\r{}".format(last_line_length * " "))
            terminalreporter.write("\r{}: {}".format(progress[progressbar], item.name))
            progressbar = (progressbar + 1) % len(progress)
            last_line_length = 3 + len(item.name)
            item._bugzilla_bugs = resolve_bugs(bugz, loose, *marker.args)
            item._skip_func = kwargify(marker.kwargs.get("skip_when", None))
            item._xfail_func = kwargify(marker.kwargs.get("xfail_when", None))
            item._unskip_dict = {}
            for bug_id, function in marker.kwargs.get("unskip", {}).iteritems():
                item._unskip_dict[bug_id] = kwargify(function)
        terminalreporter.write("\r{} bugs retrieved\n".format(len(_bugs_cache)))
        terminalreporter.write("All bugs summary:\n")
        for bug_id, bug in _bugs_cache.iteritems():
            terminalreporter.write("#{} {} {}\n".format(bug_id, bug.status, bug.summary))
    except xmlrpclib.Fault as exception:
        # It can happen that the user account does not have required rights.
        if exception.faultCode == 102:
            terminalreporter.write("\n\n======= !!!BAILING OUT. NOT ENOUGH RIGHTS!!! =======\n")
            # remove any possible bugzilla markings in the test items so that does not get tested
            for item in filter(lambda item: item.get_marker("bugzilla") is not None, items):
                if hasattr(item, "_bugzilla"):
                    delattr(item, "_bugzilla")
                if hasattr(item, "_bugzilla_bugs"):
                    delattr(item, "_bugzilla_bugs")
            terminalreporter.write("======= !!!BUGZILLA INTEGRATION DISABLED!!! =======\n")
def pytest_sessionfinish(session, exitstatus):
    global appliance
    global timer
    global pool_id
    global sprout
    yield
    terminal = reporter()
    if timer is not None:
        terminal.write("Stopping timer\n")
        timer.cancel()
        timer = None
    if appliance is not None:
        terminal.write("Popping out the appliance\n")
        appliance.pop()
        appliance = None
    destroy_the_pool()
def pytest_sessionfinish(session, exitstatus):
    global appliance
    global timer
    global pool_id
    global sprout
    yield
    terminal = reporter()
    if timer is not None:
        terminal.write("Stopping timer\n")
        timer.cancel()
        timer = None
    if appliance is not None:
        terminal.write("Popping out the appliance\n")
        appliance.pop()
        appliance = None
    destroy_the_pool()
Exemple #23
0
def pytest_collection_modifyitems(session, config, items):
    if not config.getvalue("bugzilla"):
        return
    loose = cfme_data.get("bugzilla", {}).get("loose", [])

    if isinstance(loose, basestring):
        loose = [i.strip() for i in loose.strip().split(",")]

    terminalreporter = reporter(config)
    terminalreporter.write("\nChecking bugs in Bugzilla...\n")
    bugz = _bz.Bugzilla(
        url=config.getvalue("bugzilla_url"),
        user=config.getvalue("bugzilla_user"),
        password=config.getvalue("bugzilla_password"))
    progress = ("-", "\\", "|", "/")  # Very simple eye-candy to not pollute tests output
    progressbar = 0
    last_line_length = 0

    try:
        for item in filter(lambda item: item.get_marker("bugzilla") is not None, items):
            marker = item.get_marker("bugzilla")
            item._bugzilla = bugz
            terminalreporter.write("\r{}".format(last_line_length * " "))
            terminalreporter.write("\r{}: {}".format(progress[progressbar], item.name))
            progressbar = (progressbar + 1) % len(progress)
            last_line_length = 3 + len(item.name)
            item._bugzilla_bugs = resolve_bugs(bugz, loose, *marker.args)
            item._skip_func = kwargify(marker.kwargs.get("skip_when", None))
            item._xfail_func = kwargify(marker.kwargs.get("xfail_when", None))
            item._unskip_dict = {}
            for bug_id, function in marker.kwargs.get("unskip", {}).iteritems():
                item._unskip_dict[bug_id] = kwargify(function)
        terminalreporter.write("\r{} bugs retrieved\n".format(len(_bugs_cache)))
        terminalreporter.write("All bugs summary:\n")
        for bug_id, bug in _bugs_cache.iteritems():
            terminalreporter.write("#{} {} {}\n".format(bug_id, bug.status, bug.summary))
    except xmlrpclib.Fault as exception:
        # It can happen that the user account does not have required rights.
        if exception.faultCode == 102:
            terminalreporter.write("\n\n======= !!!BAILING OUT. NOT ENOUGH RIGHTS!!! =======\n")
            # remove any possible bugzilla markings in the test items so that does not get tested
            for item in filter(lambda item: item.get_marker("bugzilla") is not None, items):
                if hasattr(item, "_bugzilla"):
                    delattr(item, "_bugzilla")
                if hasattr(item, "_bugzilla_bugs"):
                    delattr(item, "_bugzilla_bugs")
            terminalreporter.write("======= !!!BUGZILLA INTEGRATION DISABLED!!! =======\n")
def destroy_the_pool():
    global sprout
    global pool_id
    terminal = reporter()
    if sprout is not None and pool_id is not None and sprout.pool_exists(
            pool_id):
        terminal.write("Destroying pool {}\n".format(pool_id))
        try:
            sprout.destroy_pool(pool_id)
            wait_for(lambda: not sprout.pool_exists(pool_id),
                     num_sec=300,
                     delay=10)
        except Exception as e:
            terminal.write("Exception raised: {} - {}\n".format(
                type(e).__name__, str(e)))
        sprout = None
        pool_id = None
def pytest_configure(config):
    """Configures the parallel session, then fires pytest_parallel_configured."""
    reporter = terminalreporter.reporter()
    holder = config.pluginmanager.get_plugin("appliance-holder")

    appliances = holder.appliances

    if len(appliances) > 1:
        session = ParallelSession(config, appliances)
        config.pluginmanager.register(session, "parallel_session")
        store.parallelizer_role = 'master'
        reporter.write_line(
            'As a parallelizer master kicking off parallel session for these {} appliances'.format(
                len(appliances)),
            green=True)
        config.hook.pytest_parallel_configured(parallel_session=session)
    else:
        reporter.write_line('No parallelization required', green=True)
        config.hook.pytest_parallel_configured(parallel_session=None)
Exemple #26
0
def pytest_configure(config):
    """Configures the parallel session, then fires pytest_parallel_configured."""
    reporter = terminalreporter.reporter()
    holder = config.pluginmanager.get_plugin("appliance-holder")

    appliances = holder.appliances

    if len(appliances) > 1:
        session = ParallelSession(config, appliances)
        config.pluginmanager.register(session, "parallel_session")
        store.parallelizer_role = 'master'
        reporter.write_line(
            'As a parallelizer master kicking off parallel session for these {} appliances'
            .format(len(appliances)),
            green=True)
        config.hook.pytest_parallel_configured(parallel_session=session)
    else:
        reporter.write_line('No parallelization required', green=True)
        config.hook.pytest_parallel_configured(parallel_session=None)
Exemple #27
0
 def pytest_sessionstart(self, session):
     # If reporter() gave us a fake terminal reporter in __init__, the real
     # terminal reporter is registered by now
     self.terminal = reporter()
     self.nodemanager = NodeManager(self.config)
     self.nodemanager.setup_nodes(putevent=self.queue.put)
Exemple #28
0
def pytest_configure(config):
    smoke_tests = SmokeTests(reporter(config))
    config.pluginmanager.register(smoke_tests, 'smoke_tests')
    config.addinivalue_line('markers', __doc__.splitlines()[0])
Exemple #29
0
 def __init__(self, config):
     self.config = config
     self.tr = reporter(config)
     self._status = {}
     self._lastlen = 0
Exemple #30
0
def pytest_configure(config):
    yield
    smoke_tests = SmokeTests(reporter(config))
    config.pluginmanager.register(smoke_tests, 'smoke_tests')
    config.addinivalue_line('markers', __doc__.splitlines()[0])