Tests and example do not run after build
Build now passes after https://github.com/touilleMan/godot-python/commit/b3f4b9c33576da39bc24416bb5ac05332e8acccb, but unfortunately the test and examples don't run afterwards, with the following error:
$ scons platform=x11-64 example
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
SymLinkAction(["build/main"], ["build/pythonscript-x11-64"])
platforms/x11-64/godot.x11.opt.debug.64 --path /home/nym/godot-python/examples/pong
ERROR: _load_settings_text: Condition ' config_version > 3 ' is true. returned: ERR_FILE_CANT_OPEN
At: core/project_settings.cpp:495.
ERROR: _load_settings_text_or_binary: Couldn't load file '/home/nym/godot-python/examples/pong/project.godot', error code 12.
At: core/project_settings.cpp:519.
Error: Could not load game path '.'.
scons: *** [examples/pong] Error 255
scons: building terminated because of errors.
As for the test variant, it's basically the same, just referring to the project.godot file in tests/bindings instead of examples/pong.
The error suggests to me that there must be some missing files, but I can't imagine what is missing...
What version of godot is in platforms/x11-64/godot.x11.opt.debug.64 ?
I guess the godot version maybe too old to work with the project...
if so I guess we have to modify the code here https://github.com/touilleMan/godot-python/blob/72df9d1b38120aeec3c702004e14dcb82e95bde5/SConstruct#L40-L43 PR welcome ^^
I deleted the local godot version I had, but that URL suggests a Godot build of almost 2 years ago! I'll happily change, test, and PR when I have a fresher head in a few hours time. :)
Partially fixed with https://github.com/curradium/godot-python/commit/01f88697575ddea8d8d4d67fd4b39b1093c5656e. Note that it now uses Godot's own download repository rather than the seemingly abandoned GodotBuilder repo, which is assumedly no problem.
Unfortunately, that fix gave rise to more errors. This is the test run; the example run gives more errors, but I'd hope that it's the same fix needed for both, the example run just complains more.
(Disregard the "prime-run" part, it's just a GPU switching command for multi-GPU systems.)
$ prime-run scons platform=x11-64 test
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
SymLinkAction(["build/main"], ["build/pythonscript-x11-64"])
platforms/x11-64/Godot_v3.2-stable_x11.64 --path /home/nym/godot-python/tests/bindings
Godot Engine v3.2.stable.official - https://godotengine.org
OpenGL ES 3.0 Renderer: GeForce 940MX/PCIe/SSE2
ERROR: get_singleton_object: Failed to retrieve non-existent singleton 'ARVRServer'.
At: core/engine.cpp:196.
ERROR: get_singleton_object: Failed to retrieve non-existent singleton 'AudioServer'.
At: core/engine.cpp:196.
ERROR: get_singleton_object: Failed to retrieve non-existent singleton 'CameraServer'.
At: core/engine.cpp:196.
ERROR: get_singleton_object: Failed to retrieve non-existent singleton 'Physics2DServer'.
At: core/engine.cpp:196.
ERROR: get_singleton_object: Failed to retrieve non-existent singleton 'PhysicsServer'.
At: core/engine.cpp:196.
ERROR: get_singleton_object: Failed to retrieve non-existent singleton 'VisualServer'.
At: core/engine.cpp:196.
ERROR: get_singleton_object: Failed to retrieve non-existent singleton 'VisualScriptEditor'.
At: core/engine.cpp:196.
Pythonscript 0.20.1+dev (CPython 3.7.1.final.0)
PYTHONPATH: ['/home/nym/godot-python/tests/bindings/pythonscript/lib/python37.zip', '/home/nym/godot-python/tests/bindings/pythonscript/lib/python3.7', '/home/nym/godot-python/tests/bindings/pythonscript/lib/python3.7/lib-dynload', '/home/nym/godot-python/tests/bindings/pythonscript/lib/python3.7/site-packages', '/home/nym/godot-python/tests/bindings/', '/home/nym/godot-python/tests/bindings/lib']
Loading python script from res://main.py
running `pytest test_plane.py test_pool_arrays.py test_vector3.py test_transform2d.py test_rid.py test_color.py test_quat.py test_node_path.py test_rect2.py test_basis.py test_array.py test_starimport.py test_tools.py test_aabb.py test_dynamic_bindings.py test_transform.py test_bindings.py test_vector2.py test_dictionary.py`
====================================== test session starts ======================================
platform linux -- Python 3.7.1, pytest-3.0.5, py-1.4.31, pluggy-0.4.0
rootdir: /home/nym/godot-python/tests/bindings, inifile: pytest.ini
collecting 953 items
scons: *** [tests/bindings] Error -6
scons: building terminated because of errors.
Frankly, I have no insight on this whatsoever...
Ok, you're almost done here ;-)
ERROR: get_singleton_object: Failed to retrieve non-existent singleton 'XXX'.
If Godot doesn't return a correct object pointer when godot-python ask for the singleton, we get a crash as soon as we try to access the singleton from python. But I don't think we use those singletons from the tests so it should be ok (well obviously we should improve the code retrieving the singleton to avoid having invalid pyhton objects...)
Can you try with scons platform=x11-64 test sample=true ? (this only build a limited number of godot class bindings so the build is much faster, given I do most of the development with this option, maybe your issue comes from the size of the bindings.so module when everything is shipped...)
You should also put a import pdb; pdb.set_trace() in https://github.com/touilleMan/godot-python/blob/master/tests/bindings/main.py#L37
This way would be able to have a better idea of what pytest is doing. My guess is there maybe a subtle MacOS-specific stuff involved with the import system that prevent pytest from running the tests that impor the godot module...