labs4capella / python4capella

Python for Capella
Eclipse Public License 2.0
53 stars 10 forks source link

Running unittests from CLI hangs #231

Open chgio opened 4 weeks ago

chgio commented 4 weeks ago

Thanks again for your help with #227! I'm building on it to run unittests for my scripts, but executing them from the command line makes the shell session hang -- regardless of success or failure.

I'm following the documentation on how to run scripts, and the EASE Wiki page on Unit Testing says PyUnit tests can just be run as EASE scripts, which I managed to do from the Capella GUI -- even though they seemingly require an argument, even just ., to fill argv[0].

Again, from the GUI all is well, but when I try to run them from CLI my terminal session hangs indefinitely. This happens regardless of:

It's not a big deal for local runs as I can just press CTRL+C, but it basically nullifies the whole point of running tests in a CI job as I have to manually check its outcome and request its cancellation like in [1] and [2] .

Thanks in advance!

ylussaud commented 4 weeks ago

We have tests for Python4Capella, I run them from the *.suite files. I never tried from the command line. For the argv[] I guess you could initialize it in a script that would call your tests but I'm sure other things are missing which probably cause the freeze. Just in case we have freezes when numpy is installed see this issue. Maybe you can try to apply the same patch if not done already.

To go further, you might want to look how *.suite are launched by EASE and see if you can go the same from your script. Let me know if you find something.

chgio commented 2 weeks ago

Thanks for the tip, I tried applying the patch but nothing... I don't think what's happening is a freeze, even from CLI the tests always run all the way to the results -- the terminal session just hangs after they're done.

ylussaud commented 2 weeks ago

That kind of a good news... Do you have some output in the console while tests are running ? Because I thought it might hang because of a input or output stream not being initialized properly. For instance it's not possible to input values from the console with standard Python functions in EASE... I don't know if attaching a Java debugger to the stopped Capella would help figure out what is happening, what do you think ?

chgio commented 2 weeks ago

This is from a successful test run in Docker (I swear this isn't another plug, I'm just using an environment variable in my tests and I can't get Capella to remember it locally, but that's not a big problem):

