Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Versions 2.4.0 and later crash when the test case is started inside VSCode using the RobotCode (d-biehl.robotcode) extension. #77

Open
JasonFerrara opened this issue Jan 24, 2024 · 2 comments

Comments

@JasonFerrara
Copy link

With robotframework-debuglibrary 2.40 and later, when the Debug keyword is called in a test case started in VSCode using the RobotCode extension instead of getting the interactive debug prompt you get...

| FAIL | asyncio.run() cannot be called from a running event loop

Version 2.3.0 works as expected.

Attached is a sample VSCode project that show the problem. Open the project in VSCode, click "Reopen in Container". After the project reloads open the debugtest.robot file and click the run button next to the Check DebugLibrary test case. Instead of the interactive prompt you'll get...

 /workspaces/robotdebuglibrarybug #  /usr/bin/env /usr/bin/python /root/.vscode-server/extensions/d-biehl.robotcode-0.69.0/bundled/tool/robotcode --default-path . debug --
no-debug -- --parse-include debugtest.robot --name Robotdebuglibrarybug --suite Robotdebuglibrarybug.Debugtest --by-longname Robotdebuglibrarybug.Debugtest.Check\ DebugLi
brary 
==============================================================================
Robotdebuglibrarybug                                                          
==============================================================================
Robotdebuglibrarybug.Debugtest                                                
==============================================================================
Check DebugLibrary                                                    
>>>>> Enter interactive shell
Only accepted plain text format keyword separated with two or more spaces.
Type "help" for more information.
Check DebugLibrary                                                    | FAIL |
asyncio.run() cannot be called from a running event loop
------------------------------------------------------------------------------
Robotdebuglibrarybug.Debugtest                                        | FAIL |
1 test, 0 passed, 1 failed
==============================================================================
Robotdebuglibrarybug                                                  | FAIL |
1 test, 0 passed, 1 failed
==============================================================================
Output:  /workspaces/robotdebuglibrarybug/results/output.xml
Log:     /workspaces/robotdebuglibrarybug/results/log.html
Report:  /workspaces/robotdebuglibrarybug/results/report.html
sys:1: RuntimeWarning: coroutine 'Application.run_async' was never awaited
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
/workspaces/robotdebuglibrarybug # 

If you edit the Dockerfile to install robotframework-debuglibrary 2.3.0 instead of 2.5.0 when you run the test case you'll get...

/workspaces/robotdebuglibrarybug #  /usr/bin/env /usr/bin/python /root/.vscode-server/extensions/d-biehl.robotcode-0.69.0/
bundled/tool/robotcode --default-path . debug --no-debug -- --parse-include debugtest.robot --name Robotdebuglibrarybug --
suite Robotdebuglibrarybug.Debugtest --by-longname Robotdebuglibrarybug.Debugtest.Check\ DebugLibrary 
==============================================================================
Robotdebuglibrarybug                                                          
==============================================================================
Robotdebuglibrarybug.Debugtest                                                
==============================================================================
Check DebugLibrary                                                    
>>>>> Enter interactive shell
Only accepted plain text format keyword separated with two or more spaces.
Type "help" for more information.
>    

as expected.
robotdebuglibrarybug.tar.gz

@xyb
Copy link
Owner

xyb commented Jan 26, 2024

@JasonFerrara The only significant change from v2.3.0 to v2.4.0 is that prompt-toolkit was upgraded from v2 to v3.

Also, I've noticed that both prompt-toolkit and RobotCode are using eventloop, which may be the cause of the issue.

Maybe I can add a switch to let prompt-toolkit choose not to use eventloop, but I'm not sure if prompt-toolkit supports this. Any more suggestions would also be welcome.

You can use v2.3.0 for now until this issue is resolved.

@Snooz82
Copy link
Collaborator

Snooz82 commented Oct 30, 2024

I think that issue should be solved on the RobotCode side.
I can not reproduce it with RobotCode and DebugLibrary 2.5.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants