Beispiel #1
0
class ContestTests(TestCase):
    def setUp(self):
        players = [
            Player('player1', {}),
            Player('player2', {}),
        ]
        self.contest = Contest(players, [])

    def test_update(self):
        mock_achievement = Mock()
        mock_achievement.points_value = 2
        def mock_trial(contest):
            for player in contest.players:
                player.achievements.append(mock_achievement)
        self.contest.trials.append(mock_trial)
        self.contest.run_trials()

        self.assertEquals(2, self.contest.players[0].current_score)
Beispiel #2
0
from datetime import datetime

from devrace.git_trial import PullRequestTrial, _reset_trial
from devrace.contest import Contest, Player
from devrace.scoreboard import PeggyScoreboard, PrintingScoreboard

if __name__ == "__main__":
    _reset_trial()

    players = [
        Player("christy", {"github_login": "******"}),
        Player("colin", {"github_login": "******"}),
        Player("gareth", {"github_login": "******"}),
        Player("gehan", {"github_login": "******"}),
        Player("henrique", {"github_login": "******"}),
        Player("james", {"github_login": "******"}),
    ]
    trials = [PullRequestTrial("conversocial", "conversocial")]
    contest = Contest(players, trials)
    try:
        scoreboard = PeggyScoreboard()
    except SerialException:
        scoreboard = PrintingScoreboard()

    while True:
        contest.run_trials()
        for player in players:
            print player.name, ":", len(player.achievements)
        scoreboard.update_scores(contest)
        sleep(10)