diff tests/run-tests.py @ 52684:70a75d379daf

tests: obfuscate Python version checks to subvert `pyupgrade` When specifying `--py38-plus`, it reasonably deletes conditionals that check for that version of python or earlier. But we actually want the check to remain, so use a simple obfuscation to preserve it.
author Matt Harbison <matt_harbison@yahoo.com>
date Tue, 07 Jan 2025 17:52:52 -0500
parents 5cc8deb96b48
children f5091286b10c
line wrap: on
line diff
--- a/tests/run-tests.py	Tue Jan 07 17:46:56 2025 -0500
+++ b/tests/run-tests.py	Tue Jan 07 17:52:52 2025 -0500
@@ -73,7 +73,11 @@
 import xml.dom.minidom as minidom
 
 
-if sys.version_info < (3, 8, 0):
+# Don't compare sys.version_info directly, to prevent pyupgrade from dropping
+# the conditional.
+sys_version_info = sys.version_info
+
+if sys_version_info < (3, 8, 0):
     print(
         '%s is only supported on Python 3.8+, not %s'
         % (sys.argv[0], '.'.join(str(v) for v in sys.version_info[:3]))