diff tests/fsmonitor-run-tests.py @ 52659: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 c975e8ec08bb
children
line wrap: on
line diff
--- a/tests/fsmonitor-run-tests.py	Tue Jan 07 17:46:56 2025 -0500
+++ b/tests/fsmonitor-run-tests.py	Tue Jan 07 17:52:52 2025 -0500
@@ -24,7 +24,11 @@
 
 osenvironb = getattr(os, 'environb', os.environ)
 
-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):
 
     def _sys2bytes(p):
         return p.encode('utf-8')