コード例 #1
0
ファイル: qjrunner.py プロジェクト: haloz/qj
def main():
    """Orchestrate our toolbox to run the Jenkins analysis"""
    argvdict = _parse_arguments()
    qjinstance = QueryJenkins()

    buildlist = qjinstance.get_builds(
        argvdict["server"],
        argvdict["jobname"],
        NUMBER_OF_PAST_BUILDS)

    allentries = AllJenkinsDayEntries()

    for build in buildlist:
        dayentry = JenkinsDayEntry()
        dayentry.date = build.get_timestamp().date()
        dayentry.tickets = qjinstance.get_ticket_tumbers(build)
        allentries.add(dayentry)

    per_day_values = allentries.entries_with_empty_days()
    qjinstance.export_as_excel_file("buildtickets.xlsx", per_day_values)
コード例 #2
0
ファイル: dayentry_unit_test.py プロジェクト: haloz/qj
    def test_storing_entries(self):
        """Verify storing JenkinsDayEntry instances"""
        allentries = AllJenkinsDayEntries()
        dayentry = JenkinsDayEntry()
        dayentry.date = date(2016, 2, 8)
        dayentry.tickets = ["XY-123", "XY-124"]
        allentries.add(dayentry)

        dayentry = JenkinsDayEntry()
        dayentry.date = date(2016, 2, 5)
        dayentry.tickets = ["XY-111"]
        allentries.add(dayentry)

        dayentry = JenkinsDayEntry()
        dayentry.date = date(2016, 2, 9)
        dayentry.tickets = ["XY-222", "XY-333", "XY-444"]
        allentries.add(dayentry)

        self.assertEqual(allentries.get(date(2016, 2, 9)), dayentry)
        self.assertEqual(len(allentries.alldays()), 3)
        self.assertEqual(
            allentries.alldays_as_string(),
            ["2016.02.08", "2016.02.05", "2016.02.09"]
        )
コード例 #3
0
ファイル: dayentry_unit_test.py プロジェクト: haloz/qj
    def test_store_multiple_per_day(self):
        """Multiple entries for a day should be grouped in one entry"""
        allentries = AllJenkinsDayEntries()
        dayentry = JenkinsDayEntry()
        dayentry.date = date(2016, 2, 8)
        dayentry.tickets = ["XY-123", "XY-124"]
        allentries.add(dayentry)

        dayentry = JenkinsDayEntry()
        dayentry.date = date(2016, 2, 8)
        dayentry.tickets = ["XY-111"]
        allentries.add(dayentry)

        self.assertEqual(len(allentries.alldays()), 1)
        self.assertEqual(
            allentries.alldays_as_string(),
            ["2016.02.08"]
        )
        self.assertEqual(allentries.entries[0].num_tickets(), 3)
コード例 #4
0
ファイル: dayentry_unit_test.py プロジェクト: haloz/qj
    def test_entries_with_empty_days(self):
        """Test method to fill sparse data with zero values so that we have
           entries for each day, starting from today to the oldest entry"""
        allentries = AllJenkinsDayEntries()

        dayentry = JenkinsDayEntry()
        dayentry.date = date.today() - timedelta(days=3)
        dayentry.tickets = ["XY-123", "XY-124"]
        allentries.add(dayentry)

        dayentry = JenkinsDayEntry()
        dayentry.date = date.today() - timedelta(days=2)
        dayentry.tickets = ["XY-111"]
        allentries.add(dayentry)

        self.assertEqual(len(allentries.entries_with_empty_days()), 4)
        self.assertEqual(
            allentries.entries_with_empty_days()[0].date,
            date.today() - timedelta(days=3)
        )