From patchwork Thu Sep 7 13:25:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yegor Yefremov X-Patchwork-Id: 811011 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@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; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=googlemail.com header.i=@googlemail.com header.b="Ceoy5jWK"; dkim-atps=neutral Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xp1Ry26zvz9sMN for ; Thu, 7 Sep 2017 23:26:06 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 0CDE089C77; Thu, 7 Sep 2017 13:26:02 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Gw6U+m5m9Jjk; Thu, 7 Sep 2017 13:26:00 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id 6295689C7C; Thu, 7 Sep 2017 13:26:00 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id BAFE61C3EBA for ; Thu, 7 Sep 2017 13:25:58 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id B2AEB87AA0 for ; Thu, 7 Sep 2017 13:25:58 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7dhCcufy0Ms4 for ; Thu, 7 Sep 2017 13:25:58 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com [74.125.82.66]) by fraxinus.osuosl.org (Postfix) with ESMTPS id BE9A987A99 for ; Thu, 7 Sep 2017 13:25:57 +0000 (UTC) Received: by mail-wm0-f66.google.com with SMTP id x17so1039968wmd.5 for ; Thu, 07 Sep 2017 06:25:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=Eu1Oejy9DzyuUsaMx0J8pLII+055p3KlpSaMQo8haUY=; b=Ceoy5jWKE7HzPtPC359uZ/s2jcyUR+UvRUCPnKraG3LA7YGwCwOwNrb3BTdjV1S6Nk 2ccm29U3UzY2NVASzXYGgSD08GpcVwb57iJXckqAd5QmbDj5nnfZbJa/6L/9mgiPJ4AS /mDnkV7th9i2BD3XKitLYyuZfZFMaRCku41oa2fJNXcIHfbP/T9aR/MoC9IP/yMFO8mF cXeCqcl19Lm2xYJUXfMTLzYUGSrfGN3ICw0N758k6c5xEMaegJ5/We0pbKgksFPYmfTa MJGKCKIliK/CUOUQB9fw7As91y00zSdASGXeKFjon2YzwqI0nCHZvoUzO8i+oFSO4NED 2sPQ== 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; bh=Eu1Oejy9DzyuUsaMx0J8pLII+055p3KlpSaMQo8haUY=; b=GaPKoV0JhTgC7iRxBM49clIgrHVoV9veDYkP7CtIFZV/AGz9OetvMOSrGT+bi83Glq BZAE4Y0xqqG5KsajnU11b/scAkbAr/u1i25y8mM0PJ4gDQR8FDcdxiM2vNeap2+bQY+0 7GP9sJrMYX2xgcA7Z82IYHfachVFDhG8czd6k7NvGGyCwhT1nnX+tJ3WyVUOvcBwyPqQ /kEydM/kJ7tnSN3QF0l7VgUDxWjSwGhk90H+bulM3fsf4INKWqLzh/YIKV+L8zCnatEG hQ/jK+LP0+SG0WfcC1YrTKo9i3iNmkR24x259k89EvwYpDCptrT/So1xWBXQ6yhkQuN8 dwOQ== X-Gm-Message-State: AHPjjUh90KDevgF/nWnR7+7v+JSUXEmLaz1qoRWCbg/JDQl/XTrBOCDt gk9GZwtayGuhbgVY X-Google-Smtp-Source: ADKCNb4V4/TJYm3MHZ/AQqTY7YUI0hT6tyDPKJs+B04rcoWil/SGiMMZ+4B9oh0iwrwDWiiTDaRrGg== X-Received: by 10.80.195.68 with SMTP id q4mr1005704edb.144.1504790756001; Thu, 07 Sep 2017 06:25:56 -0700 (PDT) Received: from development1.visionsystems.de (mail.visionsystems.de. [213.209.99.202]) by smtp.gmail.com with ESMTPSA id l50sm1087285eda.50.2017.09.07.06.25.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 07 Sep 2017 06:25:54 -0700 (PDT) From: yegorslists@googlemail.com To: buildroot@buildroot.org Date: Thu, 7 Sep 2017 15:25:42 +0200 Message-Id: <1504790742-27831-1-git-send-email-yegorslists@googlemail.com> X-Mailer: git-send-email 2.1.4 Cc: thomas.petazzoni@free-electrons.com, ricardo.martincoski@datacom.ind.br Subject: [Buildroot] [PATCH v2] testing: add python-cryptography tests X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" From: Yegor Yefremov Signed-off-by: Yegor Yefremov Reviewed-by: Ricardo Martincoski --- Changes v1 -> v2: - rename test file to have only '_' delimiters (suggested by Ricardo Martincoski) - use intermediate class to avoid duplicate code (suggested by Ricardo Martincoski) .gitlab-ci.yml | 2 ++ .../tests/package/test_python_cryptography.py | 31 ++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 support/testing/tests/package/test_python_cryptography.py diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b44c935..091b016 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -250,6 +250,8 @@ tests.package.test_ipython.TestIPythonPy2: *runtime_test tests.package.test_ipython.TestIPythonPy3: *runtime_test tests.package.test_python.TestPython2: *runtime_test tests.package.test_python.TestPython3: *runtime_test +tests.package.test_python_cryptography.TestPythonPy2Cryptography: *runtime_test +tests.package.test_python_cryptography.TestPythonPy3Cryptography: *runtime_test tests.toolchain.test_external.TestExternalToolchainBuildrootMusl: *runtime_test tests.toolchain.test_external.TestExternalToolchainBuildrootuClibc: *runtime_test tests.toolchain.test_external.TestExternalToolchainCCache: *runtime_test diff --git a/support/testing/tests/package/test_python_cryptography.py b/support/testing/tests/package/test_python_cryptography.py new file mode 100644 index 0000000..b60152d --- /dev/null +++ b/support/testing/tests/package/test_python_cryptography.py @@ -0,0 +1,31 @@ +import os + +from tests.package.test_python import TestPythonBase + +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): + config = TestPythonBase.config + \ +""" +BR2_PACKAGE_PYTHON=y +BR2_PACKAGE_PYTHON_CRYPTOGRAPHY=y +""" + def test_run(self): + self.login() + self.fernet_test(40) + +class TestPythonPy3Cryptography(TestPythonCryptography): + config = TestPythonBase.config + \ +""" +BR2_PACKAGE_PYTHON3=y +BR2_PACKAGE_PYTHON_CRYPTOGRAPHY=y +""" + def test_run(self): + self.login() + self.fernet_test(40)