Description
Using PexpectLibrary (https://github.com/lipan-sudo/PexpectLibrary) in RF 7.3 yields an error during initialization and some of the keywords fail to be registered:
docker run -ti ubuntu:22.04
[...]
# apt install pip
[...]
# pip install robotframework==7.3
[...]
# pip install PexpectLibrary==0.2.0
[...]
# cat test.robot
root@14df3f2e8fa5:/test# cat test.robot
*** Settings ***
Library PexpectLibrary
*** Test Cases ***
Test
${proc} Spawn cat
# robot .
==============================================================================
Test
==============================================================================
[ ERROR ] Error in library 'PexpectLibrary': Adding keyword 'popen_spawn' failed: Union cannot be empty.
[ ERROR ] Error in library 'PexpectLibrary': Adding keyword 'spawn' failed: Union cannot be empty.
Test.Test
==============================================================================
Test | FAIL |
No keyword with name 'Spawn' found. Did you mean:
PexpectLibrary.Spawnu
PexpectLibrary.Fd Spawn
------------------------------------------------------------------------------
Test.Test | FAIL |
1 test, 0 passed, 1 failed
==============================================================================
Test | FAIL |
1 test, 0 passed, 1 failed
==============================================================================
Output: /test/output.xml
Log: /test/log.html
Report: /test/report.html
Related past problem: https://forum.robotframework.org/t/error-in-faker-library/6743
I have debugged this to the keyword argument validation logic detecting a problem on preexec_fn: Optional[Callable[[], Any]] = None,
(https://github.com/lipan-sudo/PexpectLibrary/blob/384794dc4b917d08963cfb95d7a6a135b4f8dfec/PexpectLibrary/__init__.py#L118C15-L118C62). Removing the type hints make the keywords register successfully, but AFAIU the hints are valid and the problem is on how RF fails validation there.
Note that RF 7.2.2 did not exhibit this problem:
# pip install robotframework==7.2.2
[...]
# robot .
==============================================================================
Test
==============================================================================
Test.Test
==============================================================================
Test | PASS |
------------------------------------------------------------------------------
Test.Test | PASS |
1 test, 1 passed, 0 failed
==============================================================================
Test | PASS |
1 test, 1 passed, 0 failed
==============================================================================
Output: /test/output.xml
Log: /test/log.html
Report: /test/report.html