From 01757e5ac9324948ca64a4cf512352b09956a8fa Mon Sep 17 00:00:00 2001 From: Ulf Magnusson Date: Wed, 21 Nov 2018 11:17:28 +0100 Subject: Disable test dependent on dict ordering on Python 3.5 and earlier The KCONFIG_WARN_UNDEF test often fails on Python 3.4 (3.5 not tested), but the output is still correct. It just differs due to dict ordering randomness. Python 3.6 iterates over dicts in insertion order in practice, and Python 3.7 made it part of the spec, so enable the test for 3.6 and later. Python 2.7 seems fine as well. --- testsuite.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'testsuite.py') diff --git a/testsuite.py b/testsuite.py index 65ce4aa..22e12cc 100644 --- a/testsuite.py +++ b/testsuite.py @@ -2537,13 +2537,16 @@ 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: @@ -2584,7 +2587,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 -- cgit v1.2.3