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

Torben Hohn torben.hohn at linutronix.de
Wed Apr 15 16:43:15 CEST 2020


On Tue, Apr 07, 2020 at 03:32:41PM -0400, Olivier Dion wrote:
> 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>

Reviewed-by: Torben Hohn <torben.hohn 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
> 
> 
> _______________________________________________
> elbe-devel mailing list
> elbe-devel at linutronix.de
> https://lists.linutronix.de/mailman/listinfo/elbe-devel

-- 
Torben Hohn
Linutronix GmbH | Bahnhofstrasse 3 | D-88690 Uhldingen-Mühlhofen
Phone: +49 7556 25 999 18; Fax.: +49 7556 25 999 99

Hinweise zum Datenschutz finden Sie hier (Informations on data privacy 
can be found here): https://linutronix.de/kontakt/Datenschutz.php

Linutronix GmbH | Firmensitz (Registered Office): Uhldingen-Mühlhofen | 
Registergericht (Registration Court): Amtsgericht Freiburg i.Br., HRB700 
806 | Geschäftsführer (Managing Directors): Heinz Egger, Thomas Gleixner



More information about the elbe-devel mailing list