From patchwork Fri Nov 2 04:12:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Martincoski X-Patchwork-Id: 992178 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.133; helo=hemlock.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="fuTyKP7f"; dkim-atps=neutral Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42mTGT0dWtzB4R1 for ; Fri, 2 Nov 2018 15:13:53 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 56A9987DC5; Fri, 2 Nov 2018 04:13:49 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id DykcLhH4s6lK; Fri, 2 Nov 2018 04:13:48 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id 21F2587D54; Fri, 2 Nov 2018 04:13:48 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id B6D481BF4DA for ; Fri, 2 Nov 2018 04:13:46 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id B400081FA1 for ; Fri, 2 Nov 2018 04:13:46 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id X3g9mnxtAsUE for ; Fri, 2 Nov 2018 04:13:45 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-qk1-f193.google.com (mail-qk1-f193.google.com [209.85.222.193]) by hemlock.osuosl.org (Postfix) with ESMTPS id 1E0CA87DA2 for ; Fri, 2 Nov 2018 04:13:45 +0000 (UTC) Received: by mail-qk1-f193.google.com with SMTP id v68-v6so1173665qka.2 for ; Thu, 01 Nov 2018 21:13:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=3aF4mCPglgaTQzkSlEp5NSCAbMPmqr2XD564yGlwZNk=; b=fuTyKP7fomDO0IOsPC6Nuoa8ty83VUc3ARf64NXQemx53GMPm6ZVJNw5tbjG+GH2lE hKWa/bTfkNQWgx1oConnIAXQ2dX5KmP5ohSvF3lyidVEs7XV5VJ5JA62TgJva6A+ZXS/ 87m+2OSZLb6hXUT4nIt3RQxMxpQ3mfNNNsLYST41b6FOABXKXwXeTm/lAzXM3H3PheMD PQxTjXQ04P61avcmuVZBs6Re+MLYMVpwoZHoZ4oAdvfIqhjkf3BSm99Zfwgsb18bYau0 pTFDE3529p8KRMsi4fr24x+ZAeg02UKLSUQ22B3dg50V6GRwuBeDXfRa9ux43qt4dvVD OCiQ== 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:in-reply-to:references; bh=3aF4mCPglgaTQzkSlEp5NSCAbMPmqr2XD564yGlwZNk=; b=DpkxzbC5rtD46XnXKyrm6aDoWHYu4nuKmHObtlvRT7KEfwxn+ntUIQHJS5ZLAXtwWH ULCKrMX04dRZDxhbbR8Jlju33TPRkslyAVceOYBfadxUSda4xKq2YsIKPr9Fx/6aqTPo ZHRAx2tJsiPb8nVTbTxw59BUadQgE+h/bvDJ3gNFXJBLgAlF4e6SJ9nOW/b+rlRKcEhh bjCj4mLJXCCj93EE7TY3ipcn+KxxDAOQTaITdenzR6wDRb5Y2yTHLRimmMPedcu1VD89 aYJ7j0VeWTKI8wKMcqxrF+ci8OHTBrH6UN1yaHIRjkCMtavSZSBtz7KqUcxR2Pixp0tV Guog== X-Gm-Message-State: AGRZ1gIunVLlUU0h6kjwe/2akorkeWq1UcaaTHjvoXKpoh/FEUXgx7LP 4V0lscnonyjrm3LXUVZ1jFOajnGv X-Google-Smtp-Source: AJdET5fos4/2UAZ/Kie4OFZkiTQVzrmsFW6wRAcW24M34XBOIWoiCP/nI9M0GxmFAaRvpvQQbVLUDQ== X-Received: by 2002:a37:4dc5:: with SMTP id a188-v6mr9098667qkb.326.1541132024008; Thu, 01 Nov 2018 21:13:44 -0700 (PDT) Received: from ultri5.home ([179.181.159.8]) by smtp.gmail.com with ESMTPSA id 83sm32849688qkz.73.2018.11.01.21.13.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Nov 2018 21:13:43 -0700 (PDT) From: Ricardo Martincoski To: buildroot@buildroot.org Date: Fri, 2 Nov 2018 01:12:35 -0300 Message-Id: <20181102041241.28910-7-ricardo.martincoski@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181102041241.28910-1-ricardo.martincoski@gmail.com> References: <20181102041241.28910-1-ricardo.martincoski@gmail.com> In-Reply-To: <20181016004230.10393-1-ricardo.martincoski@gmail.com> References: <20181016004230.10393-1-ricardo.martincoski@gmail.com> Subject: [Buildroot] [PATCH v2 06/12] support/testing: use TestPythonPackageBase for python-cryptography X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Petazzoni , Asaf Kahlon , Ricardo Martincoski MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Move the test script to be run on the target from inline in the test case to a separate file. Signed-off-by: Ricardo Martincoski Cc: Arnout Vandecappelle Cc: Asaf Kahlon Cc: Thomas Petazzoni Cc: Yegor Yefremov --- Changes v1 -> v2: - refresh after creating TestPythonPackageBase; --- .../package/sample_python_cryptography.py | 3 ++ .../tests/package/test_python_cryptography.py | 32 ++++++------------- 2 files changed, 12 insertions(+), 23 deletions(-) create mode 100644 support/testing/tests/package/sample_python_cryptography.py diff --git a/support/testing/tests/package/sample_python_cryptography.py b/support/testing/tests/package/sample_python_cryptography.py new file mode 100644 index 0000000000..ec9883dc64 --- /dev/null +++ b/support/testing/tests/package/sample_python_cryptography.py @@ -0,0 +1,3 @@ +from cryptography.fernet import Fernet +key = Fernet.generate_key() +f = Fernet(key) diff --git a/support/testing/tests/package/test_python_cryptography.py b/support/testing/tests/package/test_python_cryptography.py index 2a8ce1d8f7..5f380b2750 100644 --- a/support/testing/tests/package/test_python_cryptography.py +++ b/support/testing/tests/package/test_python_cryptography.py @@ -1,32 +1,18 @@ -from tests.package.test_python import TestPythonBase, TestPythonBase2, TestPythonBase3 +from tests.package.test_python import TestPythonPackageBase, TestPythonBase2, TestPythonBase3 -class TestPythonCryptography(TestPythonBase): - def fernet_test(self, timeout=-1): - cmd = self.interpreter + " -c 'from cryptography.fernet import Fernet;" - cmd += "key = Fernet.generate_key();" - cmd += "f = Fernet(key)'" - _, exit_code = self.emulator.run(cmd, timeout) - self.assertEqual(exit_code, 0) - - -class TestPythonPy2Cryptography(TestPythonCryptography, TestPythonBase2): - config = TestPythonBase2.config + \ +class TestPythonCryptography(TestPythonPackageBase): + config_package = \ """ BR2_PACKAGE_PYTHON_CRYPTOGRAPHY=y """ + sample_scripts = ["tests/package/sample_python_cryptography.py"] + timeout = 40 - def test_run(self): - self.login() - self.fernet_test(40) +class TestPythonPy2Cryptography(TestPythonCryptography, TestPythonBase2): + pass -class TestPythonPy3Cryptography(TestPythonCryptography, TestPythonBase3): - config = TestPythonBase3.config + \ - """ - BR2_PACKAGE_PYTHON_CRYPTOGRAPHY=y - """ - def test_run(self): - self.login() - self.fernet_test(40) +class TestPythonPy3Cryptography(TestPythonCryptography, TestPythonBase3): + pass