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

mozilla / relman-auto-nag / #4609

pending completion
#4609

push

coveralls-python

web-flow
Update templates/file_crash_bug_description.md.jinja

Co-authored-by: Marco Castelluccio <mcastelluccio@mozilla.com>

646 of 3416 branches covered (18.91%)

1828 of 8481 relevant lines covered (21.55%)

0.22 hits per line

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

79.25
/bugbot/config.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 json
1✔
6
import os
1✔
7

8
from libmozdata import config
1✔
9

10

11
class MyConfig(config.Config):
1✔
12

13
    PATH = "configs/config.json"
1✔
14

15
    def __init__(self):
1✔
16
        super(MyConfig, self).__init__()
1✔
17
        if not os.path.exists(MyConfig.PATH):
1!
18
            self.conf = {"bz_api_key": "", "bz_api_key_nomail": "", "socorro_token": ""}
1✔
19
        else:
20
            with open(MyConfig.PATH) as In:
×
21
                self.conf = json.load(In)
×
22

23
        if "bz_api_key" not in self.conf:
1!
24
            raise Exception("Your config.json file must contain a Bugzilla token")
×
25

26
        if "bz_api_key_nomail" not in self.conf:
1!
27
            raise Exception(
×
28
                "Your config.json file must contain a Bugzilla token for an account that doesn't trigger bugmail (for testing, you can use the same token as bz_api_key)"
29
            )
30

31
        if "socorro_token" not in self.conf:
1!
32
            raise Exception("Your config.json file must contain a Socorro token")
×
33

34
    def get(self, section, option, default=None, type=str):
1✔
35
        if section == "Bugzilla":
1✔
36
            if option == "token":
1✔
37
                return self.conf["bz_api_key"]
1✔
38
            if option == "nomail-token":
1✔
39
                return self.conf["bz_api_key_nomail"]
1✔
40
        elif section == "Socorro":
1✔
41
            if option == "token":
1✔
42
                return self.conf["socorro_token"]
1✔
43
        elif section == "User-Agent":
1✔
44
            return "bugbot"
1✔
45
        return default
1✔
46

47

48
def load():
1✔
49
    config.set_config(MyConfig())
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