From patchwork Wed Nov 30 18:42:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Finucane X-Patchwork-Id: 701120 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3tTTpX6mPzz9t0G for ; Thu, 1 Dec 2016 05:44:04 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="qGM3hoKR"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3tTTpX5LvfzDvrq for ; Thu, 1 Dec 2016 05:44:04 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="qGM3hoKR"; dkim-atps=neutral X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Received: from nov-007-i631.relay.mailchannels.net (nov-007-i631.relay.mailchannels.net [46.232.183.185]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3tTTpR3zGRzDvpM for ; Thu, 1 Dec 2016 05:43:58 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="qGM3hoKR"; dkim-atps=neutral X-Sender-Id: mxroute|x-authuser|stephen@that.guru Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 085A1A13BA; Wed, 30 Nov 2016 18:43:52 +0000 (UTC) Received: from one.mxroute.com (ip-10-229-2-62.us-west-2.compute.internal [10.229.2.62]) by relay.mailchannels.net (Postfix) with ESMTPA id 14409A0DCD; Wed, 30 Nov 2016 18:43:51 +0000 (UTC) X-Sender-Id: mxroute|x-authuser|stephen@that.guru Received: from one.mxroute.com ([UNAVAILABLE]. [10.16.27.41]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.7.8); Wed, 30 Nov 2016 18:43:51 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: mxroute|x-authuser|stephen@that.guru X-MailChannels-Auth-Id: mxroute X-MC-Loop-Signature: 1480531431325:1423403823 X-MC-Ingress-Time: 1480531431324 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=that.guru; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=eKTlQOBrbcwProiUEafhJCWXRH1TS6IxOst5HiG2B+s=; b=qGM3hoKRbONX+zL9MdDDfbk0rp 4OltYbyiL/mjfQIEwstt4OlMoo97D9aFQGFWrr1WJfidtmTvBArE0EB9t1FvOKpRCFOh/FaFU7p5D /VyGP+O/g3lTBcoH2LUF5i5aTEhARgk9bhkjatR1JDRwhp3U3wCM4aVFrkcCYl1mfwxTcSqVYrPXm acGjnXt2owuzM09tK155h3VJh4UDMuTpm7hSyuSXJeko10h1wwUxAwouXp0nCDDVvmd+NWTADvdiC BF/pVO31hvhAiJR39ATjjS1QeYx4aSHTL2N5vPZiOqneJuknG7ZGl6sXS4fbsK3qefra6VMGMZDAn GPzR6dAg==; From: Stephen Finucane To: patchwork@lists.ozlabs.org Subject: [PATCH v2 1/6] parser: Remove unused parameter Date: Wed, 30 Nov 2016 18:42:42 +0000 Message-Id: <20161130184247.9913-2-stephen@that.guru> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20161130184247.9913-1-stephen@that.guru> References: <20161130184247.9913-1-stephen@that.guru> X-OutGoing-Spam-Status: No, score=-10.0 X-AuthUser: stephen@that.guru X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Patchwork development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tom Rini , Paul Jakma MIME-Version: 1.0 Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Patchwork" The find_content function expected a 'project' parameter but never actually used it. Remove it and clean up tests accordingly. Signed-off-by: Stephen Finucane Cc: Paul Jakma Cc: Tom Rini --- patchwork/parser.py | 4 ++-- patchwork/tests/test_parser.py | 31 ++++++++++--------------------- 2 files changed, 12 insertions(+), 23 deletions(-) diff --git a/patchwork/parser.py b/patchwork/parser.py index c7890ea..2df9278 100644 --- a/patchwork/parser.py +++ b/patchwork/parser.py @@ -342,7 +342,7 @@ def parse_version(subject, subject_prefixes): return 1 -def find_content(project, mail): +def find_content(mail): """Extract a comment and potential diff from a mail.""" patchbuf = None commentbuf = '' @@ -761,7 +761,7 @@ def parse_mail(mail, list_id=None): # parse content - diff, message = find_content(project, mail) + diff, message = find_content(mail) if not (diff or message): return # nothing to work with diff --git a/patchwork/tests/test_parser.py b/patchwork/tests/test_parser.py index 96166ad..e4a379d 100644 --- a/patchwork/tests/test_parser.py +++ b/patchwork/tests/test_parser.py @@ -62,7 +62,7 @@ def read_mail(filename, project=None): mail = email.message_from_file(f) if 'Message-Id' not in mail: mail['Message-Id'] = make_msgid() - if project is not None: + if project: mail['List-Id'] = project.listid return mail @@ -89,12 +89,9 @@ def parse_mail(*args, **kwargs): class PatchTest(TestCase): - def setUp(self): - self.project = create_project() - def _find_content(self, mbox_filename): - mail = read_mail(mbox_filename, project=self.project) - diff, message = find_content(self.project, mail) + mail = read_mail(mbox_filename) + diff, message = find_content(mail) return diff, message @@ -106,9 +103,7 @@ class InlinePatchTest(PatchTest): def setUp(self): email = create_email(self.orig_content + '\n' + self.orig_diff) - - self.project = create_project() - self.diff, self.content = find_content(self.project, email) + self.diff, self.content = find_content(email) def test_patch_content(self): self.assertEqual(self.diff, self.orig_diff) @@ -130,8 +125,7 @@ class AttachmentPatchTest(InlinePatchTest): msg.attach(attachment) email = _create_email(msg) - self.project = create_project() - self.diff, self.content = find_content(self.project, email) + self.diff, self.content = find_content(email) class AttachmentXDiffPatchTest(AttachmentPatchTest): @@ -148,8 +142,7 @@ class UTF8InlinePatchTest(InlinePatchTest): _charset='utf-8') email = _create_email(msg) - self.project = create_project() - self.diff, self.content = find_content(self.project, email) + self.diff, self.content = find_content(email) class NoCharsetInlinePatchTest(InlinePatchTest): @@ -160,8 +153,7 @@ class NoCharsetInlinePatchTest(InlinePatchTest): del email['Content-Type'] del email['Content-Transfer-Encoding'] - self.project = create_project() - self.diff, self.content = find_content(self.project, email) + self.diff, self.content = find_content(email) class SignatureCommentTest(InlinePatchTest): @@ -172,8 +164,7 @@ class SignatureCommentTest(InlinePatchTest): email = create_email(self.orig_content + '\n-- \nsig\n' + self.orig_diff) - self.project = create_project() - self.diff, self.content = find_content(self.project, email) + self.diff, self.content = find_content(email) class UpdateSigCommentTest(SignatureCommentTest): @@ -194,8 +185,7 @@ class ListFooterTest(InlinePatchTest): 'Linuxppc-dev mailing list', self.orig_diff])) - self.project = create_project() - self.diff, self.content = find_content(self.project, email) + self.diff, self.content = find_content(email) class DiffWordInCommentTest(InlinePatchTest): @@ -571,8 +561,7 @@ class PatchParseTest(PatchTest): self.assertEqual(diff.count("\nrename to "), 2) def test_git_rename_with_diff(self): - diff, message = self._find_content( - '0009-git-rename-with-diff.mbox') + diff, message = self._find_content('0009-git-rename-with-diff.mbox') self.assertTrue(diff is not None) self.assertTrue(message is not None) self.assertEqual(diff.count("\nrename from "), 2)