Skip to content

Show case *most* unittest running through bazel test ...#205

Closed
furtib wants to merge 1 commit intoEricsson:mainfrom
furtib:bazel_test_copy_unittest
Closed

Show case *most* unittest running through bazel test ...#205
furtib wants to merge 1 commit intoEricsson:mainfrom
furtib:bazel_test_copy_unittest

Conversation

@furtib
Copy link
Copy Markdown
Contributor

@furtib furtib commented Mar 16, 2026

Why:
We want all test to be run through bazel test ...

What:

  • Created a filegroup in all packages that exports all files inside the package.
  • Created a target that runs the Python unittests on the copy inside the sandbox.

Addresses:
none

Note:
This is a proof-of-concept patch.
The question is: Is this a good way to run tests that cannot be completely integrated into Bazel?
This solution does not speed up the time it takes to run tests.
It seems like the external test cannot be added in this way. (But it can take FOSS tests too

@furtib furtib requested review from Szelethus and nettle March 16, 2026 13:41
@furtib furtib self-assigned this Mar 16, 2026
Copy link
Copy Markdown
Collaborator

@nettle nettle left a comment

Choose a reason for hiding this comment

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

That's interesting experiment, but not really a bazel test.
Please go on, but do not submit :)

Comment thread BUILD
filegroup(
name = "all_sources",
srcs = glob(
["**/*"],
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

That's definitely no good :(
Never do that in Bazel!

Comment thread test/test_runner.sh
Comment on lines +1 to +2
#!/usr/bin/env bash
python3 -m unittest discover -t . -s test/unit $@
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Well, use py_test() at least :)

@furtib
Copy link
Copy Markdown
Contributor Author

furtib commented Apr 1, 2026

This PR has served its purpose (showcasing that Bazel can be run inside of Bazel)

@furtib furtib closed this Apr 1, 2026
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

Successfully merging this pull request may close these issues.

2 participants