public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: "'Clara Kowalsky' via isar-users" <isar-users@googlegroups.com>
To: isar-users@googlegroups.com
Cc: Clara Kowalsky <clara.kowalsky@siemens.com>
Subject: [PATCH v2 3/4] testsuite: run Python unittests in fast suite
Date: Mon, 26 Oct 2026 15:31:31 +0100	[thread overview]
Message-ID: <20261026143132.1067398-3-clara.kowalsky@siemens.com> (raw)
In-Reply-To: <20261026143132.1067398-1-clara.kowalsky@siemens.com>

Add an Avocado test with tag fast to run the Python unittests.
By default, all unittests located in testsuite/unittests/test* are run.
It is also possible to run a specific test or test file.

Signed-off-by: Clara Kowalsky <clara.kowalsky@siemens.com>
---
 testsuite/citest.py | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/testsuite/citest.py b/testsuite/citest.py
index 245a4305..dd151c1c 100644
--- a/testsuite/citest.py
+++ b/testsuite/citest.py
@@ -8,7 +8,7 @@
 
 from avocado import skipUnless
 from avocado.core import exceptions
-from avocado.utils import path
+from avocado.utils import path, process
 from cibase import CIBaseTest
 from utils import CIUtils
 
@@ -56,6 +56,23 @@ class EnvTest(CIBaseTest):
         self.perform_build_test(targets)
 
 
+class UnittestTest(CIBaseTest):
+    """Run the Python unit tests.
+
+    :avocado: tags=unittest,fast
+    """
+
+    def test_unittest(self):
+        test = self.params.get('test', default='')
+        if test:
+            process.run(
+                f'python3 -m unittest {test}',
+                env={'PYTHONPATH': 'testsuite/unittests'},
+            )
+        else:
+            process.run('python3 -m unittest discover -s testsuite/unittests')
+
+
 class DevTest(CIBaseTest):
 
     """
-- 
2.55.0

-- 
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/20261026143132.1067398-3-clara.kowalsky%40siemens.com.

  parent reply	other threads:[~2026-10-26 14:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-26 14:31 [PATCH v2 1/4] testsuite: fix run_privileged_cmd in image account extension unit test 'Clara Kowalsky' via isar-users
2026-10-26 14:31 ` [PATCH v2 2/4] testsuite: fix deterministic password test in image account extension 'Clara Kowalsky' via isar-users
2026-10-26 14:31 ` 'Clara Kowalsky' via isar-users [this message]
2026-10-26 14:31 ` [PATCH v2 4/4] testsuite: improve documentation for running Python unittests 'Clara Kowalsky' via isar-users
2026-10-29 14:23 ` [PATCH v2 1/4] testsuite: fix run_privileged_cmd in image account extension unit test Zhihang Wei

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=20261026143132.1067398-3-clara.kowalsky@siemens.com \
    --to=isar-users@googlegroups.com \
    --cc=clara.kowalsky@siemens.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox