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

Multiple dependencies? #155

Open
rw-anderson opened this issue Oct 6, 2023 · 1 comment
Open

Multiple dependencies? #155

rw-anderson opened this issue Oct 6, 2023 · 1 comment

Comments

@rw-anderson
Copy link

Is it possible to have a test that executes only when multiple predecessors have completed (and passed)?

One solution is:
t1 = test(...)
t2 = testif(t1, ...)
t3 = testif(t2, ...)

But this serializes t1 and t2, which may be able to run concurrently.

@rw-anderson
Copy link
Author

rw-anderson commented Oct 6, 2023

Maybe a change like:

diff --git a/ats/management.py b/ats/management.py
index 92911ed..055f571 100644
--- a/ats/management.py
+++ b/ats/management.py
@@ -573,7 +573,11 @@ class AtsManager(object):
     def testif(self, parent, *clas, **options):
         "Create test, to be run only if othertest passed."
         testobj = self.test(*clas, **options)
-        parent.addDependent(testobj)
+        if isinstance(parent, list):
+            for p in parent:
+                p.addDependent(testobj)
+        else:
+            parent.addDependent(testobj)
         return testobj

would enable usage like this:

t1 = test(...)
t2 = test(...)
testif([t1, t2], ...)

etc. without breaking backward compatibility.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant