Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(225)

Unified Diff: infra/tools/new_tool/templates/test.template

Issue 1172053003: Created infra/tools/new_tool (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: More tests Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « infra/tools/new_tool/templates/main.template ('k') | infra/tools/new_tool/templates/tool.template » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: infra/tools/new_tool/templates/test.template
diff --git a/infra/tools/antibody/test/antibody_test.py b/infra/tools/new_tool/templates/test.template
similarity index 56%
copy from infra/tools/antibody/test/antibody_test.py
copy to infra/tools/new_tool/templates/test.template
index f8a228bb1ec1b732d41f3ef3581a3f2414aa7289..26676657fff78e5b856f0f7a9461bd22cdaa02bd 100644
--- a/infra/tools/antibody/test/antibody_test.py
+++ b/infra/tools/new_tool/templates/test.template
@@ -1,26 +1,25 @@
-# Copyright 2015 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-"""Tool-specific testable functions for antibody."""
+"""Tests for ../{tested_file}.py"""
import argparse
import unittest
-from infra.tools.antibody import antibody
+from infra.tools.{toolname} import {tested_file}
class MyTest(unittest.TestCase):
def test_arguments(self):
parser = argparse.ArgumentParser()
- antibody.add_argparse_options(parser)
+ {tested_file}.add_argparse_options(parser)
args = parser.parse_args(['--my-argument', 'value'])
self.assertEqual(args.my_argument, 'value')
## expect_tests style: the test method returns a value (expectation)
## that is stored when run in 'train' mode, and compared to in 'test' mode.
## If the stored and returned values do not match, the test fails.
+## Use sparingly, asserts are usually better.
##
## def test_my_first_test_with_expectation(self):
-## # Use hash() here to make sure the test fails in any case.
-## return hash(MyTest)
+## parser = argparse.ArgumentParser()
+## {tested_file}.add_argparse_options(parser)
+## args = parser.parse_args(['--my-argument', 'value'])
+## return {{'my_argument': args.my_argument}}
« no previous file with comments | « infra/tools/new_tool/templates/main.template ('k') | infra/tools/new_tool/templates/tool.template » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698