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

Unified Diff: third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py

Issue 2192403002: Remove MockOptions, and replace all usages of it with optparse.Values. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py
index 4b6cd8925b2e122e7aea685a385b7c9cda066569..3ea3f0acce70508262cb30d6664afc7b2630a63a 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py
@@ -30,6 +30,7 @@
import collections
import errno
+import optparse
import socket
import unittest
@@ -40,9 +41,6 @@ from webkitpy.common.system.systemhost import SystemHost
from webkitpy.common.system.systemhost_mock import MockSystemHost
from webkitpy.layout_tests.models import test_run_results
from webkitpy.layout_tests.port.base import Port
-from webkitpy.layout_tests.port.base import TestConfiguration
-from webkitpy.layout_tests.port.server_process_mock import MockServerProcess
-from webkitpy.tool.mock_tool import MockOptions
# FIXME: get rid of this fixture
@@ -90,7 +88,7 @@ class PortTestCase(unittest.TestCase):
def make_port(self, host=None, port_name=None, options=None, os_name=None, os_version=None, **kwargs):
host = host or MockSystemHost(os_name=(os_name or self.os_name), os_version=(os_version or self.os_version))
- options = options or MockOptions(configuration='Release')
+ options = options or optparse.Values({'configuration': 'Release'})
port_name = port_name or self.port_name
port_name = self.port_maker.determine_full_port_name(host, options, port_name)
port = self.port_maker(host, port_name, options=options, **kwargs)
@@ -149,8 +147,8 @@ class PortTestCase(unittest.TestCase):
self.assertEqual(port.default_max_locked_shards(), 1)
def test_default_timeout_ms(self):
- self.assertEqual(self.make_port(options=MockOptions(configuration='Release')).default_timeout_ms(), 6000)
- self.assertEqual(self.make_port(options=MockOptions(configuration='Debug')).default_timeout_ms(), 18000)
+ self.assertEqual(self.make_port(options=optparse.Values({'configuration': 'Release'})).default_timeout_ms(), 6000)
+ self.assertEqual(self.make_port(options=optparse.Values({'configuration': 'Debug'})).default_timeout_ms(), 18000)
def test_default_pixel_tests(self):
self.assertEqual(self.make_port().default_pixel_tests(), True)
@@ -159,7 +157,7 @@ class PortTestCase(unittest.TestCase):
port = self.make_port()
self.assertTrue(len(port.driver_cmd_line()))
- options = MockOptions(additional_driver_flag=['--foo=bar', '--foo=baz'])
+ options = optparse.Values(dict(additional_driver_flag=['--foo=bar', '--foo=baz']))
port = self.make_port(options=options)
cmd_line = port.driver_cmd_line()
self.assertTrue('--foo=bar' in cmd_line)
@@ -316,7 +314,7 @@ class PortTestCase(unittest.TestCase):
])
def test_expectations_files_wptserve_enabled(self):
- port = self.make_port(options=MockOptions(enable_wptserve=True))
+ port = self.make_port(options=optparse.Values(dict(enable_wptserve=True)))
self.assertEqual(port.expectations_files(), [
port.path_to_generic_test_expectations_file(),
port._filesystem.join(port.layout_tests_dir(), 'NeverFixTests'),
@@ -339,7 +337,7 @@ class PortTestCase(unittest.TestCase):
ordered_dict = port.expectations_dict()
self.assertEqual(port.path_to_generic_test_expectations_file(), ordered_dict.keys()[0])
- options = MockOptions(additional_expectations=['/tmp/foo', '/tmp/bar'])
+ options = optparse.Values(dict(additional_expectations=['/tmp/foo', '/tmp/bar']))
port = self.make_port(options=options)
for path in port.expectations_files():
port._filesystem.write_text_file(path, '')
@@ -418,7 +416,7 @@ class PortTestCase(unittest.TestCase):
self.assertEqual(port.path_to_apache_config_file(), '/existing/httpd.conf')
def test_additional_platform_directory(self):
- port = self.make_port(options=MockOptions(additional_platform_directory=['/tmp/foo']))
+ port = self.make_port(options=optparse.Values(dict(additional_platform_directory=['/tmp/foo'])))
self.assertEqual(port.baseline_search_path()[0], '/tmp/foo')
def test_virtual_test_suites(self):

Powered by Google App Engine
This is Rietveld 408576698