def pytest_runtest_logreport(report): # e.g. test_tracking['test_name']['setup'] = 'passed' # test_tracking['test_name']['call'] = 'skipped' # test_tracking['test_name']['teardown'] = 'failed' yield test_tracking[_format_nodeid(report.nodeid, False)][report.when] = report.outcome if report.when == 'teardown': path, lineno, domaininfo = report.location test_status = _test_status(_format_nodeid(report.nodeid, False)) if test_status == "failed": try: logger().info( "Managed providers: {}".format( ", ".join([ prov.key for prov in pytest.store.current_appliance.managed_providers])) ) except KeyError as ex: if 'ext_management_systems' in ex.msg: logger().warning("Unable to query ext_management_systems table; DB issue") else: raise logger().info(log.format_marker('{} result: {}'.format(_format_nodeid(report.nodeid), test_status)), extra={'source_file': path, 'source_lineno': lineno}) if report.outcome == "skipped": # Usualy longrepr's a tuple, other times it isn't... :( try: longrepr = report.longrepr[-1] except AttributeError: longrepr = str(report.longrepr) logger().info(log.format_marker(longrepr))
def pytest_runtest_logreport(report): # e.g. test_tracking['test_name']['setup'] = 'passed' # test_tracking['test_name']['call'] = 'skipped' # test_tracking['test_name']['teardown'] = 'failed' yield test_tracking[_format_nodeid(report.nodeid, False)][report.when] = report.outcome if report.when == 'teardown': path, lineno, domaininfo = report.location test_status = _test_status(_format_nodeid(report.nodeid, False)) if test_status == "failed": try: logger().info("Managed providers: {}".format(", ".join( pytest.store.current_appliance.managed_providers))) except KeyError as ex: if 'ext_management_systems' in ex.msg: logger().warning( "Unable to query ext_management_systems table; DB issue" ) else: raise logger().info(log.format_marker('{} result: {}'.format( _format_nodeid(report.nodeid), test_status)), extra={ 'source_file': path, 'source_lineno': lineno }) if report.outcome == "skipped": # Usualy longrepr's a tuple, other times it isn't... :( try: longrepr = report.longrepr[-1] except AttributeError: longrepr = str(report.longrepr) logger().info(log.format_marker(longrepr))
def pytest_runtest_logreport(report): # e.g. test_tracking['test_name']['setup'] = 'passed' # test_tracking['test_name']['call'] = 'skipped' # test_tracking['test_name']['teardown'] = 'failed' yield test_tracking[_format_nodeid(report.nodeid, False)][report.when] = report.outcome if report.when == 'teardown': path, lineno, domaininfo = report.location logger().info(log.format_marker( '%s result: %s' % (_format_nodeid(report.nodeid), _test_status(_format_nodeid(report.nodeid, False)))), extra={ 'source_file': path, 'source_lineno': lineno }) if report.outcome == "skipped": # Usualy longrepr's a tuple, other times it isn't... :( try: longrepr = report.longrepr[-1] except AttributeError: longrepr = str(report.longrepr) logger().info(log.format_marker(longrepr))
def pytest_sessionfinish(session, exitstatus): c = collections.Counter() for test in test_tracking: c[_test_status(test)] += 1 # Prepend a total to the summary list results = ["total: {}".format(sum(c.values()))] + map(lambda n: "{}: {}".format(n[0], n[1]), c.items()) # Then join it with commas summary = ", ".join(results) logger().info(log.format_marker("Finished test run", mark="=")) logger().info(log.format_marker(str(summary), mark="="))
def pytest_sessionfinish(session, exitstatus): c = collections.Counter() for test in test_tracking: c[_test_status(test)] += 1 # Prepend a total to the summary list results = ['total: %d' % sum(c.values())] + map(lambda n: '%s: %d' % (n[0], n[1]), c.items()) # Then join it with commas summary = ', '.join(results) cfme_logger.info(format_marker('Finished test run', mark='=')) cfme_logger.info(format_marker(str(summary), mark='='))
def pytest_sessionfinish(session, exitstatus): c = collections.Counter() for test in test_tracking: c[_test_status(test)] += 1 # Prepend a total to the summary list results = ['total: %d' % sum(c.values())] + map(lambda n: '%s: %d' % (n[0], n[1]), c.items()) # Then join it with commas summary = ', '.join(results) logger().info(log.format_marker('Finished test run', mark='=')) logger().info(log.format_marker(str(summary), mark='='))
def pytest_runtest_setup(item): path, lineno, domaininfo = item.location cfme_logger.info(format_marker(_format_nodeid(item.nodeid), mark="-"), extra={ 'source_file': path, 'source_lineno': lineno })
def pytest_sessionfinish(session, exitstatus): c = collections.Counter() for test in test_tracking: c[_test_status(test)] += 1 # Prepend a total to the summary list results = ['total: {}'.format(sum(c.values()))] + map( lambda n: '{}: {}'.format(n[0], n[1]), c.items()) # Then join it with commas summary = ', '.join(results) logger().info(log.format_marker('Finished test run', mark='=')) logger().info(log.format_marker(str(summary), mark='=')) for session in ssh._client_session: try: session.close() except: pass
def pytest_runtest_logreport(report): yield test_tracking[_format_nodeid(report.nodeid, False)][report.when] = report.outcome if report.when == 'teardown': path, lineno, domaininfo = report.location test_status = _test_status(_format_nodeid(report.nodeid, False)) logger().info(log.format_marker('{} result: {}'.format(_format_nodeid(report.nodeid), test_status)), extra={'source_file': path, 'source_lineno': lineno}) if report.outcome == "skipped": # Usualy longrepr's a tuple, other times it isn't... :( try: longrepr = report.longrepr[-1] except AttributeError: longrepr = str(report.longrepr) logger().info(log.format_marker(longrepr))
def pytest_runtest_logreport(report): # e.g. test_tracking['test_name']['setup'] = 'passed' # test_tracking['test_name']['call'] = 'skipped' # test_tracking['test_name']['teardown'] = 'failed' yield test_tracking[_format_nodeid(report.nodeid, False)][report.when] = report.outcome if report.when == 'teardown': path, lineno, domaininfo = report.location logger().info(log.format_marker('%s result: %s' % (_format_nodeid(report.nodeid), _test_status(_format_nodeid(report.nodeid, False)))), extra={'source_file': path, 'source_lineno': lineno}) if report.outcome == "skipped": # Usualy longrepr's a tuple, other times it isn't... :( try: longrepr = report.longrepr[-1] except AttributeError: longrepr = str(report.longrepr) logger().info(log.format_marker(longrepr))
def pytest_runtest_logreport(report): # e.g. test_tracking['test_name']['setup'] = 'passed' # test_tracking['test_name']['call'] = 'skipped' # test_tracking['test_name']['teardown'] = 'failed' test_tracking[_format_nodeid(report.nodeid, False)][report.when] = report.outcome if report.when == 'teardown': path, lineno, domaininfo = report.location cfme_logger.info(format_marker('%s result: %s' % (_format_nodeid(report.nodeid), _test_status(_format_nodeid(report.nodeid, False)))), extra={'source_file': path, 'source_lineno': lineno})
def pytest_runtest_logreport(report): # e.g. test_tracking['test_name']['setup'] = 'passed' # test_tracking['test_name']['call'] = 'skipped' # test_tracking['test_name']['teardown'] = 'failed' test_tracking[_format_nodeid(report.nodeid, False)][report.when] = report.outcome if report.when == 'teardown': path, lineno, domaininfo = report.location cfme_logger.info(format_marker( '%s result: %s' % (_format_nodeid(report.nodeid), _test_status(_format_nodeid(report.nodeid, False)))), extra={ 'source_file': path, 'source_lineno': lineno })
def pytest_collection_modifyitems(session, config, items): logger().info(log.format_marker('Starting new test run', mark="=")) expression = config.getvalue('keyword') or False expr_string = ', will filter with "{}"'.format(expression) if expression else '' logger().info('Collected {} items{}'.format(len(items), expr_string))
def pytest_runtest_setup(item): path, lineno, domaininfo = item.location logger().info(log.format_marker(_format_nodeid(item.nodeid), mark="-"), extra={'source_file': path, 'source_lineno': lineno}) yield
def pytest_collection_modifyitems(session, config, items): cfme_logger.info(format_marker('Starting new test run', mark="=")) expression = config.getvalue('keyword') or False expr_string = ', will filter with "%s"' % expression if expression else '' cfme_logger.info('Collected %i items%s' % (len(items), expr_string))