0

I am writing an integration-test (py_test) for a Python library. Now it only makes sense to run this one if a set of other py_test unit-tests have successfully completed.

I could not yet find a way of adding such a testing-dependency in Bazel.

1 Answer 1

2

Sorry it is not possible.

An action cannot declare a dependency on a test action.

Maybe you can work around by doing only one test or by adding tags (phase1, phase2):

bazel test --test_tag_filter -phase2 //... && bazel test --test_tag_filter phase2 //...
Sign up to request clarification or add additional context in comments.

2 Comments

How far is this gone, though? Are there any run dependencies supported yet?
Right now, Bazel has a fairly strict separation between the phases of the build (compiling vs. execution). We're working on relaxing this so they can be interleaved, but it's a long way off (AFAIK). Theoretically, you could make running the unit test a "build" step (by executing them in a genrule) and then make the output of that a dependency of the integration tests. But that's super hacky, Damien's way is better.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.