Skip to contentSkip to conversation

package/python-pytest: new package with dependencies

PATCH New Marcin Niestroj 2 participants 7 messages Apr 29, 2020 – Sep 1, 2020

lore
Share & tools
lore
#0 lore raw

cover package/python-pytest: new package with dependencies

Hi!

This patch series adds pytest with all its required dependencies. There is also a simple test provided to verify that pytest really works.

Marcin Niestroj (4):
package/python-packaging: new package
package/python-pluggy: new package
package/python-pytest: new package
support/testing: add pytest test

 .gitlab-ci.yml                                |  1 +
 DEVELOPERS                                    |  5 ++++
 package/Config.in                             |  3 +++
 package/python-packaging/Config.in            |  8 ++++++
 .../python-packaging/python-packaging.hash    |  7 ++++++
 package/python-packaging/python-packaging.mk  | 14 +++++++++++
 package/python-pluggy/Config.in               |  7 ++++++
 package/python-pluggy/python-pluggy.hash      |  5 ++++
 package/python-pluggy/python-pluggy.mk        | 15 +++++++++++
 package/python-pytest/Config.in               | 16 ++++++++++++
 package/python-pytest/python-pytest.hash      |  5 ++++
 package/python-pytest/python-pytest.mk        | 15 +++++++++++
 .../tests/package/sample_python_pytest.py     | 25 +++++++++++++++++++
 .../tests/package/test_python_pytest.py       | 19 ++++++++++++++
 14 files changed, 145 insertions(+)
 create mode 100644 package/python-packaging/Config.in
 create mode 100644 package/python-packaging/python-packaging.hash
 create mode 100644 package/python-packaging/python-packaging.mk
 create mode 100644 package/python-pluggy/Config.in
 create mode 100644 package/python-pluggy/python-pluggy.hash
 create mode 100644 package/python-pluggy/python-pluggy.mk
 create mode 100644 package/python-pytest/Config.in
 create mode 100644 package/python-pytest/python-pytest.hash
 create mode 100644 package/python-pytest/python-pytest.mk
 create mode 100644 support/testing/tests/package/sample_python_pytest.py
 create mode 100644 support/testing/tests/package/test_python_pytest.py
Signature · 1 line
2.26.2
#1 lore raw

PATCH 1/4 package/python-packaging: new package

---
 DEVELOPERS                                     |  1 +
 package/Config.in                              |  1 +
 package/python-packaging/Config.in             |  8 ++++++++
 package/python-packaging/python-packaging.hash |  7 +++++++
 package/python-packaging/python-packaging.mk   | 14 ++++++++++++++
 5 files changed, 31 insertions(+)
 create mode 100644 package/python-packaging/Config.in
 create mode 100644 package/python-packaging/python-packaging.hash
 create mode 100644 package/python-packaging/python-packaging.mk
DEVELOPERS +1 -0
index cc72b288be..ddf235bb51 100644
@@ -1598,6 +1598,7 @@ F:	package/lua-stdlib/
 F:	package/luaossl/
 F:	package/murata-cyw-fw/
 F:	package/netdata/
+F:	package/python-packaging/
 F:	package/rs485conf/
 F:	package/turbolua/
 F:	support/testing/tests/package/test_netdata.py
package/Config.in +1 -0
index 53c8ce0e29..787bf0df93 100644
@@ -1040,6 +1040,7 @@ menu "External python modules"
 	source "package/python-nfc/Config.in"
 	source "package/python-numpy/Config.in"
 	source "package/python-oauthlib/Config.in"
+	source "package/python-packaging/Config.in"
 	source "package/python-paho-mqtt/Config.in"
 	source "package/python-pam/Config.in"
 	source "package/python-paramiko/Config.in"