log4j:WARN No appenders could be found for logger (org.polarsys.capella.common.mdsofa.common.helper).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Executing /workspace/user/scripts/Capella-TASTE-bridges/test/test_verification_utils.py with arguments: [//In-Flight Entertainment System/In-Flight Entertainment System.aird]
18:10:04.610 [Worker-1: Auto share git projects] DEBUG org.eclipse.jgit.internal.storage.file.FileSnapshot - file=/workspace/user/scripts/Capella-TASTE-bridges/.git/config, create new FileSnapshot: lastRead=2024-10-11 18:10:04.605218477, lastModified=2024-09-15 10:02:35.960351151, size=267, fileKey=(dev=10302,ino=13905311)
18:10:04.639 [Worker-1: Auto share git projects] DEBUG org.eclipse.jgit.internal.storage.file.FileSnapshot - file=null, size changed from -1 to 0 bytes
18:10:04.640 [Worker-1: Auto share git projects] DEBUG org.eclipse.jgit.util.SystemReader - loading config FileBasedConfig[/root/.config/jgit/config]
18:10:04.642 [Worker-1: Auto share git projects] DEBUG org.eclipse.jgit.internal.storage.file.FileSnapshot - file=/root/.config/jgit/config, isRacyClean=false, read=2024-10-11 18:10:04.640468952, lastModified=1970-01-01 00:00:00.000000000, delta=1728670204640468952 ns, racy<=2500000000 ns
18:10:04.643 [Worker-1: Auto share git projects] DEBUG org.eclipse.jgit.internal.storage.file.FileSnapshot - file=/root/.config/jgit/config, is unmodified
18:10:04.644 [Worker-1: Auto share git projects] DEBUG org.eclipse.jgit.internal.storage.file.FileSnapshot - file=/root/.config/jgit/config, isRacyClean=false, read=2024-10-11 18:10:04.640468952, lastModified=1970-01-01 00:00:00.000000000, delta=1728670204640468952 ns, racy<=2500000000 ns
18:10:04.644 [Worker-1: Auto share git projects] DEBUG org.eclipse.jgit.internal.storage.file.FileSnapshot - file=/root/.config/jgit/config, is unmodified
18:10:04.644 [Worker-1: Auto share git projects] DEBUG org.eclipse.jgit.internal.storage.file.FileSnapshot - file=null, size changed from -1 to 0 bytes
18:10:04.644 [Worker-1: Auto share git projects] DEBUG org.eclipse.jgit.util.SystemReader - loading config FileBasedConfig[/root/.gitconfig]
18:10:04.645 [Worker-1: Auto share git projects] DEBUG org.eclipse.jgit.internal.storage.file.FileSnapshot - file=/workspace/user/scripts/Capella-TASTE-bridges/.git/config, create new FileSnapshot: lastRead=2024-10-11 18:10:04.645574667, lastModified=2024-09-15 10:02:35.960351151, size=267, fileKey=(dev=10302,ino=13905311)
18:10:04.648 [Worker-1: Auto share git projects] DEBUG org.eclipse.jgit.internal.storage.file.FileSnapshot - file=/root/.config/jgit/config, isRacyClean=false, read=2024-10-11 18:10:04.640468952, lastModified=1970-01-01 00:00:00.000000000, delta=1728670204640468952 ns, racy<=2500000000 ns
18:10:04.649 [Worker-1: Auto share git projects] DEBUG org.eclipse.jgit.internal.storage.file.FileSnapshot - file=/root/.config/jgit/config, is unmodified
18:10:04.649 [Worker-1: Auto share git projects] DEBUG org.eclipse.jgit.internal.storage.file.FileSnapshot - file=/root/.gitconfig, isRacyClean=false, read=2024-10-11 18:10:04.644955203, lastModified=1970-01-01 00:00:00.000000000, delta=1728670204644955203 ns, racy<=2500000000 ns
18:10:04.650 [Worker-1: Auto share git projects] DEBUG org.eclipse.jgit.internal.storage.file.FileSnapshot - file=/root/.gitconfig, is unmodified
18:10:04.650 [Worker-1: Auto share git projects] DEBUG org.eclipse.jgit.internal.storage.file.FileSnapshot - file=/workspace/user/scripts/Capella-TASTE-bridges/.git/config, isRacyClean=false, read=2024-10-11 18:10:04.645574667, lastModified=2024-09-15 10:02:35.960351151, delta=2275648685223516 ns, racy<=2500000000 ns
18:10:04.650 [Worker-1: Auto share git projects] DEBUG org.eclipse.jgit.internal.storage.file.FileSnapshot - file=/workspace/user/scripts/Capella-TASTE-bridges/.git/config, is unmodified
18:10:04.662 [Worker-1: Auto share git projects] DEBUG org.eclipse.jgit.internal.storage.file.FileSnapshot - file=/root/.config/jgit/config, isRacyClean=false, read=2024-10-11 18:10:04.640468952, lastModified=1970-01-01 00:00:00.000000000, delta=1728670204640468952 ns, racy<=2500000000 ns
18:10:04.663 [Worker-1: Auto share git projects] DEBUG org.eclipse.jgit.internal.storage.file.FileSnapshot - file=/root/.config/jgit/config, is unmodified
18:10:04.663 [Worker-1: Auto share git projects] DEBUG org.eclipse.jgit.internal.storage.file.FileSnapshot - file=/root/.gitconfig, isRacyClean=false, read=2024-10-11 18:10:04.644955203, lastModified=1970-01-01 00:00:00.000000000, delta=1728670204644955203 ns, racy<=2500000000 ns
18:10:04.663 [Worker-1: Auto share git projects] DEBUG org.eclipse.jgit.internal.storage.file.FileSnapshot - file=/root/.gitconfig, is unmodified
18:10:04.664 [Worker-1: Auto share git projects] DEBUG org.eclipse.jgit.internal.storage.file.FileSnapshot - file=/workspace/user/scripts/Capella-TASTE-bridges/.git/config, isRacyClean=false, read=2024-10-11 18:10:04.645574667, lastModified=2024-09-15 10:02:35.960351151, delta=2275648685223516 ns, racy<=2500000000 ns
18:10:04.664 [Worker-1: Auto share git projects] DEBUG org.eclipse.jgit.internal.storage.file.FileSnapshot - file=/workspace/user/scripts/Capella-TASTE-bridges/.git/config, is unmodified
18:10:04.665 [Worker-1: Auto share git projects] DEBUG org.eclipse.jgit.internal.storage.file.FileSnapshot - file=/root/.config/jgit/config, isRacyClean=false, read=2024-10-11 18:10:04.640468952, lastModified=1970-01-01 00:00:00.000000000, delta=1728670204640468952 ns, racy<=2500000000 ns
18:10:04.665 [Worker-1: Auto share git projects] DEBUG org.eclipse.jgit.internal.storage.file.FileSnapshot - file=/root/.config/jgit/config, is unmodified
18:10:04.665 [Worker-1: Auto share git projects] DEBUG org.eclipse.jgit.internal.storage.file.FileSnapshot - file=/root/.gitconfig, isRacyClean=false, read=2024-10-11 18:10:04.644955203, lastModified=1970-01-01 00:00:00.000000000, delta=1728670204644955203 ns, racy<=2500000000 ns
18:10:04.666 [Worker-1: Auto share git projects] DEBUG org.eclipse.jgit.internal.storage.file.FileSnapshot - file=/root/.gitconfig, is unmodified
18:10:04.666 [Worker-1: Auto share git projects] DEBUG org.eclipse.jgit.internal.storage.file.FileSnapshot - file=/workspace/user/scripts/Capella-TASTE-bridges/.git/config, isRacyClean=false, read=2024-10-11 18:10:04.645574667, lastModified=2024-09-15 10:02:35.960351151, delta=2275648685223516 ns, racy<=2500000000 ns
18:10:04.666 [Worker-1: Auto share git projects] DEBUG org.eclipse.jgit.internal.storage.file.FileSnapshot - file=/workspace/user/scripts/Capella-TASTE-bridges/.git/config, is unmodified
18:10:04.689 [Worker-1: Auto share git projects] DEBUG org.eclipse.jgit.internal.storage.file.FileSnapshot - file=/workspace/user/scripts/Capella-TASTE-bridges/.git/index, create new FileSnapshot: lastRead=2024-10-11 18:10:04.689305148, lastModified=2024-09-29 11:01:06.716539501, size=1901, fileKey=(dev=10302,ino=13901937)
18:10:04.712 [Worker-1: Auto share git projects] DEBUG org.eclipse.jgit.internal.storage.file.FileSnapshot - file=/workspace/user/scripts/Capella-TASTE-bridges/.git/config, create new FileSnapshot: lastRead=2024-10-11 18:10:04.712215122, lastModified=2024-09-15 10:02:35.960351151, size=267, fileKey=(dev=10302,ino=13905311)
18:10:04.714 [Worker-1: Auto share git projects] DEBUG org.eclipse.jgit.internal.storage.file.FileSnapshot - file=/root/.config/jgit/config, isRacyClean=false, read=2024-10-11 18:10:04.640468952, lastModified=1970-01-01 00:00:00.000000000, delta=1728670204640468952 ns, racy<=2500000000 ns
18:10:04.714 [Worker-1: Auto share git projects] DEBUG org.eclipse.jgit.internal.storage.file.FileSnapshot - file=/root/.config/jgit/config, is unmodified
18:10:04.715 [Worker-1: Auto share git projects] DEBUG org.eclipse.jgit.internal.storage.file.FileSnapshot - file=/root/.gitconfig, isRacyClean=false, read=2024-10-11 18:10:04.644955203, lastModified=1970-01-01 00:00:00.000000000, delta=1728670204644955203 ns, racy<=2500000000 ns
18:10:04.715 [Worker-1: Auto share git projects] DEBUG org.eclipse.jgit.internal.storage.file.FileSnapshot - file=/root/.gitconfig, is unmodified
18:10:04.716 [Worker-1: Auto share git projects] DEBUG org.eclipse.jgit.internal.storage.file.FileSnapshot - file=/workspace/user/scripts/Capella-TASTE-bridges/.git/config, create new FileSnapshot: lastRead=2024-10-11 18:10:04.715896881, lastModified=2024-09-15 10:02:35.960351151, size=267, fileKey=(dev=10302,ino=13905311)
18:10:04.717 [Worker-1: Auto share git projects] DEBUG org.eclipse.jgit.internal.storage.file.FileSnapshot - file=/root/.config/jgit/config, isRacyClean=false, read=2024-10-11 18:10:04.640468952, lastModified=1970-01-01 00:00:00.000000000, delta=1728670204640468952 ns, racy<=2500000000 ns
18:10:04.718 [Worker-1: Auto share git projects] DEBUG org.eclipse.jgit.internal.storage.file.FileSnapshot - file=/root/.config/jgit/config, is unmodified
18:10:04.718 [Worker-1: Auto share git projects] DEBUG org.eclipse.jgit.internal.storage.file.FileSnapshot - file=/root/.gitconfig, isRacyClean=false, read=2024-10-11 18:10:04.644955203, lastModified=1970-01-01 00:00:00.000000000, delta=1728670204644955203 ns, racy<=2500000000 ns
18:10:04.719 [Worker-1: Auto share git projects] DEBUG org.eclipse.jgit.internal.storage.file.FileSnapshot - file=/root/.gitconfig, is unmodified
18:10:04.719 [Worker-1: Auto share git projects] DEBUG org.eclipse.jgit.internal.storage.file.FileSnapshot - file=/workspace/user/scripts/Capella-TASTE-bridges/.git/config, isRacyClean=false, read=2024-10-11 18:10:04.715896881, lastModified=2024-09-15 10:02:35.960351151, delta=2275648755545730 ns, racy<=2500000000 ns
18:10:04.719 [Worker-1: Auto share git projects] DEBUG org.eclipse.jgit.internal.storage.file.FileSnapshot - file=/workspace/user/scripts/Capella-TASTE-bridges/.git/config, is unmodified
18:10:04.720 [Worker-1: Auto share git projects] DEBUG org.eclipse.jgit.internal.storage.file.FileSnapshot - file=/root/.config/jgit/config, isRacyClean=false, read=2024-10-11 18:10:04.640468952, lastModified=1970-01-01 00:00:00.000000000, delta=1728670204640468952 ns, racy<=2500000000 ns
18:10:04.721 [Worker-1: Auto share git projects] DEBUG org.eclipse.jgit.internal.storage.file.FileSnapshot - file=/root/.config/jgit/config, is unmodified
18:10:04.721 [Worker-1: Auto share git projects] DEBUG org.eclipse.jgit.internal.storage.file.FileSnapshot - file=/root/.gitconfig, isRacyClean=false, read=2024-10-11 18:10:04.644955203, lastModified=1970-01-01 00:00:00.000000000, delta=1728670204644955203 ns, racy<=2500000000 ns
18:10:04.721 [Worker-1: Auto share git projects] DEBUG org.eclipse.jgit.internal.storage.file.FileSnapshot - file=/root/.gitconfig, is unmodified
18:10:04.722 [Worker-1: Auto share git projects] DEBUG org.eclipse.jgit.internal.storage.file.FileSnapshot - file=/workspace/user/scripts/Capella-TASTE-bridges/.git/config, isRacyClean=false, read=2024-10-11 18:10:04.715896881, lastModified=2024-09-15 10:02:35.960351151, delta=2275648755545730 ns, racy<=2500000000 ns
18:10:04.722 [Worker-1: Auto share git projects] DEBUG org.eclipse.jgit.internal.storage.file.FileSnapshot - file=/workspace/user/scripts/Capella-TASTE-bridges/.git/config, is unmodified
18:10:04.723 [Worker-1: Auto share git projects] DEBUG org.eclipse.jgit.internal.storage.file.FileSnapshot - file=/root/.config/jgit/config, isRacyClean=false, read=2024-10-11 18:10:04.640468952, lastModified=1970-01-01 00:00:00.000000000, delta=1728670204640468952 ns, racy<=2500000000 ns
18:10:04.723 [Worker-1: Auto share git projects] DEBUG org.eclipse.jgit.internal.storage.file.FileSnapshot - file=/root/.config/jgit/config, is unmodified
18:10:04.724 [Worker-1: Auto share git projects] DEBUG org.eclipse.jgit.internal.storage.file.FileSnapshot - file=/root/.gitconfig, isRacyClean=false, read=2024-10-11 18:10:04.644955203, lastModified=1970-01-01 00:00:00.000000000, delta=1728670204644955203 ns, racy<=2500000000 ns
18:10:04.724 [Worker-1: Auto share git projects] DEBUG org.eclipse.jgit.internal.storage.file.FileSnapshot - file=/root/.gitconfig, is unmodified
18:10:04.724 [Worker-1: Auto share git projects] DEBUG org.eclipse.jgit.internal.storage.file.FileSnapshot - file=/workspace/user/scripts/Capella-TASTE-bridges/.git/config, isRacyClean=false, read=2024-10-11 18:10:04.715896881, lastModified=2024-09-15 10:02:35.960351151, delta=2275648755545730 ns, racy<=2500000000 ns
18:10:04.725 [Worker-1: Auto share git projects] DEBUG org.eclipse.jgit.internal.storage.file.FileSnapshot - file=/workspace/user/scripts/Capella-TASTE-bridges/.git/config, is unmodified
18:10:04.726 [Worker-1: Auto share git projects] DEBUG org.eclipse.jgit.internal.storage.file.FileSnapshot - file=/workspace/user/scripts/Capella-TASTE-bridges/.git/index, create new FileSnapshot: lastRead=2024-10-11 18:10:04.726054340, lastModified=2024-09-29 11:01:06.716539501, size=1901, fileKey=(dev=10302,ino=13901937)
/opt/capella-7.0.0/capella/plugins/org.eclipse.ease.lang.python.py4j_0.9.0.I202206141122/pysrc/ease_py4j_main.py:414: DeprecationWarning: setDaemon() is deprecated, set the daemon attribute instead
  thread.setDaemon(True)
!SESSION 2024-10-11 18:09:52.455 -----------------------------------------------
eclipse.buildId=unknown
java.version=17.0.11
java.vendor=Eclipse Adoptium
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Framework arguments:  -application org.polarsys.capella.core.commandline.core -appid org.eclipse.python4capella.commandline -import /opt/capella-7.0.0/Python4Capella|/workspace/user/scripts/Capella-TASTE-bridges|/workspace/sample/models/In-Flight Entertainment System /workspace/user/scripts/Capella-TASTE-bridges/test/test_verification_utils.py //In-Flight Entertainment System/In-Flight Entertainment System.aird
Command-line arguments:  -os linux -ws gtk -arch x86_64 -consolelog -application org.polarsys.capella.core.commandline.core -appid org.eclipse.python4capella.commandline -data /opt/capella-7.0.0/workspace -import /opt/capella-7.0.0/Python4Capella|/workspace/user/scripts/Capella-TASTE-bridges|/workspace/sample/models/In-Flight Entertainment System /workspace/user/scripts/Capella-TASTE-bridges/test/test_verification_utils.py //In-Flight Entertainment System/In-Flight Entertainment System.aird

!ENTRY org.python.pydev.shared_core 4 4 2024-10-11 18:10:05.215
!MESSAGE Did not expect the interpreter manager to be null.
!STACK 0
org.python.pydev.core.ProjectMisconfiguredException: Did not expect the interpreter manager to be null.
    at org.python.pydev.plugin.nature.PythonNature.getProjectInterpreter(PythonNature.java:1349)
    at org.python.pydev.plugin.nature.PythonPathNature.getVariableSubstitution(PythonPathNature.java:520)
    at org.python.pydev.plugin.nature.PythonPathNature.getVariableSubstitution(PythonPathNature.java:503)
    at org.python.pydev.core.docutils.StringSubstitution.<init>(StringSubstitution.java:57)
    at org.python.pydev.plugin.nature.PythonPathNature.getOnlyProjectPythonPathStr(PythonPathNature.java:166)
    at org.python.pydev.plugin.nature.PythonNature$RebuildPythonNatureModules.run(PythonNature.java:138)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

!ENTRY org.python.pydev.shared_core 4 4 2024-10-11 18:10:05.353
!MESSAGE Info: Rebuilding internal caches: /opt/capella-7.0.0/workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/Capella-TASTE-bridges/com.python.pydev.analysis/AdditionalProjectInterpreterInfo.pydevinfo (Expected error to be provided and got no error!)

!ENTRY org.python.pydev.shared_core 4 4 2024-10-11 18:10:05.537
!MESSAGE Info: Rebuilding internal caches: /opt/capella-7.0.0/workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/Python4Capella/com.python.pydev.analysis/AdditionalProjectInterpreterInfo.pydevinfo (Expected error to be provided and got no error!)

!ENTRY org.eclipse.ease.lang.python 4 0 2024-10-11 18:10:10.135
!MESSAGE The method name "zip" from the module "__EASE_MOD_org_eclipse_ease_modules_platform_resources_ResourcesModule" can not be wrapped because it's name is reserved

!ENTRY org.eclipse.ease.lang.python 4 0 2024-10-11 18:10:11.141
!MESSAGE The method name "zip" from the module "__EASE_MOD_org_eclipse_ease_modules_platform_resources_ResourcesModule" can not be wrapped because it's name is reserved

!ENTRY org.eclipse.ease.lang.python 4 0 2024-10-11 18:10:11.855
!MESSAGE The method name "zip" from the module "__EASE_MOD_org_eclipse_ease_modules_platform_resources_ResourcesModule" can not be wrapped because it's name is reserved

!ENTRY org.eclipse.ease.lang.python 4 0 2024-10-11 18:10:12.221
!MESSAGE The method name "zip" from the module "__EASE_MOD_org_eclipse_ease_modules_platform_resources_ResourcesModule" can not be wrapped because it's name is reserved

!ENTRY org.eclipse.ease.lang.python 4 0 2024-10-11 18:10:12.974
!MESSAGE The method name "zip" from the module "__EASE_MOD_org_eclipse_ease_modules_platform_resources_ResourcesModule" can not be wrapped because it's name is reserved

!ENTRY org.eclipse.ease.lang.python 4 0 2024-10-11 18:10:13.348
!MESSAGE The method name "zip" from the module "__EASE_MOD_org_eclipse_ease_modules_platform_resources_ResourcesModule" can not be wrapped because it's name is reserved

!ENTRY org.eclipse.sirius.diagram 1 0 2024-10-11 18:10:39.239
!MESSAGE Migration done for "WorkspaceImage GMF Bounds" (Ensure the session is saved to persist the migration effects. Please have a look at documentation about the project migration):
    * GMF bounds of WorkspaceImage have been resized according to its Size Computation Expression in diagram "[PAB] [BUILD] Template".
    * GMF bounds of WorkspaceImage have been resized according to its Size Computation Expression in diagram "[SDFB] [CAPABILITY] Provide Video Entertainment Services".
....
----------------------------------------------------------------------
Ran 4 tests in 33.303s

OK
^C
Traceback (most recent call last):
  File "/opt/capella-7.0.0/capella/plugins/org.eclipse.ease.lang.python.py4j_0.9.0.I202206141122/pysrc/ease_py4j_main.py", line 427, in <module>
    _pyease_main(_pyease_sys.argv)
  File "/opt/capella-7.0.0/capella/plugins/org.eclipse.ease.lang.python.py4j_0.9.0.I202206141122/pysrc/ease_py4j_main.py", line 418, in _pyease_main
    engine.wait_on_shutdown()
  File "/opt/capella-7.0.0/capella/plugins/org.eclipse.ease.lang.python.py4j_0.9.0.I202206141122/pysrc/ease_py4j_main.py", line 367, in wait_on_shutdown
    self.shutdown_event.wait()
  File "/usr/lib/python3.11/threading.py", line 622, in wait

And this is from an erroring local test run:

log4j:WARN No appenders could be found for logger (org.polarsys.capella.common.mdsofa.common.helper).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Executing workspace:/Capella-TASTE-bridges/test/test_verification_utils.py with arguments: [.]
org.eclipse.ease.ScriptExecutionException: Traceback (most recent call last):
  File "<...>", line 17, in <module>
ModuleNotFoundError: No module named 'imp'

!SESSION 2024-10-11 20:21:42.853 -----------------------------------------------
eclipse.buildId=unknown
java.version=17.0.11
java.vendor=Eclipse Adoptium
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Framework arguments:  -application org.polarsys.capella.core.commandline.core -appid org.eclipse.python4capella.commandline workspace:/Capella-TASTE-bridges/test/test_verification_utils.py .
Command-line arguments:  -os linux -ws gtk -arch x86_64 -consolelog -application org.polarsys.capella.core.commandline.core -appid org.eclipse.python4capella.commandline -data /home/gio/capella/workspace workspace:/Capella-TASTE-bridges/test/test_verification_utils.py .

!ENTRY org.eclipse.ease.lang.python 4 0 2024-10-11 20:21:51.142
!MESSAGE The method name "zip" from the module "__EASE_MOD_org_eclipse_ease_modules_platform_resources_ResourcesModule" can not be wrapped because it's name is reserved

!ENTRY org.eclipse.ease.lang.python 4 0 2024-10-11 20:21:52.096
!MESSAGE The method name "zip" from the module "__EASE_MOD_org_eclipse_ease_modules_platform_resources_ResourcesModule" can not be wrapped because it's name is reserved

!ENTRY org.eclipse.ease.lang.python 4 0 2024-10-11 20:21:53.033
!MESSAGE The method name "zip" from the module "__EASE_MOD_org_eclipse_ease_modules_platform_resources_ResourcesModule" can not be wrapped because it's name is reserved

!ENTRY org.eclipse.ease.lang.python 4 0 2024-10-11 20:21:53.480
!MESSAGE The method name "zip" from the module "__EASE_MOD_org_eclipse_ease_modules_platform_resources_ResourcesModule" can not be wrapped because it's name is reserved

!ENTRY org.eclipse.ease.lang.python 4 0 2024-10-11 20:21:54.432
!MESSAGE The method name "zip" from the module "__EASE_MOD_org_eclipse_ease_modules_platform_resources_ResourcesModule" can not be wrapped because it's name is reserved

!ENTRY org.eclipse.ease.lang.python 4 0 2024-10-11 20:21:54.826
!MESSAGE The method name "zip" from the module "__EASE_MOD_org_eclipse_ease_modules_platform_resources_ResourcesModule" can not be wrapped because it's name is reserved
EEEE
======================================================================
ERROR: test_fsm_states_as_string_simple (__main__.TestFSMAsAsString.test_fsm_states_as_string_simple)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "workspace://Capella-TASTE-bridges/test/common.py", line 17, in setUp
    # sys.argv[2:] - optional - paths to prepend on sys.path
                                      ^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen os>", line 714, in __getitem__
KeyError: 'TEST_EXPECTATIONS_PATH'

======================================================================
ERROR: test_fsm_states_as_string_verbose (__main__.TestFSMAsAsString.test_fsm_states_as_string_verbose)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "workspace://Capella-TASTE-bridges/test/common.py", line 17, in setUp
    # sys.argv[2:] - optional - paths to prepend on sys.path
                                      ^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen os>", line 714, in __getitem__
KeyError: 'TEST_EXPECTATIONS_PATH'

======================================================================
ERROR: test_fsm_transitions_as_string_simple (__main__.TestFSMAsAsString.test_fsm_transitions_as_string_simple)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "workspace://Capella-TASTE-bridges/test/common.py", line 17, in setUp
    # sys.argv[2:] - optional - paths to prepend on sys.path
                                      ^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen os>", line 714, in __getitem__
KeyError: 'TEST_EXPECTATIONS_PATH'

======================================================================
ERROR: test_fsm_transitions_as_string_verbose (__main__.TestFSMAsAsString.test_fsm_transitions_as_string_verbose)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "workspace://Capella-TASTE-bridges/test/common.py", line 17, in setUp
    # sys.argv[2:] - optional - paths to prepend on sys.path
                                      ^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen os>", line 714, in __getitem__
KeyError: 'TEST_EXPECTATIONS_PATH'

----------------------------------------------------------------------
Ran 4 tests in 0.002s

FAILED (errors=4)
^C
Traceback (most recent call last):
  File "/home/gio/capella/plugins/org.eclipse.ease.lang.python.py4j_0.9.0.I202206141122/pysrc/ease_py4j_main.py", line 427, in <module>
    _pyease_main(_pyease_sys.argv)
  File "/home/gio/capella/plugins/org.eclipse.ease.lang.python.py4j_0.9.0.I202206141122/pysrc/ease_py4j_main.py", line 418, in _pyease_main
    engine.wait_on_shutdown()
  File "/home/gio/capella/plugins/org.eclipse.ease.lang.python.py4j_0.9.0.I202206141122/pysrc/ease_py4j_main.py", line 367, in wait_on_shutdown
    self.shutdown_event.wait()
  File "/usr/lib/python3.12/threading.py", line 655, in wait
    signaled = self._cond.wait(timeout)
               ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/threading.py", line 355, in wait
    waiter.acquire()
KeyboardInterrupt

I imagine the most relevant part would be after the ^Cs, but I've still included the entire -consolelog dump for completeness.

chgio commented 2 weeks ago

I've tried to follow the same approach as #112, but just commenting ease_py4j_main.py:418:

418c418
-     engine.wait_on_shutdown()
---
+     #engine.wait_on_shutdown()

prevents the tests from getting executed altogether:

log4j:WARN No appenders could be found for logger (org.polarsys.capella.common.mdsofa.common.helper).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Executing workspace:/Capella-TASTE-bridges/test/test_verification_utils.py with arguments: [.]
!SESSION 2024-10-11 20:53:17.152 -----------------------------------------------
eclipse.buildId=unknown
java.version=17.0.11
java.vendor=Eclipse Adoptium
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Framework arguments:  -application org.polarsys.capella.core.commandline.core -appid org.eclipse.python4capella.commandline workspace:/Capella-TASTE-bridges/test/test_verification_utils.py .
Command-line arguments:  -os linux -ws gtk -arch x86_64 -consolelog -application org.polarsys.capella.core.commandline.core -appid org.eclipse.python4capella.commandline -data /home/gio/capella/workspace workspace:/Capella-TASTE-bridges/test/test_verification_utils.py .

!ENTRY org.eclipse.core.jobs 4 2 2024-10-11 20:53:20.904
!MESSAGE An internal error occurred during: "[EASE Python (Py4J) Engine]".
!STACK 0
py4j.Py4JException: Error while obtaining a new communication channel
    at py4j.CallbackClient.getConnectionLock(CallbackClient.java:257)
    at py4j.CallbackClient.sendCommand(CallbackClient.java:377)
    at py4j.CallbackClient.sendCommand(CallbackClient.java:356)
    at py4j.reflection.PythonProxyHandler.invoke(PythonProxyHandler.java:106)
    at jdk.proxy3/jdk.proxy3.$Proxy4.internalSetVariable(Unknown Source)
    at org.eclipse.ease.lang.python.py4j.internal.Py4jScriptEngine.internalSetVariable(Py4jScriptEngine.java:358)
    at org.eclipse.ease.AbstractScriptEngine.setVariable(AbstractScriptEngine.java:541)
    at org.eclipse.ease.AbstractScriptEngine.setupRun(AbstractScriptEngine.java:274)
    at org.eclipse.ease.AbstractScriptEngine.run(AbstractScriptEngine.java:235)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Caused by: java.net.ConnectException: Connection refused
    at java.base/sun.nio.ch.Net.connect0(Native Method)
    at java.base/sun.nio.ch.Net.connect(Net.java:579)
    at java.base/sun.nio.ch.Net.connect(Net.java:568)
    at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:593)
    at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:327)
    at java.base/java.net.Socket.connect(Socket.java:633)
    at java.base/java.net.Socket.connect(Socket.java:583)
    at java.base/java.net.Socket.<init>(Socket.java:507)
    at java.base/java.net.Socket.<init>(Socket.java:319)
    at java.base/javax.net.DefaultSocketFactory.createSocket(SocketFactory.java:277)
    at py4j.PythonClient.startClientSocket(PythonClient.java:192)
    at py4j.PythonClient.getConnection(PythonClient.java:213)
    at py4j.CallbackClient.getConnectionLock(CallbackClient.java:250)
    ... 9 more

This seems like a problem with EASE/py4j itself... Should I file it under EASE or py4j issues?

ylussaud commented 2 weeks ago

At least you can ask. But Python4Capella doesn't use the last version of EASE. We use 0.8.0 and there is a 0.9.0 release. So far I kept this version to be able to install it on a Capella 1.4.2 (as far as I recall). You could try to update EASE if possible and see if it helps. If not you can open a bug.

The EASE 0.9.0 update site: https://download.eclipse.org/ease/release/0.9.0/

The EASE bugzilla: https://bugs.eclipse.org/bugs/describecomponents.cgi?product=Ease

If you open an issue there can you link it here please. That will be easier for me to keep track. The answer might be to use the EASE test suite... In this case a Capella command line could be used to run EASE *.suite files.

I don't think PyDev is involved here since it's the development environment and PyDev plugins start but should not be used.

chgio commented 2 days ago

Thanks for the tip, I checked and turns out I was already installing EASE 0.9.0, so unless the subsequent Py4C installation is forcing a rollback this should still be unfixed.

I've opened an issue on EASE GitLab, fingers crossed!