Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Log Variables should not consume iterables #5005

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

Closed
kstine opened this issue Jan 5, 2024 · 1 comment
Closed

Log Variables should not consume iterables #5005

kstine opened this issue Jan 5, 2024 · 1 comment

Comments

@kstine
Copy link
Contributor

kstine commented Jan 5, 2024

Found in Robot Framework 6.1.1 and 7.0rc2
Python 3.11

Given this example:

Cycle Test
    ${TEST_LIST}    Create List    beginning    1    2    3    4    end
    ${CYCLE_TEST}    Evaluate    itertools.cycle($TEST_LIST)
    Set Test Variable    ${CYCLE_TEST}
    Log Variables

When executing this case
Then Robot Framework will pause for a while and eventually throw a Memory Error.

This might be an uncommon situation, but would be nice to handle iterable objects.
My current workaround is to avoid assigning the itertools.cycle() to a RF variable and handle everything within a library.

@pekkaklarck pekkaklarck added this to the v7.0 milestone Jan 6, 2024
@pekkaklarck pekkaklarck self-assigned this Jan 6, 2024
@pekkaklarck pekkaklarck changed the title Log Variables causes Robot Framework to throw MemoryError Log Variables should not consume iterables Jan 6, 2024
@pekkaklarck
Copy link
Member

This occurs due to the following reasons:

  • Log Variables logs all list-like values so that all their items are logged separately.
  • Robot considers all iterable objects list-like.
  • itertools.cycle() is a never-ending iterable. Trying to log all its items is not possible.

This is pretty annoying and can be considered a bug. The same behavior causes also all iterables that are finite to be consumed.

An easy solution to this issue is changing the behavior so that we log all items only with sequences and with iterables we log the iterable itself.

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

2 participants