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

Mark MockHttp as not for collection by pytest #2014

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions libcloud/test/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ class MockHttp(LibcloudConnection):

(int status, str body, dict headers, str reason)
"""
# pytest may collect this class, and we don't need or want that
__test__ = False

Choose a reason for hiding this comment

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

this hides tests that use a broken inheritance tree

Copy link
Author

Choose a reason for hiding this comment

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

Can we determine which tests those are? I'm happy to fix them, because otherwise pytest 8.2 collects the class and can not instantiate it.

Choose a reason for hiding this comment

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

I linked one in the upstream bug, at first glance it's not fixable

Copy link
Member

Choose a reason for hiding this comment

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

Thanks for the contribution.

As @RonnyPfannschmidt pointed out, that will break a bunch of tests which have assertions directly in subclassed MockHttp class (I believe there are quite a few of those).


On a related note, pytest 8.0.x also broke a bunch of other tests recently due to the changes in the test loading / discovery mechanism (#1994). I battle for quite a while to get everything to pass.

Granted, in that specific case, one of the main issues was cross test pollution. Tests would only fail when they ran in a very specific order and that's why we didn't detect that issue earlier and it was hard to track down and fix.


type = None
use_param = None # will use this param to namespace the request function
Expand Down