From patchwork Mon May 27 03:49:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emil Velikov via arch-projects X-Patchwork-Id: 1126 Return-Path: Delivered-To: patchwork@archlinux.org Received: from apollo.archlinux.org (localhost [127.0.0.1]) by apollo.archlinux.org (Postfix) with ESMTP id 7F1C8EE9B8E8 for ; Mon, 27 May 2019 03:49:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on apollo X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED=0.1, DKIM_VALID=-0.1,DKIM_VALID_AU=-0.1,MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3,SPF_HELO_NONE=0.001,T_DKIMWL_WL_HIGH=-0.01, T_DMARC_POLICY_NONE=0.01 autolearn=unavailable autolearn_force=no version=3.4.2 X-Spam-BL-Results: [127.0.9.2] Received: from orion.archlinux.org (orion.archlinux.org [IPv6:2a01:4f8:160:6087::1]) by apollo.archlinux.org (Postfix) with ESMTPS for ; Mon, 27 May 2019 03:49:44 +0000 (UTC) Received: from orion.archlinux.org (localhost [127.0.0.1]) by orion.archlinux.org (Postfix) with ESMTP id 1153B12D9F755E; Mon, 27 May 2019 03:49:42 +0000 (UTC) Received: from luna.archlinux.org (luna.archlinux.org [IPv6:2a01:4f8:160:3033::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits)) (No client certificate requested) by orion.archlinux.org (Postfix) with ESMTPS; Mon, 27 May 2019 03:49:42 +0000 (UTC) Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id 2E94B2C5F8; Mon, 27 May 2019 03:49:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=archlinux.org; s=luna2; t=1558928981; bh=ZwBjAZg0jusYf6rZ42P2/j6qDD8ftv8ETgEETLimikk=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc; b=BDcHL3JWpp4YdrWXx0BFLZMmYjCcX+BozLpkMOnDKphY5KajdiNFFkkJBKwcwUgLA 9/lnuJu0wz4EaG3YMFi5IO6UH+m8gM0dgusnKvu/ZkFFasREJyf73NhtwkJVoFhWMU KW3Dfo+b7cVIhPYaGhivtF5y2+uHBHU2WtTAjNG0YjPlPnlEm61Rk0nrzbusjx5C5K 2K35WwWyc0vRKWjlakpLx9uOA+Chy2p0EC9PKOEC/5L6GcOqUK2MBt7PP7u/Mygz4x hc6tnNx4Q29qrMqu8jxgtakNAdzamuJK9kurwPpE8L3L1GNmTlDvsbPD7kgtOoQZdB r+OV+ghjPZT7JCySzL4ycdgJrBw8EcdN7jA7Zz0HE/70Jl96aoqxGRET1BfWZ+NvkQ UZQ9bN6Po/ZiIamGK5UBgoc1HgVxcCsel+PROD10WaW2nqi9pUqCwbgLVD/8ghs1Ft MV+VVd9P6mjYIY9QhedadEn9hZbHTQvQq2EXIvPfr8AF+ccbOuZK7LZjpGiXv4LPnE wgb9+e6TgMT/IJ8VwC+mavnb4RHxFN0TkCCXznnhfuFG2driA5DoD8B4vSKcyw3f68 2IlhnaFSDK1OaAKJAUjxHhz35AhhLFJju8tsYFgFMofxyCQ+Fom6a/sgj0FN6z7F3y QeWPCJOLeOj/JbJj8N5n1XqI= Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id 2D0BF2C5F8 for ; Mon, 27 May 2019 03:49:38 +0000 (UTC) Received: from orion.archlinux.org (orion.archlinux.org [88.198.91.70]) by luna.archlinux.org (Postfix) with ESMTPS for ; Mon, 27 May 2019 03:49:38 +0000 (UTC) Received: from orion.archlinux.org (localhost [127.0.0.1]) by orion.archlinux.org (Postfix) with ESMTP id E5B2E12D9F752E for ; Mon, 27 May 2019 03:49:36 +0000 (UTC) Received: from mail-it1-x142.google.com (mail-it1-x142.google.com [IPv6:2607:f8b0:4864:20::142]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by orion.archlinux.org (Postfix) with ESMTPS for ; Mon, 27 May 2019 03:49:36 +0000 (UTC) Received: by mail-it1-x142.google.com with SMTP id a186so14914680itg.0 for ; Sun, 26 May 2019 20:49:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=sRV+hYzJgPaXxn7BpCIFmVO73Zi/5aKSs8PWyLD0KUs=; b=P8lrd3dQ6q9/OTsbPe+isUTgES57WZtYdO5eS2cpdNeqFya/GlU/11fUTdZHQOYn9m cS2l7s+2WFiJHFopK/VXvB3qzhIMMLW09s4zSwxJeZSCE7Rpp6D4a0agGfxLFrbBAqBo Jsdjz0zC9fDsgP6aQTz9an877wVFdEHeBm1dOyZLxVBsRLkjqAUEfAaFl3yi48t4QM3U ROjeqKPbTxHjmEGAUobaGgZjrFKCDnSNWRYGSJbt1DhARgFzgwfQjYf9VWMhhjABtsfY 0Tu4HFDpW4exRw3vdTyOKCkrGD6KZlc2TtDhu391GTfwdROnUzcfxmy8c0OKYNEYDDgy HHYg== X-Gm-Message-State: APjAAAWv1at7oynTWwsaPMjfY5/qSxm2xelohXRXpV2y7heWyqGj2zj4 orXLQiERy2qTIk01lpN02w4FIvGc X-Google-Smtp-Source: APXvYqwzrZ2wrt3bFw3khHWtObc7gMZZ6IG4JBgYSesLH9oblF4eOd12XU6yHHvNx0JzFvLsSkqtEA== X-Received: by 2002:a05:660c:f8e:: with SMTP id x14mr26851573itl.156.1558928975511; Sun, 26 May 2019 20:49:35 -0700 (PDT) Received: from newKvm.localdomain ([2601:402:4580:e98::9943]) by smtp.gmail.com with ESMTPSA id m64sm4414072itg.4.2019.05.26.20.49.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 26 May 2019 20:49:35 -0700 (PDT) To: arch-projects@archlinux.org Date: Sun, 26 May 2019 23:49:20 -0400 Message-Id: <20190527034922.27316-3-jamespharvey20@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190527034922.27316-1-jamespharvey20@gmail.com> References: <20190527034922.27316-1-jamespharvey20@gmail.com> MIME-Version: 1.0 Subject: [arch-projects] [namcap] [PATCH 2/4] Add test for non-unique source filenames X-BeenThere: arch-projects@archlinux.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Arch Linux projects development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: "James P. Harvey via arch-projects" Reply-To: Arch Linux projects development discussion Cc: "James P. Harvey" Errors-To: arch-projects-bounces@archlinux.org Sender: "arch-projects" Signed-off-by: James P. Harvey --- .../tests/pkgbuild/test_nonuniquesources.py | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 Namcap/tests/pkgbuild/test_nonuniquesources.py diff --git a/Namcap/tests/pkgbuild/test_nonuniquesources.py b/Namcap/tests/pkgbuild/test_nonuniquesources.py new file mode 100644 index 0000000..1c6d75c --- /dev/null +++ b/Namcap/tests/pkgbuild/test_nonuniquesources.py @@ -0,0 +1,58 @@ +# +# namcap rules - non-unique sources +# Copyright (C) 2019 James P. Harvey +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + +from Namcap.tests.pkgbuild_test import PkgbuildTest +import Namcap.rules.nonuniquesources as module + +class NamcapNonUniqueSourcesTest(PkgbuildTest): + pkgbuild_no_source = """ +pkgname=__namcap_test_uniquesources +pkgver=1.0 +pkgrel=1 +pkgdesc="A package" +arch=('i686' 'x86_64') +url="http://www.example.com/" +license=('GPL') +depends=('glibc') +build() { + true +} +package() { + true +} +""" + + test_valid = PkgbuildTest.valid_tests + + def preSetUp(self): + self.rule = module.nonuniquesources + + def test_unique(self): + r = self.run_on_pkg(self.pkgbuild_no_source + "source=('a' 'b')") + self.assertEqual(r.errors, []) + self.assertEqual(r.warnings, []) + self.assertEqual(r.infos, []) + + def test_versioned_non_unique(self): + r = self.run_on_pkg(self.pkgbuild_no_source + "source=('v1.2.3.tar.gz')") + self.assertEqual(r.errors, []) + self.assertEqual(r.warnings, [("non-unique-source-name %s", "v1.2.3.tar.gz")]) + self.assertEqual(r.infos, []) + +# vim: set ts=4 sw=4 noet: