def test_get_usertag_filters():
    """get_usertag should return only requested tags"""
    tags = bts.get_usertag("*****@*****.**")
    assert isinstance(tags, dict)
    randomKey0 = random.choice(list(tags.keys()))
    randomKey1 = random.choice(list(tags.keys()))

    filtered_tags = bts.get_usertag(
        "*****@*****.**", randomKey0, randomKey1)

    assert len(filtered_tags) == 2
    assert set(filtered_tags[randomKey0]) == set(tags[randomKey0])
    assert set(filtered_tags[randomKey1]) == set(tags[randomKey1])
def test_get_usertag_filters():
    """get_usertag should return only requested tags"""
    tags = bts.get_usertag("*****@*****.**")
    assert isinstance(tags, dict)
    randomKey0 = list(tags.keys())[0]
    randomKey1 = list(tags.keys())[1]

    filtered_tags = bts.get_usertag(
        "*****@*****.**", randomKey0, randomKey1)

    assert len(filtered_tags) == 2
    assert set(filtered_tags[randomKey0]) == set(tags[randomKey0])
    assert set(filtered_tags[randomKey1]) == set(tags[randomKey1])
Exemple #3
0
    def test_get_usertag_filters(self):
        """get_usertag should return only requested tags"""
        tags = bts.get_usertag("*****@*****.**")
        self.assertTrue(isinstance(tags, dict))
        randomKey0 = random.choice(list(tags.keys()))
        randomKey1 = random.choice(list(tags.keys()))

        filtered_tags = bts.get_usertag("*****@*****.**",
                                        randomKey0, randomKey1)

        self.assertEqual(len(filtered_tags), 2)
        self.assertEqual(set(filtered_tags[randomKey0]), set(tags[randomKey0]))
        self.assertEqual(set(filtered_tags[randomKey1]), set(tags[randomKey1]))
    def test_get_usertag_filters(self):
        """get_usertag should return only requested tags"""
        tags = bts.get_usertag("*****@*****.**")
        self.assertTrue(isinstance(tags, dict))
        randomKey0 = random.choice(list(tags.keys()))
        randomKey1 = random.choice(list(tags.keys()))

        filtered_tags = bts.get_usertag(
            "*****@*****.**", randomKey0, randomKey1)

        self.assertEqual(len(filtered_tags), 2)
        self.assertEqual(set(filtered_tags[randomKey0]),
                          set(tags[randomKey0]))
        self.assertEqual(set(filtered_tags[randomKey1]),
                          set(tags[randomKey1]))
 def testGetUsertag(self):
     """get_usertag should return dict with tag(s) and buglist(s)."""
     d = bts.get_usertag("*****@*****.**")
     self.assertEqual(type(d), type(dict()))
     for k, v in d.iteritems():
         self.assertEqual(type(""), type(k))
         self.assertEqual(type([]), type([]))
def test_get_usertag():
    """get_usertag should return dict with tag(s) and buglist(s)."""
    d = bts.get_usertag("*****@*****.**")
    assert isinstance(d, dict)
    for k, v in d.items():
        assert isinstance(k, str)
        assert isinstance(v, list)
        for bug in v:
            assert isinstance(bug, int)
def test_get_usertag():
    """get_usertag should return dict with tag(s) and buglist(s)."""
    d = bts.get_usertag("*****@*****.**")
    assert isinstance(d, dict)
    for k, v in d.items():
        assert is_unicode(k)
        assert isinstance(v, list)
        for bug in v:
            assert isinstance(bug, int)
Exemple #8
0
 def test_get_usertag(self):
     """get_usertag should return dict with tag(s) and buglist(s)."""
     d = bts.get_usertag("*****@*****.**")
     self.assertEqual(type(d), type(dict()))
     for k, v in d.items():
         self.assertEqual(type(""), type(k))
         self.assertEqual(type([]), type([]))
         for bug in v:
             self.assertEqual(type(bug), int)
Exemple #9
0
    def unclassified_bugs(self):
        """
        Returns a list of open bugs which have not yet been classified
        by one of our usertags.
        """

        tagged_bugs = bts.get_usertag('*****@*****.**')
        tagged_bugs_ftp = []
        for tags in tagged_bugs.keys():
            tagged_bugs_ftp += tagged_bugs[tags]

        return [bug for bug in bts.get_status(bts.get_bugs("package", "ftp.debian.org"))
                     if bug.pending == 'pending' and bug.bug_num not in tagged_bugs_ftp]
Exemple #10
0
def fetch_bugs(filepath, email, usertag):
    """Fetch the bugs from bts and save them in a pickle to don't have to query 
    bts again

    Return:
        list of debianbts.Bugreport items
    """
    bugnrlist = bts.get_usertag(email, usertag)
    bugs = bts.get_status(bugnrlist[usertag])
    with open(filepath,'w') as f:
        pickle.dump(bugs,f)
    print 'saved bts history to %s ' % filepath
    return bugs
Exemple #11
0
    def unclassified_bugs(self):
        """
        Returns a list of open bugs which have not yet been classified
        by one of our usertags.
        """

        tagged_bugs = bts.get_usertag('*****@*****.**')
        tagged_bugs_ftp = []
        for tags in tagged_bugs.keys():
            tagged_bugs_ftp += tagged_bugs[tags]

        return [bug for bug in bts.get_status(bts.get_bugs("package", "ftp.debian.org"))
                     if bug.pending == 'pending' and bug.bug_num not in tagged_bugs_ftp]
def test_get_usertag_args(caplog):
    # no tags
    tags = bts.get_usertag("*****@*****.**")
    assert len(tags) > 2

    randomKey0 = list(tags.keys())[0]
    randomKey1 = list(tags.keys())[1]

    # one tags
    tags = bts.get_usertag("*****@*****.**",
                           [randomKey0])
    assert len(tags) == 1

    # two tags
    tags = bts.get_usertag("*****@*****.**",
                           [randomKey0, randomKey1])
    assert len(tags) == 2

    # deprecated positional arguments
    tags = bts.get_usertag("*****@*****.**",
                           randomKey0, randomKey1)
    assert len(tags) == 2
    assert "deprecated" in caplog.text
def all_piuparts_bugs():
    global piuparts_usertags_cache
    if piuparts_usertags_cache is None:
        piuparts_usertags_cache = debianbts.get_usertag(
            "*****@*****.**", 'piuparts')['piuparts']
    return piuparts_usertags_cache
 def testGetUsertagEmpty(self):
     """get_usertag should return empty dict if no bugs are found."""
     d = bts.get_usertag("*****@*****.**")
     self.assertEqual(d, dict())
def test_get_usertag_empty():
    """get_usertag should return empty dict if no bugs are found."""
    d = bts.get_usertag("*****@*****.**")
    assert d == dict()
def test_get_usertag_empty():
    """get_usertag should return empty dict if no bugs are found."""
    d = bts.get_usertag("*****@*****.**")
    assert d == dict()
Exemple #17
0
            continue
        if ftpdo_bug.subject.startswith('RM'):
            m = FTPDORE.match(ftpdo_bug.subject)
            if m:
                src = m.group(1)
                ftpdo[src] = ftpdo_bug.bug_num
            else:
                log(f"Badly formatted ftp.debian.org bug: retitle {ftpdo_bug.bug_num} \"{ftpdo_bug.subject}\""
                    )

    log('Getting bugs tagged `py2removal`/`py2keep`...')
    if args.bugs:
        bugs_by_tag = args.bugs
        py2keep_bugs_by_tag = []
    else:
        bugs_by_tag = debianbts.get_usertag('*****@*****.**',
                                            'py2removal')['py2removal']
        py2keep_bugs_by_tag = debianbts.get_usertag(
            '*****@*****.**', 'py2keep')['py2keep']
    if args.limit:
        bugs_by_tag = bugs_by_tag[:args.limit]
        py2keep_bugs_by_tag = py2keep_bugs_by_tag[:args.limit]

    log(f"Found {len(bugs_by_tag)} `py2removal` bugs, getting status...")
    bugs = debianbts.get_status(bugs_by_tag)
    log(f"Found {len(py2keep_bugs_by_tag)} `py2keep` bugs, getting status...")
    py2keep_bugs = debianbts.get_status(py2keep_bugs_by_tag)

    for py2keep_bug in py2keep_bugs:
        if not py2keep_bug.done:
            log(f'{py2keep_bug.bug_num} "{py2keep_bug.subject}"')
 def all_piuparts_bugs(self):
     if self._bugs_usertagged_piuparts is None:
         self._bugs_usertagged_piuparts = debianbts.get_usertag(
             "*****@*****.**", 'piuparts')['piuparts']
     return self._bugs_usertagged_piuparts
Exemple #19
0
def all_piuparts_bugs():
    global piuparts_usertags_cache
    if piuparts_usertags_cache is None:
        piuparts_usertags_cache = debianbts.get_usertag("*****@*****.**", 'piuparts')['piuparts']
    return piuparts_usertags_cache
Exemple #20
0
 def test_get_usertag_empty(self):
     """get_usertag should return empty dict if no bugs are found."""
     d = bts.get_usertag("*****@*****.**")
     self.assertEqual(d, dict())
Exemple #21
0
def all_mia_teammaint_bugs():
    import debianbts

    return set(
        debianbts.get_usertag(MIA_EMAIL,
                              [MIA_TEAMMAINT_USERTAG])[MIA_TEAMMAINT_USERTAG])
Exemple #22
0
 def all_piuparts_bugs(self):
     if self._bugs_usertagged_piuparts is None:
         self._bugs_usertagged_piuparts = debianbts.get_usertag("*****@*****.**", 'piuparts')['piuparts']
     return self._bugs_usertagged_piuparts