[elbe-devel] [RFC PATCH 1/6] commands/test: Create Elbe unit test wrapper

Olivier Dion dion at linutronix.de
Tue Apr 7 21:32:41 CEST 2020


Instead of invoking the tedious 'python{2,3} -m unittest discover
[options]', this wrapper allows to simply run 'elbe test [options]'
from anywhere in the project hierarchy.

Signed-off-by: Olivier Dion <dion at linutronix.de>
---
 elbepack/commands/test.py | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
 create mode 100644 elbepack/commands/test.py

diff --git a/elbepack/commands/test.py b/elbepack/commands/test.py
new file mode 100644
index 00000000..c306b8f6
--- /dev/null
+++ b/elbepack/commands/test.py
@@ -0,0 +1,16 @@
+# ELBE - Debian Based Embedded Rootfilesystem Builder
+# Copyright (c) 2020 Olivier Dion <dion at linutronix.de>
+#
+# SPDX-License-Identifier: GPL-3.0-or-later
+
+# elbepack/commands/test.py - Elbe unit test wrapper
+
+import os
+
+from elbepack.shellhelper import system
+
+def run_command(argv):
+    this_dir = os.path.dirname(os.path.realpath(__file__))
+    top_dir  = os.path.join(this_dir, "..", "..")
+    system("python -m unittest discover --start-directory '%s' %s" %
+           (top_dir, " ".join(argv)), allow_fail=True)
-- 
2.26.0




More information about the elbe-devel mailing list