summaryrefslogtreecommitdiff
path: root/testsuite.py
diff options
context:
space:
mode:
authorBenjamin Cabé <benjamin@zephyrproject.org>2025-10-23 17:25:08 +0200
committerTorsten Tejlmand Rasmussen <torsten.rasmussen@nordicsemi.no>2026-02-02 08:22:15 +0100
commit24aef157aead07f813f874f43ee471b057e622cb (patch)
tree57cbb867898e31f9efb3fcce0997ecd3267ea1cc /testsuite.py
parentffb54593b899c42fe70e55d26e02d4cd4a9ca53d (diff)
drop support for Python 2.x as it is very much EOL
A follow-up to b96a5ad562deffa697d966c29546650aae645f48 where we stopped having CI run tests on Python 2.x. This actually drops the few remaining Python 2.x compatibility bits as Python 2.x has EOL'd a long time ago. Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org> Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Diffstat (limited to 'testsuite.py')
-rw-r--r--testsuite.py27
1 files changed, 10 insertions, 17 deletions
diff --git a/testsuite.py b/testsuite.py
index b4f5e2b..7bc9804 100644
--- a/testsuite.py
+++ b/testsuite.py
@@ -2699,16 +2699,12 @@ config PRINT_ME_TOO
sys.path.pop(0)
- # This test can fail on older Python 3.x versions, because they don't
- # preserve dict insertion order during iteration. The output is still
- # correct, just different.
- if not (3, 0) <= sys.version_info <= (3, 5):
- print("Testing KCONFIG_WARN_UNDEF")
+ print("Testing KCONFIG_WARN_UNDEF")
- os.environ["KCONFIG_WARN_UNDEF"] = "y"
- c = Kconfig("Kconfiglib/tests/Kundef", warn_to_stderr=False)
+ os.environ["KCONFIG_WARN_UNDEF"] = "y"
+ c = Kconfig("Kconfiglib/tests/Kundef", warn_to_stderr=False)
- verify_equal("\n".join(c.warnings), """
+ verify_equal("\n".join(c.warnings), """
warning: the int symbol INT (defined at Kconfiglib/tests/Kundef:8) has a non-int range [UNDEF_2 (undefined), 8 (undefined)]
warning: undefined symbol UNDEF_1:
@@ -2747,7 +2743,7 @@ menu "menu"
visible if UNDEF_3
"""[1:-1])
- os.environ.pop("KCONFIG_WARN_UNDEF")
+ os.environ.pop("KCONFIG_WARN_UNDEF")
print("\nAll selftests passed\n" if all_passed else
@@ -2760,8 +2756,8 @@ def run_compatibility_tests():
# Referenced inside the kernel Kconfig files.
#
- # The str() makes the type of the value 'str' on both Python 2 and Python 3,
- # which is nice for some later dictionary key sanity checks.
+ # The str() makes the type of the value 'str', which is nice for some later
+ # dictionary key sanity checks.
os.environ["KERNELVERSION"] = str(
subprocess.check_output("make kernelversion", shell=True)
@@ -2932,13 +2928,10 @@ def test_sanity(arch, srcarch):
kconf.write_autoconf("/dev/null")
- # No tempfile.TemporaryDirectory in Python 2
- tmpdir = tempfile.mkdtemp()
- kconf.sync_deps(os.path.join(tmpdir, "deps")) # Create
- kconf.sync_deps(os.path.join(tmpdir, "deps")) # Update
- shutil.rmtree(tmpdir)
+ with tempfile.TemporaryDirectory() as tmpdir:
+ kconf.sync_deps(os.path.join(tmpdir, "deps")) # Create
+ kconf.sync_deps(os.path.join(tmpdir, "deps")) # Update
- # Python 2/3 compatible
for key, sym in kconf.syms.items():
verify(isinstance(key, str), "weird key '{}' in syms dict".format(key))