• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mozilla / relman-auto-nag / #5255

11 Oct 2024 03:14PM CUT coverage: 21.55% (-0.1%) from 21.646%
#5255

push

coveralls-python

jgraham
Add a rule to sync [webcompat:sightline] whiteboard entry

This should be set on all bugs that are part of the webcompat metrics
set, and by no bugs that aren't.

This initial approach just gets all the bugs that are either in that
set or have the whiteboard entry, and implements the logic to update
them in the client. Given that we expect initially to have ~700 bugs
in that set, this means we need to set the maximum number of bugs to
update to something rather high.

426 of 2886 branches covered (14.76%)

0 of 54 new or added lines in 3 files covered. (0.0%)

12 existing lines in 1 file now uncovered.

1941 of 9007 relevant lines covered (21.55%)

0.22 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/bugbot/multinaggers.py
1
# This Source Code Form is subject to the terms of the Mozilla Public
2
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
3
# You can obtain one at http://mozilla.org/MPL/2.0/.
4

5
import argparse
×
6
import time
×
7

8
from jinja2 import Environment, FileSystemLoader
×
9
from libmozdata import utils as lmdutils
×
10

11
from bugbot import mail, utils
×
12
from bugbot.bzcleaner import BzCleaner
×
13
from bugbot.nag_me import Nag
×
14

15

16
class MultiNaggers(object):
×
17
    def __init__(self, *args):
×
18
        super(MultiNaggers, self).__init__()
×
19
        for arg in args:
×
20
            assert isinstance(arg, Nag), "{} is not a Nag".format(type(arg))
×
21
            assert isinstance(arg, BzCleaner), "{} is not a BZCleaner".format(type(arg))
×
22
        self.naggers = list(args)
×
23
        self.is_dryrun = True
×
24

25
    def description(self):
×
26
        return ""
×
27

28
    def title(self):
×
29
        return ""
×
30

31
    def get_args_parser(self):
×
32
        """Get the arguments from the command line"""
33
        parser = argparse.ArgumentParser(description=self.description())
×
34
        parser.add_argument(
×
35
            "--production",
36
            dest="dryrun",
37
            action="store_false",
38
            help="If the flag is not passed, just do the query, and print emails to console without emailing anyone",
39
        )
40

41
        parser.add_argument(
×
42
            "-D",
43
            "--date",
44
            dest="date",
45
            action="store",
46
            default="today",
47
            help="Date for the query",
48
        )
49

50
        return parser
×
51

52
    def run(self):
×
53
        args = self.get_args_parser().parse_args()
×
54
        self.is_dryrun = args.dryrun
×
55
        self.date = lmdutils.get_date_ymd(args.date)
×
56
        for nagger in self.naggers:
×
57
            nagger.send_nag_mail = False
×
58
            nagger.run()
×
59
        self.gather()
×
60

61
    def gather(self):
×
62
        env = Environment(loader=FileSystemLoader("templates"))
×
63
        common = env.get_template("common.html")
×
64
        login_info = utils.get_login_info()
×
65
        From = Nag.get_from()
×
66
        Default_Cc = set(utils.get_config("bugbot", "cc", []))
×
67

68
        all_mails = {}
×
69
        for nagger in self.naggers:
×
70
            mails = nagger.prepare_mails()
×
71
            for m in mails:
×
72
                manager = m["manager"]
×
73
                if manager not in all_mails:
×
74
                    all_mails[manager] = {
×
75
                        "to": m["to"],
76
                        "management_chain": m["management_chain"],
77
                        "body": m["body"],
78
                    }
79
                else:
80
                    all_mails[manager]["to"] |= m["to"]
×
81
                    all_mails[manager]["management_chain"] |= m["management_chain"]
×
82
                    all_mails[manager]["body"] += "\n" + m["body"]
×
83

84
        for manager, m in all_mails.items():
×
85
            Cc = Default_Cc | m["management_chain"]
×
86
            Cc.add(manager)
×
87
            body = common.render(message=m["body"], has_table=True)
×
88
            mail.send(
×
89
                From,
90
                list(sorted(m["to"])),
91
                self.title(),
92
                body,
93
                Cc=list(sorted(Cc)),
94
                html=True,
95
                login=login_info,
96
                dryrun=self.is_dryrun,
97
            )
98
            time.sleep(1)
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc