Conversation
|
Looks like the author of this MR and me are going after the same idea. See this comment for my explanation about why this feature would be really useful for a pytest dependency-tracking extension. |
|
Hello! Any chance for this feature to be developed? Can we provide some help to release this useful feature? Thank you 🙂 |
|
This feature is very useful, what is blocking the CI failures to be fixed and the branch merged? |
to fix "WARNING: Built wheel for pytest-dependency is invalid: Metadata 1.2 mandates PEP 440 version, but 'UNKNOWN' is not
|
I believe |
|
This code does not take into account tests in a class, when referred to as follows: class Tests:
@pytest.mark.dependency()
def test_b(self):
pass
@pytest.mark.dependency(depends=["Tests::test_b"])
def test_d(self):
passThe following Q&D patch takes care of that case, but I'm not sure it would handle all situations: depend_parent = Module.from_parent(item.parent, fspath=depend_path)
depend_nodeid = depend
else:
- depend_func = depend
+ if "::" in depend:
+ depend_func = depend.split("::")[-1]
+ else:
+ depend_func = depend
depend_parent = item.parent
depend_nodeid = '{}::{}'.format(depend_parent.nodeid, depend_func)
# assert depend_nodeid == depend_nodeid2Edit: that uses the current item's parent to create the dependency item, which will only work if they are defined in the same class, e.g. this is not covered: Another limitation is the item does not seem to include fixture information, and when
|
Hello @RKrahl, the purpose of this PR is to add the possibility of automatically collect dependent tests.
Is similar to what proposed in #37, but differs from these points:
collect=True)This configuration option default is set to false, so pytest-dependency does not change its default beauvoir.
Just to explain my motivation for this PR, my use case is the following:
I use PyCharm IDE, running a single test is made by clicking on the green triangle on the left of the function test definition (see image below):
Using this new feature the result for a single click is the execution of that test and all the dependent tests. I think that most IDEs have similar way to run a single test, and so this option can have its benefit also there.