You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
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
Activity
[-]Pytest has not attribute 'StashKey'[/-][+]Pytest has not attribute `StashKey`[/+]nicoddemus commentedon Mar 11, 2024
Not sure what happened in your case, but
pytest.StashKeyis still available.EngineerHus commentedon Mar 11, 2024
Sorry if I wasn't clear, but I am not saying
StashKeyisn't available in general, I meant that it is not available for pytest 5.3.5 anymore. On pytest 7.0.0+, theStashKeyseems to be still availabledoc: add versionadded to `Stash` and `StashKey`
bluetech commentedon Mar 11, 2024
@EngineerHus thanks for the suggestion, submitted #12108.
nicoddemus commentedon Mar 11, 2024
Sorry @EngineerHus, I misunderstood the original post. Thanks. 👍
EngineerHus commentedon Mar 11, 2024
Much thanks
doc: add versionadded to `Stash` and `StashKey`