Skip to content

Fix pytest parametrize by converting zip iterator to list #4169

Description

@webgo-oss

Future pytest compatibility issue in test parametrization

Description

The panel tests currently pass a zip iterator directly to pytest.mark.parametrize():

@pytest.mark.parametrize("panel,expected", zip(tests, expected))

Since zip() returns a lazy iterator in Python 3, this relies on pytest accepting iterator objects during parameter collection.

Using a concrete sequence may provide better compatibility with future pytest versions and avoids potential issues related to iterator consumption.

Suggested Change

Replace:

@pytest.mark.parametrize("panel,expected", zip(tests, expected))

with:

@pytest.mark.parametrize("panel,expected", list(zip(tests, expected)))

Benefits

  • Makes parameter values explicit during collection
  • Avoids dependence on iterator behavior
  • Improves compatibility with future pytest releases
  • Preserves existing test behavior

Impact

This change is low risk and does not modify test logic or expected outputs. It only converts the parameter source from a lazy iterator to a concrete list.

Location

Test file containing:

@pytest.mark.parametrize("panel,expected", zip(tests, expected))

Since pull requests are currently restricted for external contributors, I am opening this issue instead of submitting the proposed fix directly.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions