diff --git a/runbot_merge/github.py b/runbot_merge/github.py index 9291e2c4..c499c7b6 100644 --- a/runbot_merge/github.py +++ b/runbot_merge/github.py @@ -1,11 +1,9 @@ import collections import functools import logging -import pprint import requests -from odoo.exceptions import UserError from . import exceptions _logger = logging.getLogger(__name__) diff --git a/runbot_merge/tests/fake_github/__init__.py b/runbot_merge/tests/fake_github/__init__.py index fa78a1b6..86a91567 100644 --- a/runbot_merge/tests/fake_github/__init__.py +++ b/runbot_merge/tests/fake_github/__init__.py @@ -198,7 +198,7 @@ class Repo(object): def is_ancestor(self, sha, of): assert not git.is_ancestor(self.objects, sha, of=of) - def _read_ref(self, r, ref): + def _read_ref(self, _, ref): obj = self.refs.get(ref) if obj is None: return (404, None) @@ -282,7 +282,7 @@ class Repo(object): "tree": {"sha": body['tree']}, "parents": [{"sha": sha}], }) - def _read_commit(self, r, sha): + def _read_commit(self, _, sha): c = self.objects.get(sha) if not isinstance(c, Commit): return (404, None) @@ -349,7 +349,7 @@ class Repo(object): return (200, {}) - def _remove_label(self, r, number, label): + def _remove_label(self, _, number, label): print('remove_label', number, label) try: pr = self.issues[int(number)] @@ -384,7 +384,7 @@ class Repo(object): # get common ancestor (base) of commits try: base = git.merge_base(self.objects, target, sha) - except Exception as e: + except Exception: return (400, {'message': "No common ancestor between %(base)s and %(head)s" % body}) try: tid = git.merge_objects( @@ -534,7 +534,7 @@ class Commit(object): return git.make_commit(self.tree, self.message, self.author, self.committer, parents=self.parents)[0] def __str__(self): - parents = '\n'.join('parent {p}' for p in self.parents) + '\n' + parents = '\n'.join('parent {}'.format(p) for p in self.parents) + '\n' return """commit {} tree {} {}author {} diff --git a/runbot_merge/tests/fake_github/git.py b/runbot_merge/tests/fake_github/git.py index 6f0c5ea4..756c5d1f 100644 --- a/runbot_merge/tests/fake_github/git.py +++ b/runbot_merge/tests/fake_github/git.py @@ -40,6 +40,10 @@ def make_commit(tree, message, author, committer=None, parents=()): def walk_ancestors(store, commit, exclude_self=True): """ :param store: mapping of hashes to commit objects (w/ a parents attribute) + :param str commit: starting commit's hash + :param exclude_self: whether the starting commit shoudl be returned as + part of the sequence + :rtype: Iterator[(str, int)] """ q = [(commit, 0)] while q: diff --git a/runbot_merge/tests/remote.py b/runbot_merge/tests/remote.py index 614778f7..63a95b00 100644 --- a/runbot_merge/tests/remote.py +++ b/runbot_merge/tests/remote.py @@ -48,7 +48,6 @@ import collections import configparser import itertools import re -import signal import socket import subprocess import sys diff --git a/runbot_merge/tests/test_basic.py b/runbot_merge/tests/test_basic.py index 9a2fefba..ebdab1a5 100644 --- a/runbot_merge/tests/test_basic.py +++ b/runbot_merge/tests/test_basic.py @@ -4,8 +4,6 @@ import pytest import odoo -from fake_github import git - @pytest.fixture def repo(make_repo): return make_repo('repo')