Skip to content

On pytest < 5.3, lazy_value parameters are wrongly inserted into module_results_df as integer instead of object #43

@smarie

Description

@smarie

With pytest<5.3 when collecting results from pytest cases, the parameters appear as "111111" in module_results_df instead of their actual case name.

Cause: unfortunately on pytest < 5.3, pytest-cases lazy_values inherit from int, so as to have their id correctly created by the pytest id maker engine from their __str__ method. See https://smarie.github.io/python-pytest-cases/pytest_goodies/#parametrize

Workaround:

  • we could in pytest-harvest get_filtered_results_df wrap such lazy values (detected using is_lazy_value from pytest case) and wrap them using wrapt.ObjectProxy

  • an alternative would be to separate such lazy value instances from the other columns and give them an explicit object dtype, while letting pandas use the auto-detection for the rest.

  • last option would be in get_session_synthesis_dct to detect such values and "resolve" them

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions