def test_activity_on_repository_author_count(): repo = PATH_TO_RESOURCES + "repo" if not os.listdir(repo): raise Exception("Empty git submodule. Try: git submodule update --init") data = parse_repositories(repo) a = activity(data, "id", "author_name", "date") assert len(a.authors) == 36
def test_teamsize_on_repository_row_count(): repo = PATH_TO_RESOURCES + "repo" if not os.listdir(repo): raise Exception("Empty git submodule. Try: git submodule update --init") data = parse_repositories(repo, end_date="2019-08-12") a = teamsize(data, "id", "author_name", "date") assert len(a.dataframe.index) == 73
def test_activity_on_repository_cols(): repo = PATH_TO_RESOURCES + "repo" if not os.listdir(repo): raise Exception("Empty git submodule. Try: git submodule update --init") data = parse_repositories(repo) a = activity(data, "id", "author_name", "date") assert a.dataframe.columns.tolist() == ["name", "date", "count", "week_name"]
def test_network_return_type(): repo = PATH_TO_RESOURCES + "repo" if not os.listdir(repo): raise Exception( "Empty git submodule. Try: git submodule update --init") data = parse_repositories(repo) assert isinstance(network(data, "author_name", "files"), Network)
def test_repo_activity_display(): repo = PATH_TO_RESOURCES + "repo" if not os.listdir(repo): raise Exception("Empty git submodule. Try: git submodule update --init") data = parse_repositories(repo) a = activity(data, "id", "author_name", "date") display(a, show_plots=False) assert True
def test_network_on_repository_row_count(): repo = PATH_TO_RESOURCES + "repo" if not os.listdir(repo): raise Exception( "Empty git submodule. Try: git submodule update --init") data = parse_repositories(repo) a = network(data, "author_name", "files") assert len(a.dataframe.index) == 36
def test_network_on_repository_cols(): repo = PATH_TO_RESOURCES + "repo" if not os.listdir(repo): raise Exception( "Empty git submodule. Try: git submodule update --init") data = parse_repositories(repo) a = network(data, "author_name", "files") assert a.dataframe.columns.tolist() == ["centrality"]
def test_centrality_on_repository_no_author(): repo = PATH_TO_RESOURCES + "repo" if not os.listdir(repo): raise Exception( "Empty git submodule. Try: git submodule update --init") data = parse_repositories(repo) assert isinstance(centrality(data, "id", "author_name", "date", "files"), list)
def test_display_multiple_types(): data = parse_issues(PATH_TO_RESOURCES + "issues.json") a = centrality(data, "id", "author", "created_at", "discussion", name="mixih") data = parse_issues(PATH_TO_RESOURCES + "issues.json") b = response(data, "id", "author", "created_at", "discussion") data = parse_repositories(PATH_TO_RESOURCES + "repo") c = network(data, "author_name", "files") display([a, b, c], show_plots=False) assert True
def test_network_display_multiple_dfs(): repo = parse_repositories(PATH_TO_RESOURCES + "repo") repo_a = network(repo, "author_name", "files") mail = parse_mail(PATH_TO_RESOURCES + "mailinglist.mbox") mail_a = network(mail, "sender_name", "references", "message_id") issues = parse_issues(PATH_TO_RESOURCES + "issues.json") issues_a = network(issues, "author", "discussion") display([repo_a, mail_a, issues_a], show_plots=False) assert True
def test_activity_display_multiple_dfs(): repo = parse_repositories(PATH_TO_RESOURCES + "repo") mail = parse_mail(PATH_TO_RESOURCES + "mailinglist.mbox") issues = parse_issues(PATH_TO_RESOURCES + "issues.json") comm = parse_comments(issues) repo_a = activity(repo, "id", "author_name", "date") mail_a = activity(mail, "message_id", "sender_name", "date") issues_a = activity(issues.merge(comm, how="outer"), "id", "author", "created_at") display([repo_a, mail_a, issues_a], show_plots=False) assert True
def test_centrality_on_repository_size_df_cols(): repo = PATH_TO_RESOURCES + "repo" if not os.listdir(repo): raise Exception( "Empty git submodule. Try: git submodule update --init") data = parse_repositories(repo) a = centrality(data, "id", "author_name", "date", "files", name="Alex Merry") assert a.size.columns.tolist() == ["date", "value"]
def test_centrality_on_repository_activity_df_row_count(): repo = PATH_TO_RESOURCES + "repo" if not os.listdir(repo): raise Exception( "Empty git submodule. Try: git submodule update --init") data = parse_repositories(repo) a = centrality(data, "id", "author_name", "date", "files", name="Alex Merry") assert len(a.activity.index) == 48
def test_centrality_return_type(): repo = PATH_TO_RESOURCES + "repo" if not os.listdir(repo): raise Exception( "Empty git submodule. Try: git submodule update --init") data = parse_repositories(repo) assert isinstance( centrality(data, "id", "author_name", "date", "files", name="Alex Merry"), Centrality)
def test_teamsize_on_repository_cols(): repo = PATH_TO_RESOURCES + "repo" if not os.listdir(repo): raise Exception("Empty git submodule. Try: git submodule update --init") data = parse_repositories(repo) a = teamsize(data, "id", "author_name", "date") assert a.dataframe.columns.tolist() == [ "date", "entry_count", "author_count", "entry_count_lowess", "author_count_lowess", ]
def test_display_multiple_types_with_multiple_dfs(): data = parse_issues(PATH_TO_RESOURCES + "issues.json") a = centrality(data, "id", "author", "created_at", "discussion", name="mixih") b = centrality( parse_issues(PATH_TO_RESOURCES + "issues2.json"), "id", "author", "created_at", "discussion", name="asu" ) path = PATH_TO_RESOURCES + "repo" if not os.listdir(path): raise Exception("Empty git submodule. Try: git submodule update --init") repo = parse_repositories(path) c = network(repo, "author_name", "files") mail = parse_mail(PATH_TO_RESOURCES + "mailinglist.mbox") d = network(mail, "sender_name", "references", "message_id") issues = parse_issues(PATH_TO_RESOURCES + "issues.json") e = network(issues, "author", "discussion") issues = parse_issues(PATH_TO_RESOURCES + "issues.json") comm = parse_comments(issues) data = issues.merge(comm, how="outer") f = teamsize(data, "id", "author", "created_at") g = teamsize(parse_issues(PATH_TO_RESOURCES + "issues2.json"), "id", "author", "created_at") display([a, b, c, d, e, f, g], show_plots=False) assert True
def test_teamsize_return_type(): repo = PATH_TO_RESOURCES + "repo" if not os.listdir(repo): raise Exception("Empty git submodule. Try: git submodule update --init") data = parse_repositories(repo) assert isinstance(teamsize(data, "id", "author_name", "date"), TeamSize)
def test_parse_repositories_dataframe_output(): repo = PATH_TO_RESOURCES + "repo" if not os.listdir(repo): raise Exception("Empty git submodule. Try: git submodule update --init") df = parse_repositories(repo) assert isinstance(df, type(DataFrame()))
# Fetching arguments from command line arg_parser = ArgumentParser( description="A tool for visualizing, week by week, who contributes code" ) arg_parser.add_argument( "paths", metavar="path", nargs="+", help= "Path of a git repository to process or of a directory containing git repositories", ) arg_parser.add_argument("-f", "--start", help="Start date") arg_parser.add_argument("-u", "--end", help="End date") arg_parser.add_argument("--palette", choices=["blue4", "magma256"], default="magma256", help="Choose a palette (default is magma256)") arg_parser.add_argument("-t", "--title", help="Title") arg_parser.add_argument("-o", "--output", default="result.html", help="Output file (default is 'result.html')") args = arg_parser.parse_args() start_date = args.start end_date = args.end data = cd.parse_repositories(args.paths, start_date, end_date) a = cd.activity(data, "id", "author_name", "date") cd.display(a, palette=args.palette, output=args.output)