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

Olivier Dion dion at linutronix.de
Fri Jun 5 19:06:25 CEST 2020


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>
---
 elbepack/tests/test_pylint.py | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 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..43248f9e
--- /dev/null
+++ b/elbepack/tests/test_pylint.py
@@ -0,0 +1,29 @@
+# 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"),
+                   "--disable=W0511,R0801",
+                   "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.27.0




More information about the elbe-devel mailing list