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

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_importer_unittest.py

Issue 2049803002: Reland of Simplify import-w3c-tests: support exactly one argument. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix the test Created 4 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
« no previous file with comments | « third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_importer.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 1 # Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions 4 # modification, are permitted provided that the following conditions
5 # are met: 5 # are met:
6 # 6 #
7 # 1. Redistributions of source code must retain the above 7 # 1. Redistributions of source code must retain the above
8 # copyright notice, this list of conditions and the following 8 # copyright notice, this list of conditions and the following
9 # disclaimer. 9 # disclaimer.
10 # 2. Redistributions in binary form must reproduce the above 10 # 2. Redistributions in binary form must reproduce the above
(...skipping 17 matching lines...) Expand all
28 import optparse 28 import optparse
29 import unittest 29 import unittest
30 30
31 from webkitpy.common.host_mock import MockHost 31 from webkitpy.common.host_mock import MockHost
32 from webkitpy.common.system.filesystem_mock import MockFileSystem 32 from webkitpy.common.system.filesystem_mock import MockFileSystem
33 from webkitpy.common.system.executive_mock import MockExecutive2, ScriptError 33 from webkitpy.common.system.executive_mock import MockExecutive2, ScriptError
34 from webkitpy.common.system.outputcapture import OutputCapture 34 from webkitpy.common.system.outputcapture import OutputCapture
35 from webkitpy.w3c.test_importer import TestImporter 35 from webkitpy.w3c.test_importer import TestImporter
36 36
37 37
38 FAKE_SOURCE_DIR = '/blink/w3c' 38 FAKE_SOURCE_REPO_DIR = '/blink'
39 FAKE_REPO_DIR = '/blink'
40 39
41 FAKE_FILES = {'/mock-checkout/third_party/Webkit/LayoutTests/w3c/OWNERS': '', 40 FAKE_FILES = {'/mock-checkout/third_party/Webkit/LayoutTests/w3c/OWNERS': '',
42 '/blink/w3c/dir/README.txt': '', 41 '/blink/w3c/dir/README.txt': '',
43 '/blink/w3c/dir/OWNERS': '', 42 '/blink/w3c/dir/OWNERS': '',
44 '/blink/w3c/dir/reftest.list': '', 43 '/blink/w3c/dir/reftest.list': '',
45 '/blink/w3c/dir1/OWNERS': '', 44 '/blink/w3c/dir1/OWNERS': '',
46 '/blink/w3c/dir1/reftest.list': '', 45 '/blink/w3c/dir1/reftest.list': '',
47 '/mock-checkout/third_party/WebKit/LayoutTests/w3c/README.txt': '' , 46 '/mock-checkout/third_party/WebKit/LayoutTests/w3c/README.txt': '' ,
48 '/mock-checkout/third_party/WebKit/LayoutTests/W3CImportExpectatio ns': ''} 47 '/mock-checkout/third_party/WebKit/LayoutTests/W3CImportExpectatio ns': ''}
49 48
50 49
51
52 class TestImporterTest(unittest.TestCase): 50 class TestImporterTest(unittest.TestCase):
53 51
54 @staticmethod 52 @staticmethod
55 def options(**kwargs): 53 def options(**kwargs):
56 """Returns a set of option values for TestImporter.""" 54 """Returns a set of option values for TestImporter."""
57 options = { 55 options = {
58 "overwrite": False, 56 "overwrite": False,
59 "destination": "w3c", 57 "destination": "w3c",
60 "ignore_expectations": False, 58 "ignore_expectations": False,
61 "dry_run": False, 59 "dry_run": False,
62 } 60 }
63 options.update(kwargs) 61 options.update(kwargs)
64 return optparse.Values(options) 62 return optparse.Values(options)
65 63
66 def test_import_dir_with_no_tests(self): 64 def test_import_dir_with_no_tests(self):
67 host = MockHost() 65 host = MockHost()
68 host.executive = MockExecutive2(exception=ScriptError( 66 host.executive = MockExecutive2(exception=ScriptError(
69 "abort: no repository found in '/Volumes/Source/src/wk/Tools/Scripts /webkitpy/w3c'")) 67 "abort: no repository found in '/Volumes/Source/src/wk/Tools/Scripts /webkitpy/w3c'"))
70 host.filesystem = MockFileSystem(files=FAKE_FILES) 68 host.filesystem = MockFileSystem(files=FAKE_FILES)
71 69
72 importer = TestImporter(host, FAKE_SOURCE_DIR, FAKE_REPO_DIR, self.optio ns()) 70 importer = TestImporter(host, FAKE_SOURCE_REPO_DIR, self.options())
73 71
74 oc = OutputCapture() 72 oc = OutputCapture()
75 oc.capture_output() 73 oc.capture_output()
76 try: 74 try:
77 importer.do_import() 75 importer.do_import()
78 finally: 76 finally:
79 oc.restore_output() 77 oc.restore_output()
80 78
81 def test_path_too_long_true(self): 79 def test_path_too_long_true(self):
82 importer = TestImporter(MockHost(), FAKE_SOURCE_DIR, FAKE_REPO_DIR, self .options()) 80 importer = TestImporter(MockHost(), FAKE_SOURCE_REPO_DIR, self.options() )
83 self.assertTrue(importer.path_too_long(FAKE_REPO_DIR + '/' + ('x' * 150) + '.html')) 81 self.assertTrue(importer.path_too_long(FAKE_SOURCE_REPO_DIR + '/' + ('x' * 150) + '.html'))
84 82
85 def test_path_too_long_false(self): 83 def test_path_too_long_false(self):
86 importer = TestImporter(MockHost(), FAKE_SOURCE_DIR, FAKE_REPO_DIR, self .options()) 84 importer = TestImporter(MockHost(), FAKE_SOURCE_REPO_DIR, self.options() )
87 self.assertFalse(importer.path_too_long(FAKE_REPO_DIR + '/x.html')) 85 self.assertFalse(importer.path_too_long(FAKE_SOURCE_REPO_DIR + '/x.html' ))
88 86
89 def test_does_not_import_owner_files(self): 87 def test_does_not_import_owner_files(self):
90 host = MockHost() 88 host = MockHost()
91 host.filesystem = MockFileSystem(files=FAKE_FILES) 89 host.filesystem = MockFileSystem(files=FAKE_FILES)
92 importer = TestImporter(host, FAKE_SOURCE_DIR, FAKE_REPO_DIR, self.optio ns()) 90 importer = TestImporter(host, FAKE_SOURCE_REPO_DIR, self.options())
93 importer.find_importable_tests(FAKE_REPO_DIR) 91 importer.find_importable_tests()
94 self.assertEqual(importer.import_list, 92 self.assertEqual(importer.import_list,
95 [{'copy_list': [{'dest': 'README.txt', 'src': '/blink/w 3c/dir/README.txt'}], 93 [{'copy_list': [{'dest': 'README.txt', 'src': '/blink/w 3c/dir/README.txt'}],
96 'dirname': '/blink/w3c/dir', 94 'dirname': '/blink/w3c/dir',
97 'jstests': 0, 95 'jstests': 0,
98 'reftests': 0, 96 'reftests': 0,
99 'total_tests': 0}]) 97 'total_tests': 0}])
100 98
101 def test_does_not_import_reftest(self): 99 def test_does_not_import_reftestlist_file(self):
102 host = MockHost() 100 host = MockHost()
103 host.filesystem = MockFileSystem(files=FAKE_FILES) 101 host.filesystem = MockFileSystem(files=FAKE_FILES)
104 importer = TestImporter(host, FAKE_SOURCE_DIR, FAKE_REPO_DIR, self.optio ns()) 102 importer = TestImporter(host, FAKE_SOURCE_REPO_DIR, self.options())
105 importer.find_importable_tests(FAKE_REPO_DIR) 103 importer.find_importable_tests()
106 self.assertEqual(importer.import_list, 104 self.assertEqual(importer.import_list,
107 [{'copy_list': [{'dest': 'README.txt', 'src': '/blink/w 3c/dir/README.txt'}], 105 [{'copy_list': [{'dest': 'README.txt', 'src': '/blink/w 3c/dir/README.txt'}],
108 'dirname': '/blink/w3c/dir', 106 'dirname': '/blink/w3c/dir',
109 'jstests': 0, 107 'jstests': 0,
110 'reftests': 0, 108 'reftests': 0,
111 'total_tests': 0}]) 109 'total_tests': 0}])
OLDNEW
« no previous file with comments | « third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_importer.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698