| OLD | NEW |
| 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 28 matching lines...) Expand all Loading... |
| 39 | 39 |
| 40 FAKE_SOURCE_DIR = '/blink/w3c' | 40 FAKE_SOURCE_DIR = '/blink/w3c' |
| 41 FAKE_REPO_DIR = '/blink' | 41 FAKE_REPO_DIR = '/blink' |
| 42 | 42 |
| 43 FAKE_FILES = { | 43 FAKE_FILES = { |
| 44 '/blink/w3c/empty_dir/README.txt': '', | 44 '/blink/w3c/empty_dir/README.txt': '', |
| 45 '/mock-checkout/third_party/WebKit/LayoutTests/w3c/README.txt': '', | 45 '/mock-checkout/third_party/WebKit/LayoutTests/w3c/README.txt': '', |
| 46 '/mock-checkout/third_party/WebKit/LayoutTests/W3CImportExpectations': '', | 46 '/mock-checkout/third_party/WebKit/LayoutTests/W3CImportExpectations': '', |
| 47 } | 47 } |
| 48 | 48 |
| 49 |
| 49 class TestImporterTest(unittest.TestCase): | 50 class TestImporterTest(unittest.TestCase): |
| 50 | 51 |
| 51 def test_import_dir_with_no_tests_and_no_hg(self): | 52 def test_import_dir_with_no_tests_and_no_hg(self): |
| 52 host = MockHost() | 53 host = MockHost() |
| 53 host.executive = MockExecutive2(exception=OSError()) | 54 host.executive = MockExecutive2(exception=OSError()) |
| 54 host.filesystem = MockFileSystem(files=FAKE_FILES) | 55 host.filesystem = MockFileSystem(files=FAKE_FILES) |
| 55 | 56 |
| 56 importer = TestImporter(host, FAKE_SOURCE_DIR, FAKE_REPO_DIR, optparse.V
alues({"overwrite": False, 'destination': 'w3c', 'ignore_expectations': False})) | 57 importer = TestImporter(host, FAKE_SOURCE_DIR, FAKE_REPO_DIR, optparse.V
alues( |
| 58 {"overwrite": False, 'destination': 'w3c', 'ignore_expectations': Fa
lse})) |
| 57 | 59 |
| 58 oc = OutputCapture() | 60 oc = OutputCapture() |
| 59 oc.capture_output() | 61 oc.capture_output() |
| 60 try: | 62 try: |
| 61 importer.do_import() | 63 importer.do_import() |
| 62 finally: | 64 finally: |
| 63 oc.restore_output() | 65 oc.restore_output() |
| 64 | 66 |
| 65 def test_import_dir_with_no_tests(self): | 67 def test_import_dir_with_no_tests(self): |
| 66 host = MockHost() | 68 host = MockHost() |
| 67 host.executive = MockExecutive2(exception=ScriptError("abort: no reposit
ory found in '/Volumes/Source/src/wk/Tools/Scripts/webkitpy/w3c' (.hg not found)
!")) | 69 host.executive = MockExecutive2(exception=ScriptError( |
| 70 "abort: no repository found in '/Volumes/Source/src/wk/Tools/Scripts
/webkitpy/w3c' (.hg not found)!")) |
| 68 host.filesystem = MockFileSystem(files=FAKE_FILES) | 71 host.filesystem = MockFileSystem(files=FAKE_FILES) |
| 69 | 72 |
| 70 importer = TestImporter(host, FAKE_SOURCE_DIR, FAKE_REPO_DIR, optparse.V
alues({"overwrite": False, 'destination': 'w3c', 'ignore_expectations': False})) | 73 importer = TestImporter(host, FAKE_SOURCE_DIR, FAKE_REPO_DIR, optparse.V
alues( |
| 74 {"overwrite": False, 'destination': 'w3c', 'ignore_expectations': Fa
lse})) |
| 71 oc = OutputCapture() | 75 oc = OutputCapture() |
| 72 oc.capture_output() | 76 oc.capture_output() |
| 73 try: | 77 try: |
| 74 importer.do_import() | 78 importer.do_import() |
| 75 finally: | 79 finally: |
| 76 oc.restore_output() | 80 oc.restore_output() |
| 77 | 81 |
| 78 # FIXME: Needs more tests. | 82 # FIXME: Needs more tests. |
| OLD | NEW |