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

Side by Side 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 unified diff | Download patch
OLDNEW
1 # Copyright 2015 The Chromium Authors. All rights reserved. 1 """Tests for ../{tested_file}.py"""
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 """Tool-specific testable functions for antibody."""
6 2
7 import argparse 3 import argparse
8 import unittest 4 import unittest
9 5
10 from infra.tools.antibody import antibody 6 from infra.tools.{toolname} import {tested_file}
11 7
12 8
13 class MyTest(unittest.TestCase): 9 class MyTest(unittest.TestCase):
14 def test_arguments(self): 10 def test_arguments(self):
15 parser = argparse.ArgumentParser() 11 parser = argparse.ArgumentParser()
16 antibody.add_argparse_options(parser) 12 {tested_file}.add_argparse_options(parser)
17 args = parser.parse_args(['--my-argument', 'value']) 13 args = parser.parse_args(['--my-argument', 'value'])
18 self.assertEqual(args.my_argument, 'value') 14 self.assertEqual(args.my_argument, 'value')
19 15
20 ## expect_tests style: the test method returns a value (expectation) 16 ## expect_tests style: the test method returns a value (expectation)
21 ## that is stored when run in 'train' mode, and compared to in 'test' mode. 17 ## that is stored when run in 'train' mode, and compared to in 'test' mode.
22 ## If the stored and returned values do not match, the test fails. 18 ## If the stored and returned values do not match, the test fails.
19 ## Use sparingly, asserts are usually better.
23 ## 20 ##
24 ## def test_my_first_test_with_expectation(self): 21 ## def test_my_first_test_with_expectation(self):
25 ## # Use hash() here to make sure the test fails in any case. 22 ## parser = argparse.ArgumentParser()
26 ## return hash(MyTest) 23 ## {tested_file}.add_argparse_options(parser)
24 ## args = parser.parse_args(['--my-argument', 'value'])
25 ## return {{'my_argument': args.my_argument}}
OLDNEW
« 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