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

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

Issue 16171009: switch import-w3c-tests from using print statements to logging (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: clean up paths a bit Created 7 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 | Annotate | Revision Log
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 2
3 # Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 3 # Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
4 # 4 #
5 # Redistribution and use in source and binary forms, with or without 5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions 6 # modification, are permitted provided that the following conditions
7 # are met: 7 # are met:
8 # 8 #
9 # 1. Redistributions of source code must retain the above 9 # 1. Redistributions of source code must retain the above
10 # copyright notice, this list of conditions and the following 10 # copyright notice, this list of conditions and the following
(...skipping 20 matching lines...) Expand all
31 import shutil 31 import shutil
32 import tempfile 32 import tempfile
33 import unittest2 as unittest 33 import unittest2 as unittest
34 34
35 from webkitpy.common.host import Host 35 from webkitpy.common.host import Host
36 from webkitpy.common.system.executive_mock import MockExecutive2, ScriptError 36 from webkitpy.common.system.executive_mock import MockExecutive2, ScriptError
37 from webkitpy.common.system.outputcapture import OutputCapture 37 from webkitpy.common.system.outputcapture import OutputCapture
38 from webkitpy.w3c.test_importer import TestImporter 38 from webkitpy.w3c.test_importer import TestImporter
39 39
40 40
41 DUMMY_SOURCE_DIR = '/w3c'
42 DUMMY_REPO_DIR = '/blink/LayoutTests'
43
41 class TestImporterTest(unittest.TestCase): 44 class TestImporterTest(unittest.TestCase):
42 45
43 def test_import_dir_with_no_tests_and_no_hg(self): 46 def test_import_dir_with_no_tests_and_no_hg(self):
44 # FIXME: Use MockHosts instead. 47 # FIXME: Use MockHosts instead.
45 host = Host() 48 host = Host()
46 host.executive = MockExecutive2(exception=OSError()) 49 host.executive = MockExecutive2(exception=OSError())
47 50
48 importer = TestImporter(host, None, optparse.Values({"overwrite": False} )) 51 importer = TestImporter(host, DUMMY_SOURCE_DIR, DUMMY_REPO_DIR, optparse .Values({"overwrite": False}))
49 importer.source_directory = importer.path_from_webkit_root("Tools", "Scr ipts", "webkitpy", "w3c") 52 importer.source_directory = importer.path_from_webkit_root("Tools", "Scr ipts", "webkitpy", "w3c")
50 importer.destination_directory = tempfile.mkdtemp(prefix='csswg') 53 importer.destination_directory = tempfile.mkdtemp(prefix='csswg')
51 54
52 oc = OutputCapture() 55 oc = OutputCapture()
53 oc.capture_output() 56 oc.capture_output()
54 try: 57 try:
55 importer.do_import() 58 importer.do_import()
56 finally: 59 finally:
57 oc.restore_output() 60 oc.restore_output()
58 shutil.rmtree(importer.destination_directory, ignore_errors=True) 61 shutil.rmtree(importer.destination_directory, ignore_errors=True)
59 62
60 def test_import_dir_with_no_tests(self): 63 def test_import_dir_with_no_tests(self):
61 # FIXME: Use MockHosts instead. 64 # FIXME: Use MockHosts instead.
62 host = Host() 65 host = Host()
63 host.executive = MockExecutive2(exception=ScriptError("abort: no reposit ory found in '/Volumes/Source/src/wk/Tools/Scripts/webkitpy/w3c' (.hg not found) !")) 66 host.executive = MockExecutive2(exception=ScriptError("abort: no reposit ory found in '/Volumes/Source/src/wk/Tools/Scripts/webkitpy/w3c' (.hg not found) !"))
64 67
65 importer = TestImporter(host, None, optparse.Values({"overwrite": False} )) 68 importer = TestImporter(host, '/w3c', '/blink', optparse.Values({"overwr ite": False}))
66 importer.source_directory = importer.path_from_webkit_root("Tools", "Scr ipts", "webkitpy", "w3c") 69 importer.source_directory = importer.path_from_webkit_root("Tools", "Scr ipts", "webkitpy", "w3c")
67 importer.destination_directory = tempfile.mkdtemp(prefix='csswg') 70 importer.destination_directory = tempfile.mkdtemp(prefix='csswg')
68 71
69 oc = OutputCapture() 72 oc = OutputCapture()
70 oc.capture_output() 73 oc.capture_output()
71 try: 74 try:
72 importer.do_import() 75 importer.do_import()
73 finally: 76 finally:
74 oc.restore_output() 77 oc.restore_output()
75 shutil.rmtree(importer.destination_directory, ignore_errors=True) 78 shutil.rmtree(importer.destination_directory, ignore_errors=True)
76 79
77 # FIXME: Need more tests, but need to add a mock filesystem w/ sample data. 80 # FIXME: Need more tests, but need to add a mock filesystem w/ sample data.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698