package/python-packaging/Config.in new file +8 -0
new file mode 100644
index 0000000000..5a8135cd57
@@ -0,0 +1,8 @@
+config BR2_PACKAGE_PYTHON_PACKAGING
+	bool "python-packaging"
+	select BR2_PACKAGE_PYTHON_PYPARSING # runtime
+	select BR2_PACKAGE_PYTHON_SIX # runtime
+	help
+	  Core utilities for Python packages.
+
+	  https://github.com/pypa/packaging
package/python-packaging/python-packaging.hash new file +7 -0
new file mode 100644
index 0000000000..112bc695f6
@@ -0,0 +1,7 @@
+# md5, sha256 from https://pypi.org/pypi/packaging/json
+md5  19e0d1f82a9007b448650ccfeffd0a26  packaging-20.3.tar.gz
+sha256  3c292b474fda1671ec57d46d739d072bfd495a4f51ad01a055121d81e952b7a3  packaging-20.3.tar.gz
+# Locally computed sha256 checksums
+sha256  cad1ef5bd340d73e074ba614d26f7deaca5c7940c3d8c34852e65c4909686c48  LICENSE
+sha256  0d542e0c8804e39aa7f37eb00da5a762149dc682d7829451287e11b938e94594  LICENSE.APACHE
+sha256  b70e7e9b742f1cc6f948b34c16aa39ffece94196364bc88ff0d2180f0028fac5  LICENSE.BSD
package/python-packaging/python-packaging.mk new file +14 -0
new file mode 100644
index 0000000000..bd5177e8e5
@@ -0,0 +1,14 @@
+################################################################################
+#
+# python-packaging
+#
+################################################################################
+
+PYTHON_PACKAGING_VERSION = 20.3
+PYTHON_PACKAGING_SOURCE = packaging-$(PYTHON_PACKAGING_VERSION).tar.gz
+PYTHON_PACKAGING_SITE = https://files.pythonhosted.org/packages/65/37/83e3f492eb52d771e2820e88105f605335553fe10422cba9d256faeb1702
+PYTHON_PACKAGING_SETUP_TYPE = setuptools
+PYTHON_PACKAGING_LICENSE = Apache-2.0 or BSD-2-Clause
+PYTHON_PACKAGING_LICENSE_FILES = LICENSE LICENSE.APACHE LICENSE.BSD
+
+$(eval $(python-package))
Signature · 1 line
2.26.2
#2 lore raw

PATCH 2/4 package/python-pluggy: new package

In reply to Marcin Niestroj
---
 DEVELOPERS                               |  1 +
 package/Config.in                        |  1 +
 package/python-pluggy/Config.in          |  7 +++++++
 package/python-pluggy/python-pluggy.hash |  5 +++++
 package/python-pluggy/python-pluggy.mk   | 15 +++++++++++++++
 5 files changed, 29 insertions(+)
 create mode 100644 package/python-pluggy/Config.in
 create mode 100644 package/python-pluggy/python-pluggy.hash
 create mode 100644 package/python-pluggy/python-pluggy.mk
DEVELOPERS +1 -0
index ddf235bb51..ea53c55d41 100644
@@ -1599,6 +1599,7 @@ F:	package/luaossl/
 F:	package/murata-cyw-fw/
 F:	package/netdata/
 F:	package/python-packaging/
+F:	package/python-pluggy/
 F:	package/rs485conf/
 F:	package/turbolua/
 F:	support/testing/tests/package/test_netdata.py
package/Config.in +1 -0
index 787bf0df93..14334e450d 100644
@@ -1056,6 +1056,7 @@ menu "External python modules"
 	source "package/python-pigpio/Config.in"
 	source "package/python-pillow/Config.in"
 	source "package/python-pip/Config.in"
+	source "package/python-pluggy/Config.in"
 	source "package/python-ply/Config.in"
 	source "package/python-portend/Config.in"
 	source "package/python-posix-ipc/Config.in"
