-
Notifications
You must be signed in to change notification settings - Fork 3
Update template test #176
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
base: main
Are you sure you want to change the base?
Update template test #176
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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") | ||
|
|
||
| @final | ||
| @classmethod | ||
|
|
@@ -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
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is the rationale behind this one?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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__": | ||
|
|
||
There was a problem hiding this comment.
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?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
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.