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

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

Issue 2029823002: Fix MockFileSystem.walk and add test. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added test for deep folders 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
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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 47
48 class TestImporterTest(unittest.TestCase): 48 class TestImporterTest(unittest.TestCase):
49 49
50 @staticmethod 50 @staticmethod
51 def options(**kwargs): 51 def options(**kwargs):
52 """Returns a set of option values for TestImporter.""" 52 """Returns a set of option values for TestImporter."""
53 options = { 53 options = {
54 "overwrite": False, 54 "overwrite": False,
55 "destination": "w3c", 55 "destination": "w3c",
56 "ignore_expectations": False, 56 "ignore_expectations": False,
57 "dry_run": False,
qyearsley 2016/06/02 00:07:14 This change is not related to this particular fix,
57 } 58 }
58 options.update(kwargs) 59 options.update(kwargs)
59 return optparse.Values(options) 60 return optparse.Values(options)
60 61
61 def test_import_dir_with_no_tests(self): 62 def test_import_dir_with_no_tests(self):
62 host = MockHost() 63 host = MockHost()
63 host.executive = MockExecutive2(exception=ScriptError( 64 host.executive = MockExecutive2(exception=ScriptError(
64 "abort: no repository found in '/Volumes/Source/src/wk/Tools/Scripts /webkitpy/w3c'")) 65 "abort: no repository found in '/Volumes/Source/src/wk/Tools/Scripts /webkitpy/w3c'"))
65 host.filesystem = MockFileSystem(files=FAKE_FILES) 66 host.filesystem = MockFileSystem(files=FAKE_FILES)
66 67
67 importer = TestImporter(host, FAKE_SOURCE_DIR, FAKE_REPO_DIR, self.optio ns()) 68 importer = TestImporter(host, FAKE_SOURCE_DIR, FAKE_REPO_DIR, self.optio ns())
68 69
69 oc = OutputCapture() 70 oc = OutputCapture()
70 oc.capture_output() 71 oc.capture_output()
71 try: 72 try:
72 importer.do_import() 73 importer.do_import()
73 finally: 74 finally:
74 oc.restore_output() 75 oc.restore_output()
75 76
76 def test_path_too_long_true(self): 77 def test_path_too_long_true(self):
77 importer = TestImporter(MockHost(), FAKE_SOURCE_DIR, FAKE_REPO_DIR, self .options()) 78 importer = TestImporter(MockHost(), FAKE_SOURCE_DIR, FAKE_REPO_DIR, self .options())
78 self.assertTrue(importer.path_too_long(FAKE_REPO_DIR + '/' + ('x' * 150) + '.html')) 79 self.assertTrue(importer.path_too_long(FAKE_REPO_DIR + '/' + ('x' * 150) + '.html'))
79 80
80 def test_path_too_long_false(self): 81 def test_path_too_long_false(self):
81 importer = TestImporter(MockHost(), FAKE_SOURCE_DIR, FAKE_REPO_DIR, self .options()) 82 importer = TestImporter(MockHost(), FAKE_SOURCE_DIR, FAKE_REPO_DIR, self .options())
82 self.assertFalse(importer.path_too_long(FAKE_REPO_DIR + '/x.html')) 83 self.assertFalse(importer.path_too_long(FAKE_REPO_DIR + '/x.html'))
83 84
84 # FIXME: Needs more tests. 85 # FIXME: Needs more tests.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698