[elbe-devel] [PATCH 19/37] Set mandatory global variable

Benedikt Spranger b.spranger at linutronix.de
Wed Feb 7 15:28:46 CET 2024


The global variable elbe_dir is mandatory to set before calling
elbepack modules.

>From 'elbepack/directories.py':
    "set global variables that are used in other modules via imports
    this is the very first function that is called by 'elbe'"

Set elbe_dir in the test environment.

Signed-off-by: Benedikt Spranger <b.spranger at linutronix.de>
---
 elbepack/tests/test_preproc.py | 3 +++
 elbepack/tests/test_pylint.py  | 3 +++
 elbepack/tests/test_xml.py     | 3 +++
 3 files changed, 9 insertions(+)

diff --git a/elbepack/tests/test_preproc.py b/elbepack/tests/test_preproc.py
index d623368c..d4b99232 100644
--- a/elbepack/tests/test_preproc.py
+++ b/elbepack/tests/test_preproc.py
@@ -10,6 +10,9 @@ from elbepack.directories import elbe_exe, elbe_dir
 
 
 class TestPreproc(ElbeTestCase):
+    global elbe_dir      #pylint: disable=global-statement
+
+    elbe_dir = os.path.join(os.path.dirname(__file__), "../..")
 
     failure_set = {os.path.join(elbe_dir, path)
                    for path
diff --git a/elbepack/tests/test_pylint.py b/elbepack/tests/test_pylint.py
index 7338f262..64cac9a6 100644
--- a/elbepack/tests/test_pylint.py
+++ b/elbepack/tests/test_pylint.py
@@ -10,6 +10,9 @@ from elbepack.directories import pack_dir, elbe_exe, elbe_dir
 
 
 class TestPylint(ElbeTestCase):
+    global elbe_dir      #pylint: disable=global-statement
+
+    elbe_dir = os.path.join(os.path.dirname(__file__), "../..")
 
     pylint_opts = ["--reports=n",
                    "--score=n",
diff --git a/elbepack/tests/test_xml.py b/elbepack/tests/test_xml.py
index 915ea16d..fed49e05 100644
--- a/elbepack/tests/test_xml.py
+++ b/elbepack/tests/test_xml.py
@@ -14,6 +14,9 @@ from elbepack.commands.test import ElbeTestCase, ElbeTestLevel, system
 @unittest.skipIf(ElbeTestCase.level < ElbeTestLevel.INITVM,
                  "Test level not set to INITVM")
 class TestSimpleXML(ElbeTestCase):
+    global elbe_dir      #pylint: disable=global-statement
+
+    elbe_dir = os.path.join(os.path.dirname(__file__), "../..")
 
     params = [os.path.join(elbe_dir, "tests", fname)
               for fname
-- 
2.43.0



More information about the elbe-devel mailing list