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

chore: Pin pytest version lower than 8.0.0 #245

Merged

Conversation

r-leyshon
Copy link
Contributor

@r-leyshon r-leyshon commented Jan 30, 2024

Description

Patch to avoid fail due to CallSpec2 AttributeError originating from pytest-8.0.0

Fixes #244

Motivation and Context

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Advice for reviewer

Error originating from current api breaking change. I presume it to be linked to our parametrized testing. Not much current chatter about this change right now from my casual googling.

Implementation in pytest 7.4.4:

@final
@dataclasses.dataclass(frozen=True)
class CallSpec2:
    """A planned parameterized invocation of a test function.

    Calculated during collection for a given test function's Metafunc.
    Once collection is over, each callspec is turned into a single Item
    and stored in item.callspec.
    """

    # arg name -> arg value which will be passed to the parametrized test
    # function (direct parameterization).
    funcargs: Dict[str, object] = dataclasses.field(default_factory=dict)
    # arg name -> arg value which will be passed to a fixture of the same name
    # (indirect parametrization).
    params: Dict[str, object] = dataclasses.field(default_factory=dict)
    # arg name -> arg index.
    indices: Dict[str, int] = dataclasses.field(default_factory=dict)
    # Used for sorting parametrized resources.
    _arg2scope: Dict[str, Scope] = dataclasses.field(default_factory=dict)
    # Parts which will be added to the item's name in `[..]` separated by "-".
    _idlist: List[str] = dataclasses.field(default_factory=list)
    # Marks which will be applied to the item.
    marks: List[Mark] = dataclasses.field(default_factory=list)

@r-leyshon r-leyshon added the bug Something isn't working label Jan 30, 2024
@r-leyshon r-leyshon added this to the sprint 7 end milestone Jan 30, 2024
@r-leyshon r-leyshon linked an issue Jan 30, 2024 that may be closed by this pull request
Copy link
Collaborator

@ethan-moss ethan-moss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for looking into this, i'm sure the debugging wasn't easy or clear!

FYI, I've raised an extra issue (#246) to capture the fact that we need to migrate to pytest v8 at some point.

@ethan-moss ethan-moss merged commit d95f698 into dev Jan 30, 2024
9 checks passed
@ethan-moss ethan-moss deleted the 244-pytest-ci-fail-callspec2-object-has-no-attribute-funcargs branch January 30, 2024 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pytest CI fail: 'CallSpec2' object has no attribute 'funcargs'
2 participants