Skip to content

Pytest has not attribute StashKey #12107

Closed

Description

@EngineerHus

Hi All,

On our CI environment, we have been running our pytests for some time now, but weirdly now, we are seeing an error, which is AttributeError: module 'pytest' has no attribute 'StashKey'

We are running pytest with version 5.3.5 so my initial thought was maybe due to the 2 recent releases last week, maybe StashKey is not supported anymore so I had to do trial and error by installing different pytest versions and finding out which is the oldest pytest version that still supports this.

As of now, the oldest pytest version that supports StashKey seems to be 7.0.0. Could one of the devs please maybe update the docs so future pytesters would be able to figure this out?

Thanks

Activity

  1. changed the title [-]Pytest has not attribute 'StashKey'[/-] [+]Pytest has not attribute `StashKey`[/+] on Mar 11, 2024
  2. nicoddemus commented on Mar 11, 2024

    @nicoddemus
    Member

    Not sure what happened in your case, but pytest.StashKey is still available.

    λ pytest --version
    pytest 8.2.0.dev2+g0951cbc6e.d20240304
    
    λ python
    Python 3.10.9 (tags/v3.10.9:1dd9be6, Dec  6 2022, 20:01:21) [MSC v.1934 64 bit (AMD64)] on win32
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import pytest
    >>> pytest.StashKey
    <class '_pytest.stash.StashKey'>
    
  3. added
    status: needs informationreporter needs to provide more information; can be closed after 2 or more weeks of inactivity
    on Mar 11, 2024
  4. EngineerHus commented on Mar 11, 2024

    @EngineerHus
    Author

    Not sure what happened in your case, but pytest.StashKey is still available.

    λ pytest --version
    pytest 8.2.0.dev2+g0951cbc6e.d20240304
    
    λ python
    Python 3.10.9 (tags/v3.10.9:1dd9be6, Dec  6 2022, 20:01:21) [MSC v.1934 64 bit (AMD64)] on win32
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import pytest
    >>> pytest.StashKey
    <class '_pytest.stash.StashKey'>
    

    Sorry if I wasn't clear, but I am not saying StashKey isn't available in general, I meant that it is not available for pytest 5.3.5 anymore. On pytest 7.0.0+, the StashKey seems to be still available

  5. added a commit that references this issue on Mar 11, 2024
    7eaaf37
  6. bluetech commented on Mar 11, 2024

    @bluetech
    Member

    @EngineerHus thanks for the suggestion, submitted #12108.

  7. nicoddemus commented on Mar 11, 2024

    @nicoddemus
    Member

    Sorry @EngineerHus, I misunderstood the original post. Thanks. 👍

  8. EngineerHus commented on Mar 11, 2024

    @EngineerHus
    Author

    @EngineerHus thanks for the suggestion, submitted #12108.

    Much thanks

  9. added a commit that references this issue on Apr 9, 2024
    8b97a77
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: needs informationreporter needs to provide more information; can be closed after 2 or more weeks of inactivity

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions