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

Olivier Dion dion at linutronix.de
Mon May 25 17:41:54 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>
---
 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




More information about the elbe-devel mailing list