Richard Tew wrote:
> The released code is for Python 2.6. Python 3.0+ removes some of the
> constraints which make code reloading hard. However, while the reload
> builtin has been moved to a module, it still looks like it leaves
> broken modules in place in event of an importation error. I don't use
> Python 3.0 at this time, so I have no need to devote the extra time to
> port the module.
First of all, thanks for creating a very interesting and useful
module.
I have a couple of questions:
(1) Is it absolutely necessary that this module is 2.6 specific, as
there's an awful lot of code out there which is still in 2.5 land...
If not, would it be difficult to port to 2.5.4?
(2) I ran the test_reloading.py file with 2.6.2 (on mac os x leopard)
and received the following test failures:
<snip>
$ python2.6 test_reloading.py
WARNING:root:TODO, implement leakage compatibility case
..F...........E
======================================================================
ERROR: testUpdateSameFileReload_FunctionUpdate
(__main__.CodeReloadingObstacleTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "test_reloading.py", line 551, in
testUpdateSameFileReload_FunctionUpdate
newScriptFile = self.ReloadScriptFile(scriptDirectory,
scriptDirPath, "functions.py", mangleCallback=cb)
File "test_reloading.py", line 100, in ReloadScriptFile
result = self.codeReloader.ReloadScript(oldScriptFile)
File "/Users/sa/Code/src/livecoding/reloader.py", line 126, in
ReloadScript
newScriptFile = self.CreateNewScript(oldScriptFile)
File "/Users/sa/Code/src/livecoding/reloader.py", line 142, in
CreateNewScript
newScriptFile = scriptDirectory.LoadScript(filePath,
namespacePath)
File "/Users/sa/Code/src/livecoding/namespace.py", line 316, in
LoadScript
return self.scriptFileClass(filePath, namespacePath)
File "/Users/sa/Code/src/livecoding/namespace.py", line 29, in
__init__
self.Load(filePath)
File "/Users/sa/Code/src/livecoding/namespace.py", line 38, in Load
self.codeObject = compile(script, self.filePath, "exec")
File "/Users/sa/Code/src/livecoding/scripts/functions.py", line 2
^
SyntaxError: invalid syntax
======================================================================
FAIL: testFileChangeDetection (__main__.CodeReloaderSupportTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "test_reloading.py", line 788, in testFileChangeDetection
self.failUnless(game.FileChangeFunction.__doc__ == " new version
", "Updated function doc string value still the original one")
AssertionError: Updated function doc string value still the original
one
----------------------------------------------------------------------
Ran 15 tests in 0.431s
FAILED (failures=1, errors=1)
</snip>
Is this expected?
Best,
AliaK