-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Marking subclass affected methods of parent class. #2947
Comments
Hi @namezys thanks for your writing.
Indeed that's how it works at the moment. There's an ongoing effort to clean up the mark internals to provide a better API and fix some of the problems of the current mark transferring mechanism. One note: In
Not sure it will help you much, but thought I would mention it. |
@nicoddemus an api to consume those marks more nicely is still largely missing however |
@nicoddemus Thank you for conformation. I think we should write append disclaim about this behaviour into documentation. Unfortunately, my english is ugly. For my project I've written a small workaround Code (with example of using):
Actually, It is not a right solution because I use private attributes. And I'm not sure what will be in case of multiply inheritance. |
this one is covered by the upcoming iter_markers apis in the next feature release the on function changes will be removed in the next breaking release |
I tried to create a class with some test methods with a fixture.
I have a special marker with kwargs that can change behaviour the fixture.
And I want to run this tests with different parameters of this marker.
Unfortunately, all subclass share one method and I every mark affected this method.
Small example:
In result I have 2 tests:
But both test have the same marker with
kwargs={"status": "B}
As I understand,
pytest.mark
store marker in function object and mark method even if it is applied to class.So it setup markers:
my_marker(status="M")
my_marker(status="A")
my_marker(status="B")
In this case ability to mark method and class simultaneously looks useless.
The text was updated successfully, but these errors were encountered: