[elbe-devel] [PATCH 01/75] tests test_pylint: Add pylint unittest

Torben Hohn torben.hohn at linutronix.de
Fri May 29 10:36:16 CEST 2020


On Mon, May 25, 2020 at 11:41:54AM -0400, Olivier Dion wrote:
> pylint should lint for Python3 code.  Thus make sure that pylint
> doesn't symlink to pylint2 on your distribution.
> 
> Signed-off-by: Olivier Dion <dion at linutronix.de>

Reviewed-by: Torben Hohn <torben.hohn at linutronix.de>

I am not sure if we dont want to have a separate test for each file
though. But maybe thats just me coming from a world where
a lot of the files have linter errors, and the number of them only
decreases slowly.

As a side note, i also run pycodestyle on the modules i edit.
Can you add a test for that also ?

But dont start fixing things yet.

> ---
>  elbepack/tests/test_pylint.py | 28 ++++++++++++++++++++++++++++
>  1 file changed, 28 insertions(+)
>  create mode 100644 elbepack/tests/test_pylint.py
> 
> diff --git a/elbepack/tests/test_pylint.py b/elbepack/tests/test_pylint.py
> new file mode 100644
> index 00000000..47d7032e
> --- /dev/null
> +++ b/elbepack/tests/test_pylint.py
> @@ -0,0 +1,28 @@
> +# ELBE - Debian Based Embedded Rootfilesystem Builder
> +# Copyright (c) 2020 Olivier Dion <dion at linutronix.de>
> +#
> +# SPDX-License-Identifier: GPL-3.0-or-later
> +
> +import os
> +import unittest
> +
> +from elbepack.shellhelper import system, CommandError
> +
> +class TestPylint(unittest.TestCase):
> +
> +    this_dir = os.path.dirname(os.path.realpath(__file__))
> +    top_dir  = os.path.abspath(os.path.join(this_dir, "..", ".."))
> +    pylint_opts = ["--reports=n",
> +                   "--score=n",
> +                   "--rcfile=%s" % os.path.join(top_dir, ".pylintrc"),
> +                   "elbe", "elbepack"]
> +
> +    def test_lint(self):
> +        ret = True
> +        try:
> +            system("pylint %s" % " ".join(self.pylint_opts))
> +        except CommandError as E:
> +            print(E)
> +            ret = False
> +
> +        self.assertTrue(ret)
> -- 
> 2.26.2
> 
> 
> _______________________________________________
> 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