| 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}}
|
|
|