package/python-pluggy/Config.in new file +7 -0
new file mode 100644
index 0000000000..620983fe84
@@ -0,0 +1,7 @@
+config BR2_PACKAGE_PYTHON_PLUGGY
+	bool "python-pluggy"
+	select BR2_PACKAGE_PYTHON_IMPORTLIB_METADATA # runtime
+	help
+	  plugin and hook calling mechanisms for python.
+
+	  https://github.com/pytest-dev/pluggy
package/python-pluggy/python-pluggy.hash new file +5 -0
new file mode 100644
index 0000000000..24e207bfad
@@ -0,0 +1,5 @@
+# md5, sha256 from https://pypi.org/pypi/pluggy/json
+md5  7f610e28b8b34487336b585a3dfb803d  pluggy-0.13.1.tar.gz
+sha256  15b2acde666561e1298d71b523007ed7364de07029219b604cf808bfa1c765b0  pluggy-0.13.1.tar.gz
+# Locally computed sha256 checksums
+sha256  d6b65e6c213a5d0b577911d34d6e5949b9f59d76c238c5071a2f3fc16cfb2606  LICENSE
package/python-pluggy/python-pluggy.mk new file +15 -0
new file mode 100644
index 0000000000..03cdecf4b9
@@ -0,0 +1,15 @@
+################################################################################
+#
+# python-pluggy
+#
+################################################################################
+
+PYTHON_PLUGGY_VERSION = 0.13.1
+PYTHON_PLUGGY_SOURCE = pluggy-$(PYTHON_PLUGGY_VERSION).tar.gz
+PYTHON_PLUGGY_SITE = https://files.pythonhosted.org/packages/f8/04/7a8542bed4b16a65c2714bf76cf5a0b026157da7f75e87cc88774aa10b14
+PYTHON_PLUGGY_SETUP_TYPE = setuptools
+PYTHON_PLUGGY_LICENSE = MIT
+PYTHON_PLUGGY_LICENSE_FILES = LICENSE
+PYTHON_PLUGGY_DEPENDENCIES = host-python-setuptools-scm
+
+$(eval $(python-package))
Signature · 1 line
2.26.2
#3 lore raw

PATCH 2/4 package/python-pluggy: new package

Hello Marcin,

package/python-pluggy/Config.in line 3

Quoted 8 lines · On Thu, 30 Apr 2020 00:42:23 +0200 Marcin Niestroj…

new file mode 100644
index 0000000000..620983fe84

package/python-pluggy/Config.in new file +3 -0
@@ -0,0 +1,7 @@
+config BR2_PACKAGE_PYTHON_PLUGGY
+	bool "python-pluggy"
+	select BR2_PACKAGE_PYTHON_IMPORTLIB_METADATA # runtime

I don't see this option existing in Buildroot, and your patch 1/4 in this series was adding the python-packaging package.

Am I missing something here ?

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#4 lore raw

PATCH 2/4 package/python-pluggy: new package

Hi Thomas,

Quoted 5 lines · Thomas Petazzoni

Hello Marcin,

On Thu, 30 Apr 2020 00:42:23 +0200
Marcin Niestroj <[email protected]> wrote:

Quoted 11 lines

package/python-pluggy/Config.in line 3

Quoted 8 lines

new file mode 100644
index 0000000000..620983fe84

package/python-pluggy/Config.in new file +3 -0
@@ -0,0 +1,7 @@
+config BR2_PACKAGE_PYTHON_PLUGGY
+	bool "python-pluggy"
+	select BR2_PACKAGE_PYTHON_IMPORTLIB_METADATA # runtime

I don't see this option existing in Buildroot, and your patch 1/4 in this series was adding the python-packaging package.

I missed that importlib-metadata package was added (most probably) automatically by scanpypi script. It looks like we don't need this package when using python 3.8.

I'll send v2 of this patch series with that line removed.

Quoted 2 lines

Am I missing something here ?

Thanks for spotting that, that was my mistake.

Quoted 4 lines

Thanks!

