OLD | NEW |
| (Empty) |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | |
2 # Use of this source code is governed by a BSD-style license that can be | |
3 # found in the LICENSE file. | |
4 | |
5 import glob | |
6 import os | |
7 import shutil | |
8 import tempfile | |
9 | |
10 from infra.services import gnumbd | |
11 | |
12 from infra.ext import testing_support # pylint: disable=W0611 | |
13 from testing_support import expect_tests # pylint: disable=F0401 | |
14 | |
15 GNUMBD_PATH = os.path.abspath(os.path.dirname(gnumbd.__file__)) | |
16 | |
17 | |
18 def GenTests(tmpdir): | |
19 from infra.services.gnumbd.test import ( | |
20 gnumbd_smoketests_main, util_test, data_test, git_test, config_test) | |
21 | |
22 for test in gnumbd_smoketests_main.GenTests(tmpdir): | |
23 yield test | |
24 | |
25 for test_mod in (util_test, data_test, git_test, config_test): | |
26 for test in expect_tests.UnitTestModule(test_mod): | |
27 yield test | |
28 | |
29 | |
30 #### Actual tests | |
31 def main(): | |
32 suffix = '.gnumbd_smoketests' | |
33 tmpdir = tempfile.mkdtemp(suffix) | |
34 for p in glob.glob(os.path.join(os.path.dirname(tmpdir), '*'+suffix)): | |
35 if p != tmpdir: | |
36 shutil.rmtree(p) | |
37 | |
38 try: | |
39 expect_tests.main( | |
40 'gnumbd_tests', | |
41 lambda: GenTests(tmpdir), | |
42 [ | |
43 os.path.join(GNUMBD_PATH, '*.py'), | |
44 os.path.join(GNUMBD_PATH, 'test', '*_test.py'), | |
45 ], [ | |
46 os.path.join(GNUMBD_PATH, 'test', '__main__.py') | |
47 ], | |
48 cover_branches=True, | |
49 ) | |
50 finally: | |
51 try: | |
52 shutil.rmtree(tmpdir) | |
53 except Exception: | |
54 pass | |
55 | |
56 if __name__ == '__main__': | |
57 main() | |
OLD | NEW |