Fix --exec interactive prompt bug and create comprehensive test suite
Major fixes: - Fixed --exec entering Python REPL instead of game loop - Resolved screenshot transparency issue (requires timer callbacks) - Added debug output to trace Python initialization Test suite created: - 13 comprehensive tests covering all Python-exposed methods - Tests use timer callback pattern for proper game loop interaction - Discovered multiple critical bugs and missing features Critical bugs found: - Grid class segfaults on instantiation (blocks all Grid functionality) - Issue #78 confirmed: Middle mouse click sends 'C' keyboard event - Entity property setters have argument parsing errors - Sprite texture setter returns improper error - keypressScene() segfaults on non-callable arguments Documentation updates: - Updated CLAUDE.md with testing guidelines and TDD practices - Created test reports documenting all findings - Updated ROADMAP.md with test results and new priorities The Grid segfault is now the highest priority as it blocks all Grid-based functionality.
This commit is contained in:
parent
9ad0b6850d
commit
18cfe93a44
36 changed files with 2386 additions and 13 deletions
46
tests/trace_exec_behavior.py
Normal file
46
tests/trace_exec_behavior.py
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
#!/usr/bin/env python3
|
||||
"""Trace execution behavior to understand the >>> prompt"""
|
||||
import mcrfpy
|
||||
import sys
|
||||
import traceback
|
||||
|
||||
print("=== Tracing Execution ===")
|
||||
print(f"Python version: {sys.version}")
|
||||
print(f"sys.argv: {sys.argv}")
|
||||
print(f"__name__: {__name__}")
|
||||
|
||||
# Check if we're in interactive mode
|
||||
print(f"sys.flags.interactive: {sys.flags.interactive}")
|
||||
print(f"sys.flags.inspect: {sys.flags.inspect}")
|
||||
|
||||
# Check sys.ps1 (interactive prompt)
|
||||
if hasattr(sys, 'ps1'):
|
||||
print(f"sys.ps1 exists: '{sys.ps1}'")
|
||||
else:
|
||||
print("sys.ps1 not set (not in interactive mode)")
|
||||
|
||||
# Create a simple scene
|
||||
mcrfpy.createScene("trace_test")
|
||||
mcrfpy.setScene("trace_test")
|
||||
print(f"Current scene: {mcrfpy.currentScene()}")
|
||||
|
||||
# Set a timer that should fire
|
||||
def timer_test():
|
||||
print("\n!!! Timer fired successfully !!!")
|
||||
mcrfpy.delTimer("trace_timer")
|
||||
# Try to exit
|
||||
print("Attempting to exit...")
|
||||
mcrfpy.exit()
|
||||
|
||||
print("Setting timer...")
|
||||
mcrfpy.setTimer("trace_timer", timer_test, 500)
|
||||
|
||||
print("\n=== Script execution complete ===")
|
||||
print("If you see >>> after this, Python entered interactive mode")
|
||||
print("The game loop should start now...")
|
||||
|
||||
# Try to ensure we don't enter interactive mode
|
||||
if hasattr(sys, 'ps1'):
|
||||
del sys.ps1
|
||||
|
||||
# Explicitly NOT calling sys.exit() to let the game loop run
|
||||
Loading…
Add table
Add a link
Reference in a new issue