Thomas

Signature · 1 line
Marcin Niestr?j
#5 lore raw

PATCH 3/4 package/python-pytest: new package

In reply to Marcin Niestroj
---
 DEVELOPERS                               |  1 +
 package/Config.in                        |  1 +
 package/python-pytest/Config.in          | 16 ++++++++++++++++
 package/python-pytest/python-pytest.hash |  5 +++++
 package/python-pytest/python-pytest.mk   | 15 +++++++++++++++
 5 files changed, 38 insertions(+)
 create mode 100644 package/python-pytest/Config.in
 create mode 100644 package/python-pytest/python-pytest.hash
 create mode 100644 package/python-pytest/python-pytest.mk
DEVELOPERS +1 -0
index ea53c55d41..2e14053559 100644
@@ -1600,6 +1600,7 @@ F:	package/murata-cyw-fw/
 F:	package/netdata/
 F:	package/python-packaging/
 F:	package/python-pluggy/
+F:	package/python-pytest/
 F:	package/rs485conf/
 F:	package/turbolua/
 F:	support/testing/tests/package/test_netdata.py
package/Config.in +1 -0
index 14334e450d..24ad43d36a 100644
@@ -1111,6 +1111,7 @@ menu "External python modules"
 	source "package/python-pysocks/Config.in"
 	source "package/python-pytablereader/Config.in"
 	source "package/python-pytablewriter/Config.in"
+	source "package/python-pytest/Config.in"
 	source "package/python-pytrie/Config.in"
 	source "package/python-pytz/Config.in"
 	source "package/python-pyudev/Config.in"
package/python-pytest/Config.in new file +16 -0
new file mode 100644
index 0000000000..a655a9e901
@@ -0,0 +1,16 @@
+config BR2_PACKAGE_PYTHON_PYTEST
+	bool "python-pytest"
+	depends on BR2_PACKAGE_PYTHON3
+	select BR2_PACKAGE_PYTHON_ATTRS # runtime
+	select BR2_PACKAGE_PYTHON_COLORAMA # runtime
+	select BR2_PACKAGE_PYTHON_MORE_ITERTOOLS # runtime
+	select BR2_PACKAGE_PYTHON_PACKAGING # runtime
+	select BR2_PACKAGE_PYTHON_PLUGGY # runtime
+	select BR2_PACKAGE_PYTHON_PY # runtime
+	select BR2_PACKAGE_PYTHON_WCWIDTH # runtime
+	help
+	  pytest is a framework that makes building simple and scalable
+	  tests easy. Tests are expressive and readable?no boilerplate
+	  code required.
+
+	  https://docs.pytest.org/en/latest/
package/python-pytest/python-pytest.hash new file +5 -0
new file mode 100644
index 0000000000..ebcac1f910
@@ -0,0 +1,5 @@
+# md5, sha256 from https://pypi.org/pypi/pytest/json
+md5	f0d3c0e6f71cfe53e24c736c4ceb7725  pytest-5.4.1.tar.gz
+sha256	84dde37075b8805f3d1f392cc47e38a0e59518fb46a431cfdaf7cf1ce805f970  pytest-5.4.1.tar.gz
+# Locally computer sha256
+sha256	7898b9b164d4f93fd9a562fd0f592935518b48c4745303964110eb7f7fe64faf  LICENSE
package/python-pytest/python-pytest.mk new file +15 -0
new file mode 100644
index 0000000000..9d3f271540
@@ -0,0 +1,15 @@
+################################################################################
+#
+# python-pytest
+#
+################################################################################
+
+PYTHON_PYTEST_VERSION = 5.4.1
+PYTHON_PYTEST_SOURCE = pytest-$(PYTHON_PYTEST_VERSION).tar.gz
+PYTHON_PYTEST_SITE = https://files.pythonhosted.org/packages/6d/4e/572aed20422dee7fa2bd27995b2a53a32de90c1826e5531c9df6d3ea77ed
+PYTHON_PYTEST_SETUP_TYPE = setuptools
+PYTHON_PYTEST_LICENSE = MIT
+PYTHON_PYTEST_LICENSE_FILES = LICENSE
+PYTHON_PYTEST_DEPENDENCIES = host-python-setuptools-scm
+
+$(eval $(python-package))
Signature · 1 line
2.26.2
#6 lore raw

