Exemple #1
0
def __show_github_summary(config, session):
    """Generate a report that includes all linked GitHub issues, and their status."""
    # collect tests
    session.perform_collect()

    issue_cache = config.pluginmanager.get_plugin('github_helper')._issue_cache

    # For each item, collect github markers and a generic_path for the item.
    unresolved_issue_map = dict()
    resolved_issue_map = dict()
    for item in filter(lambda i: i.get_marker("github") is not None,
                       session.items):
        marker = item.get_marker('github')
        issue_urls = tuple(sorted(set(marker.args)))  # (O_O) for caching
        for issue_url in issue_urls:

            issue = issue_cache[issue_url]
            if not issue.is_resolved:
                if issue_url not in unresolved_issue_map:
                    unresolved_issue_map[issue_url] = list()
                unresolved_issue_map[issue_url].append(generic_path(item))
            if issue.is_resolved:
                if issue_url not in resolved_issue_map:
                    resolved_issue_map[issue_url] = list()
                resolved_issue_map[issue_url].append(generic_path(item))

    # Print a summary report
    reporter = config.pluginmanager.getplugin("terminalreporter")
    if reporter:
        reporter.section("github issue report")
        if unresolved_issue_map:
            reporter.write_line("Unresolved Issues", bold=True)
            for issue_url, gpaths in sorted(
                    unresolved_issue_map.items(),
                    key=lambda k: int(k[0].split('/')[-1])):
                reporter.write_line("{0}".format(issue_url), bold=True)
                for gpath in gpaths:
                    reporter.write_line(" - %s" % gpath)
        if resolved_issue_map:
            if unresolved_issue_map:
                reporter.write_line("")
            reporter.write_line("Resolved Issues", bold=True)
            for issue_url, gpaths in sorted(
                    resolved_issue_map.items(),
                    key=lambda k: int(k[0].split('/')[-1])):
                reporter.write_line("{0}".format(issue_url), bold=True)
                for gpath in gpaths:
                    reporter.write_line(" - %s" % gpath)
        if not unresolved_issue_map and not resolved_issue_map:
            reporter.write_line("No github issues collected")
def __show_github_summary(config, session):
    """Generate a report that includes all linked GitHub issues, and their status."""
    # collect tests
    session.perform_collect()

    # For each item, collect github markers and a generic_path for the item
    issue_map = dict()
    for item in filter(lambda i: i.get_marker("github") is not None, session.items):
        marker = item.get_marker('github')
        issue_urls = tuple(sorted(set(marker.args)))  # (O_O) for caching
        for issue_url in issue_urls:
            if issue_url not in issue_map:
                issue_map[issue_url] = list()
            issue_map[issue_url].append(generic_path(item))

    # Print a summary report
    reporter = config.pluginmanager.getplugin("terminalreporter")
    reporter.section("github issue report")
    if issue_map:
        for issue_url, gpaths in issue_map.items():
            # FIXME - display the status
            reporter.write_line("{0}".format(issue_url), bold=True)
            for gpath in gpaths:
                reporter.write_line(" - %s" % gpath)
    else:
        reporter.write_line("No github issues collected")
Exemple #3
0
def __show_trello_cards(config, session):
    '''Generate a report that includes all linked trello cards, and their status.'''
    session.perform_collect()
    curdir = py.path.local()

    trello_helper = config.pluginmanager.getplugin("trello_helper")

    card_cache = dict()
    for i, item in enumerate(filter(lambda i: i.get_marker("trello") is not None, session.items)):
        cards = item.funcargs.get('cards', [])
        for card in cards:
            if card not in card_cache:
                card_cache[card] = list()
            card_cache[card].append(generic_path(item))

    reporter = config.pluginmanager.getplugin("terminalreporter")
    reporter.section("trello card report")
    if card_cache:
        for card, gpaths in card_cache.items():
            reporter.write("{0} ".format(card.url), bold=True)
            reporter.write_line("[{0}] {1}".format(card.list.name, card.name))
            for gpath in gpaths:
                reporter.write_line(" * %s" % gpath)
    else:
        reporter.write_line("No trello cards collected")
def test_generic_path(testdir):
    from _pytest.main import Session
    config = testdir.parseconfig()
    session = Session(config)
    p1 = Node('a', config=config, session=session)
    #assert p1.fspath is None
    p2 = Node('B', parent=p1)
    p3 = Node('()', parent = p2)
    item = Item('c', parent = p3)

    res = generic_path(item)
    assert res == 'a.B().c'

    p0 = FSCollector('proj/test', config=config, session=session)
    p1 = FSCollector('proj/test/a', parent=p0)
    p2 = Node('B', parent=p1)
    p3 = Node('()', parent = p2)
    p4 = Node('c', parent=p3)
    item = Item('[1]', parent = p4)

    res = generic_path(item)
    assert res == 'test/a:B().c[1]'
Exemple #5
0
def test_generic_path(testdir):
    from _pytest.main import Session
    config = testdir.parseconfig()
    session = Session(config)
    p1 = Node('a', config=config, session=session)
    #assert p1.fspath is None
    p2 = Node('B', parent=p1)
    p3 = Node('()', parent = p2)
    item = Item('c', parent = p3)

    res = generic_path(item)
    assert res == 'a.B().c'

    p0 = FSCollector('proj/test', config=config, session=session)
    p1 = FSCollector('proj/test/a', parent=p0)
    p2 = Node('B', parent=p1)
    p3 = Node('()', parent = p2)
    p4 = Node('c', parent=p3)
    item = Item('[1]', parent = p4)

    res = generic_path(item)
    assert res == 'test/a:B().c[1]'
def test_generic_path(testdir):
    from _pytest.main import Session

    config = testdir.parseconfig()
    session = Session(config)
    p1 = Node("a", config=config, session=session, nodeid="a")
    # assert p1.fspath is None
    p2 = Node("B", parent=p1)
    p3 = Node("()", parent=p2)
    item = Item("c", parent=p3)

    res = generic_path(item)
    assert res == "a.B().c"

    p0 = FSCollector("proj/test", config=config, session=session)
    p1 = FSCollector("proj/test/a", parent=p0)
    p2 = Node("B", parent=p1)
    p3 = Node("()", parent=p2)
    p4 = Node("c", parent=p3)
    item = Item("[1]", parent=p4)

    res = generic_path(item)
    assert res == "test/a:B().c[1]"
Exemple #7
0
def test_generic_path(testdir):
    from _pytest.main import Session

    config = testdir.parseconfig()
    session = Session(config)
    p1 = Node("a", config=config, session=session, nodeid="a")
    # assert p1.fspath is None
    p2 = Node("B", parent=p1)
    p3 = Node("()", parent=p2)
    item = Item("c", parent=p3)

    res = generic_path(item)
    assert res == "a.B().c"

    p0 = FSCollector("proj/test", config=config, session=session)
    p1 = FSCollector("proj/test/a", parent=p0)
    p2 = Node("B", parent=p1)
    p3 = Node("()", parent=p2)
    p4 = Node("c", parent=p3)
    item = Item("[1]", parent=p4)

    res = generic_path(item)
    assert res == "test/a:B().c[1]"