Fix Python 3.9/3.10 compatibility and a Windows-only test failure#9
Open
kenstephoang wants to merge 2 commits into
Open
Fix Python 3.9/3.10 compatibility and a Windows-only test failure#9kenstephoang wants to merge 2 commits into
kenstephoang wants to merge 2 commits into
Conversation
datetime.UTC was added in Python 3.11, but pyproject declares requires-python >=3.9. Replace datetime.now(UTC) with datetime.now(timezone.utc) in the compiler and the runner template so compile and run-loop work on Python 3.9 and 3.10 instead of raising AttributeError.
On Windows, sys.executable contains backslashes that are invalid escape sequences inside the YAML double-quoted check string, so the fixed_passes test failed at YAML parse time. Use Path(sys.executable).as_posix() to match the other fixtures and keep the embedded argv valid on Windows.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Two small, independent fixes found while running the skill and its test suite on Windows with Python 3.9–3.10.
1.
datetime.UTCbreaks the declared Python floor (>=3.9)datetime.UTCwas only added in Python 3.11, butpyproject.tomldeclaresrequires-python = ">=3.9". On 3.9/3.10,datetime.now(datetime.UTC)raisesAttributeError, so bothcompileand the generatedrun-loop.pycrash on a supported interpreter.Fixed by using
datetime.timezone.utc(available since 3.2):scripts/looper.py—compiled_attimestamptemplates/run-loop.py—utc_now()2.
fixed_passestest fails on Windows onlytests/test_looper.pyembedssys.executableinto a YAML double-quoted string. On Windows that path has backslashes (C:\Users\...), which are invalid YAML escape sequences (\U,\l, …), sotest_fixed_passes_does_not_bypass_failed_programmatic_checkfails at YAML parse time. The other fixtures already usePath(sys.executable).as_posix(); this aligns that one line.Testing
python -m unittest discover -s tests→ 7/7 pass on Windows (Python 3.14). Previously 6/7 (thefixed_passestest failed on Windows only).Notes
No behavior change —
timezone.utcis equivalent toUTC. Kept as two independent commits.