PATCH 4/4 support/testing: add pytest test

In reply to Marcin Niestroj
---
 .gitlab-ci.yml                                |  1 +
 DEVELOPERS                                    |  2 ++
 .../tests/package/sample_python_pytest.py     | 25 +++++++++++++++++++
 .../tests/package/test_python_pytest.py       | 19 ++++++++++++++
 4 files changed, 47 insertions(+)
 create mode 100644 support/testing/tests/package/sample_python_pytest.py
 create mode 100644 support/testing/tests/package/test_python_pytest.py
.gitlab-ci.yml +1 -0
index fa8e077a07..12930dd849 100644
@@ -497,6 +497,7 @@ tests.package.test_python_pexpect.TestPythonPy2Pexpect: { extends: .runtime_test
 tests.package.test_python_pexpect.TestPythonPy3Pexpect: { extends: .runtime_test }
 tests.package.test_python_pynacl.TestPythonPy2Pynacl: { extends: .runtime_test }
 tests.package.test_python_pynacl.TestPythonPy3Pynacl: { extends: .runtime_test }
+tests.package.test_python_pytest.TestPythonPy3Pytest: { extends: .runtime_test }
 tests.package.test_python_pyyaml.TestPythonPy2Pyyaml: { extends: .runtime_test }
 tests.package.test_python_pyyaml.TestPythonPy3Pyyaml: { extends: .runtime_test }
 tests.package.test_python_service_identity.TestPythonPy2ServiceIdentity: { extends: .runtime_test }
DEVELOPERS +2 -0
index 2e14053559..5175798e76 100644
@@ -1603,7 +1603,9 @@ F:	package/python-pluggy/
 F:	package/python-pytest/
 F:	package/rs485conf/
 F:	package/turbolua/
+F:	support/testing/tests/package/sample_python_pytest.py
 F:	support/testing/tests/package/test_netdata.py
+F:	support/testing/tests/package/test_python_pytest.py
 
 N:	Marcus Folkesson <[email protected]>
 F:	package/libostree/
support/testing/tests/package/sample_python_pytest.py new file +25 -0
new file mode 100644
index 0000000000..870cc8512b
@@ -0,0 +1,25 @@
+import pytest
+
+
+x = 1
+
+
+ at pytest.fixture()
+def f1():
+    global x
+    x = 2
+    yield 15
+    x = 3
+
+
+def test_1():
+    assert x == 1
+
+
+def test_2(f1):
+    assert x == 2
+    assert f1 == 15
+
+
+def test_3():
+    assert x == 3
support/testing/tests/package/test_python_pytest.py new file +19 -0
new file mode 100644
index 0000000000..7fa7e44018
@@ -0,0 +1,19 @@
+import os
+
+from tests.package.test_python import TestPythonPackageBase
+
+
+class TestPythonPy3Pytest(TestPythonPackageBase):
+    __test__ = True
+    config = TestPythonPackageBase.config + \
+        """
+        BR2_PACKAGE_PYTHON3=y
+        BR2_PACKAGE_PYTHON_PYTEST=y
+        """
+    sample_scripts = ["tests/package/sample_python_pytest.py"]
+
+    def run_sample_scripts(self):
+        for script in self.sample_scripts:
+            cmd = self.interpreter + " -m pytest " + os.path.basename(script)
+            _, exit_code = self.emulator.run(cmd, timeout=self.timeout)
+            self.assertEqual(exit_code, 0)
Signature · 1 line
2.26.2