Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions test/unit/template/test_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,22 @@

class TestTemplate(TestBase):
"""TODO: Add a description"""

# Set working directory
__test_path__ = os.path.dirname(os.path.abspath(__file__))
# TODO: fix folder name
BAZEL_BIN_DIR = os.path.join("../../..", "bazel-bin", "test",
"unit", "my_test_folder")
BAZEL_TESTLOGS_DIR = os.path.join("../../..", "bazel-testlogs", "test",
"unit", "my_test_folder")
BAZEL_BIN_DIR = os.path.join(
"../../..", "bazel-bin", "test", "unit", "my_test_folder"
)
BAZEL_TESTLOGS_DIR = os.path.join(
"../../..", "bazel-testlogs", "test", "unit", "my_test_folder"
)

@final
@classmethod
def setUpClass(cls):
"""TODO: Define set up before the test suite"""
super().setUpClass()
cls.run_command("bazel clean")
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you remember what was the rationale here when we added it?

Copy link
Contributor Author

@furtib furtib Feb 3, 2026

Choose a reason for hiding this comment

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

Yes, it was "this is in the legacy test, lets keep it".

A bit more indepth reason would be that since this rule is not (yet) hermetic, it should be cleaned between runs.
I argue against this, if tests are run on the same machine their output will be the same and unittests can only be run on a single machine.


@final
@classmethod
Expand All @@ -54,7 +56,8 @@ def tearDown(self):

def test_template(self):
"""Test: TODO: describe your test"""
self.assertTrue(True)
return_code, stdout, stderr = self.run_command("bazel build //src:*")
self.assertEqual(0, return_code, stderr)
Comment on lines +59 to +60
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the rationale behind this one?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since all test using this template will most certainly call a bazel build/test command, it makes sense to provide an example for it. The target was chosen for its minimal runtime.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since all test using this template will most certainly call a bazel build/test command, it makes sense to provide an example for it. The target was chosen for its minimal runtime.



if __name__ == "__main__":
Expand Down