All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julien Olivain <ju.o@free.fr>
To: buildroot@buildroot.org
Cc: Julien Olivain <ju.o@free.fr>,
	Ricardo Martincoski <ricardo.martincoski@gmail.com>
Subject: [Buildroot] [PATCH 1/1] support/testing: add test for python-distro
Date: Sun, 30 Jan 2022 18:21:45 +0100	[thread overview]
Message-ID: <20220130172145.888946-1-ju.o@free.fr> (raw)

This commit add a simple test checking the reported distro name and
id are Buildroot (as reported by /etc/os-release).

Signed-off-by: Julien Olivain <ju.o@free.fr>
---
 DEVELOPERS                                    |  2 ++
 .../tests/package/sample_python_distro.py     |  4 ++++
 .../tests/package/test_python_distro.py       | 21 +++++++++++++++++++
 3 files changed, 27 insertions(+)
 create mode 100644 support/testing/tests/package/sample_python_distro.py
 create mode 100644 support/testing/tests/package/test_python_distro.py

diff --git a/DEVELOPERS b/DEVELOPERS
index e17803f38a..368f95796b 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1612,7 +1612,9 @@ F:	package/python-gnupg/
 F:	package/python-pyalsa/
 F:	package/riscv-isa-sim/
 F:	package/zynaddsubfx/
+F:	support/testing/tests/package/sample_python_distro.py
 F:	support/testing/tests/package/sample_python_gnupg.py
+F:	support/testing/tests/package/test_python_distro.py
 F:	support/testing/tests/package/test_python_gnupg.py
 
 N:	Julien Viard de Galbert <julien@vdg.name>
diff --git a/support/testing/tests/package/sample_python_distro.py b/support/testing/tests/package/sample_python_distro.py
new file mode 100644
index 0000000000..b31f129718
--- /dev/null
+++ b/support/testing/tests/package/sample_python_distro.py
@@ -0,0 +1,4 @@
+import distro
+
+assert(distro.name() == 'Buildroot')
+assert(distro.id() == 'buildroot')
diff --git a/support/testing/tests/package/test_python_distro.py b/support/testing/tests/package/test_python_distro.py
new file mode 100644
index 0000000000..943b29e47e
--- /dev/null
+++ b/support/testing/tests/package/test_python_distro.py
@@ -0,0 +1,21 @@
+from tests.package.test_python import TestPythonPackageBase
+
+
+class TestPythonPy2Distro(TestPythonPackageBase):
+    __test__ = True
+    config = TestPythonPackageBase.config + \
+        """
+        BR2_PACKAGE_PYTHON=y
+        BR2_PACKAGE_PYTHON_DISTRO=y
+        """
+    sample_scripts = ["tests/package/sample_python_distro.py"]
+
+
+class TestPythonPy3Distro(TestPythonPackageBase):
+    __test__ = True
+    config = TestPythonPackageBase.config + \
+        """
+        BR2_PACKAGE_PYTHON3=y
+        BR2_PACKAGE_PYTHON_DISTRO=y
+        """
+    sample_scripts = ["tests/package/sample_python_distro.py"]
-- 
2.34.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

             reply	other threads:[~2022-01-30 17:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-30 17:21 Julien Olivain [this message]
2022-02-12 12:51 ` [Buildroot] [PATCH 1/1] support/testing: add test for python-distro Arnout Vandecappelle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220130172145.888946-1-ju.o@free.fr \
    --to=ju.o@free.fr \
    --cc=buildroot@buildroot.org \
    --cc=ricardo.martincoski@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.