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

Pytest has not attribute StashKey #12107

Closed
EngineerHus opened this issue Mar 11, 2024 · 5 comments · Fixed by #12108
Closed

Pytest has not attribute StashKey #12107

EngineerHus opened this issue Mar 11, 2024 · 5 comments · Fixed by #12108
Labels
status: needs information reporter needs to provide more information; can be closed after 2 or more weeks of inactivity

Comments

@EngineerHus
Copy link

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

@EngineerHus EngineerHus changed the title Pytest has not attribute 'StashKey' Pytest has not attribute StashKey Mar 11, 2024
@nicoddemus
Copy link
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'>

@nicoddemus nicoddemus added the status: needs information reporter needs to provide more information; can be closed after 2 or more weeks of inactivity label Mar 11, 2024
@EngineerHus
Copy link
Author

EngineerHus commented Mar 11, 2024

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

@bluetech
Copy link
Member

@EngineerHus thanks for the suggestion, submitted #12108.

@nicoddemus
Copy link
Member

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

@EngineerHus
Copy link
Author

@EngineerHus thanks for the suggestion, submitted #12108.

Much thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs information reporter needs to provide more information; can be closed after 2 or more weeks of inactivity
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants