本文整理汇总了Python中webkitpy.layout_tests.port.get函数的典型用法代码示例。如果您正苦于以下问题:Python get函数的具体用法?Python get怎么用?Python get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, file_path, handle_style_error):
self._file_path = file_path
self._handle_style_error = handle_style_error
self._handle_style_error.turn_off_line_filtering()
self._tab_checker = TabChecker(file_path, handle_style_error)
self._output_regex = re.compile('Line:(?P<line>\d+)\s*(?P<message>.+)')
# Determining the port of this expectations.
try:
port_name = self._file_path.split(os.sep)[-2]
if port_name == "chromium":
options = ChromiumOptions()
self._port_obj = port.get(port_name=None, options=options)
else:
self._port_obj = port.get(port_name=port_name)
except:
# Using 'test' port when we couldn't determine the port for this
# expectations.
_log.warn("Could not determine the port for %s. "
"Using 'test' port, but platform-specific expectations "
"will fail the check." % self._file_path)
self._port_obj = port.get('test')
# Suppress error messages of test_expectations module since they will be
# reported later.
log = logging.getLogger("webkitpy.layout_tests.layout_package."
"test_expectations")
log.setLevel(logging.CRITICAL)
示例2: make_rebaseliner
def make_rebaseliner(self):
options = mocktool.MockOptions(configuration=None,
html_directory=None)
host_port_obj = port.get('test', options)
target_options = options
target_port_obj = port.get('test', target_options)
platform = 'test'
return rebaseline_chromium_webkit_tests.Rebaseliner(
host_port_obj, target_port_obj, platform, options)
示例3: test_host_port_and_filesystem
def test_host_port_and_filesystem(options, expectations):
filesystem = unit_test_filesystem()
host_port_obj = port.get("test", options, filesystem=filesystem, user=mocktool.MockUser())
expectations_path = host_port_obj.path_to_test_expectations_file()
filesystem.write_text_file(expectations_path, expectations)
return (host_port_obj, filesystem)
示例4: main
def main(args):
"""Bootstrap function that sets up the object references we need and calls real_main()."""
options, target_options = parse_options(args)
# Set up our logging format.
log_level = logging.INFO
if options.verbose:
log_level = logging.DEBUG
logging.basicConfig(level=log_level,
format=('%(asctime)s %(filename)s:%(lineno)-3d '
'%(levelname)s %(message)s'),
datefmt='%y%m%d %H:%M:%S')
target_port_obj = port.get(None, target_options)
host_port_obj = get_host_port_object(options)
if not host_port_obj or not target_port_obj:
return 1
url_fetcher = urlfetcher.UrlFetcher(host_port_obj._filesystem)
scm_obj = scm.default_scm()
# We use the default zip factory method.
zip_factory = None
return real_main(options, target_options, host_port_obj, target_port_obj, url_fetcher,
zip_factory, scm_obj)
示例5: __init__
def __init__(self, running_port, target_port, platform, options, url_fetcher, zip_factory, scm):
"""
Args:
running_port: the Port the script is running on.
target_port: the Port the script uses to find port-specific
configuration information like the test_expectations.txt
file location and the list of test platforms.
platform: the test platform to rebaseline
options: the command-line options object.
url_fetcher: object that can fetch objects from URLs
zip_factory: optional object that can fetch zip files from URLs
scm: scm object for adding new baselines
"""
self._platform = platform
self._options = options
self._port = running_port
self._filesystem = running_port._filesystem
self._target_port = target_port
self._rebaseline_port = port.get(platform, options, filesystem=self._filesystem)
self._rebaselining_tests = set()
self._rebaselined_tests = []
# Create tests and expectations helper which is used to:
# -. compile list of tests that need rebaselining.
# -. update the tests in test_expectations file after rebaseline
# is done.
expectations_str = self._rebaseline_port.test_expectations()
self._test_expectations = test_expectations.TestExpectations(
self._rebaseline_port, None, expectations_str, self._rebaseline_port.test_configuration(), False)
self._url_fetcher = url_fetcher
self._zip_factory = zip_factory
self._scm = scm
示例6: logging_run
def logging_run(extra_args=None, port_obj=None, tests_included=False):
extra_args = extra_args or []
args = ['--no-record-results']
if not '--platform' in extra_args:
args.extend(['--platform', 'test'])
if not '--child-processes' in extra_args:
args.extend(['--worker-model', 'inline'])
args.extend(extra_args)
if not tests_included:
args.extend(['passes',
'http/tests',
'websocket/tests',
'failures/expected/*'])
oc = outputcapture.OutputCapture()
try:
oc.capture_output()
options, parsed_args = run_webkit_tests.parse_args(args)
user = MockUser()
if not port_obj:
port_obj = port.get(port_name=options.platform, options=options,
user=user)
buildbot_output = array_stream.ArrayStream()
regular_output = array_stream.ArrayStream()
res = run_webkit_tests.run(port_obj, options, parsed_args,
buildbot_output=buildbot_output,
regular_output=regular_output)
finally:
oc.restore_output()
return (res, buildbot_output, regular_output, user)
示例7: make_generator
def make_generator(self, files, tests):
options = mocktool.MockOptions(configuration=None, html_directory="/tmp")
host_port = port.get("test", options, filesystem=unit_test_filesystem(files))
generator = rebaseline_chromium_webkit_tests.HtmlGenerator(
host_port, target_port=None, options=options, platforms=["test-mac-leopard"], rebaselining_tests=tests
)
return generator, host_port
示例8: __init__
def __init__(self, testFunc):
test_port = port.get("test-win-xp", None)
self._converter = TestConfigurationConverter(
test_port.all_test_configurations(), test_port.configuration_specifier_macros()
)
self._serializer = TestExpectationSerializer(self._converter)
unittest.TestCase.__init__(self, testFunc)
示例9: passing_run
def passing_run(extra_args=None, port_obj=None, record_results=False, tests_included=False, filesystem=None):
options, parsed_args = parse_args(extra_args, record_results, tests_included)
if not port_obj:
port_obj = port.get(port_name=options.platform, options=options, user=mocktool.MockUser(), filesystem=filesystem)
buildbot_output = array_stream.ArrayStream()
regular_output = array_stream.ArrayStream()
res = run_webkit_tests.run(port_obj, options, parsed_args, buildbot_output=buildbot_output, regular_output=regular_output)
return res == 0 and regular_output.empty() and buildbot_output.empty()
示例10: passing_run
def passing_run(args, port_obj=None, logging_included=False):
if not logging_included:
args.extend(['--print', 'nothing'])
options, args = run_webkit_tests.parse_args(args)
if port_obj is None:
port_obj = port.get(options.platform, options)
res = run_webkit_tests.run(port_obj, options, args)
return res == 0
示例11: test_parse_empty_string
def test_parse_empty_string(self):
test_port = port.get("test-win-xp", None)
test_port.test_exists = lambda test: True
test_config = test_port.test_configuration()
full_test_list = []
expectation_line = TestExpectationParser.tokenize("")
parser = TestExpectationParser(test_port, full_test_list, allow_rebaseline_modifier=False)
parser.parse(expectation_line)
self.assertFalse(expectation_line.is_invalid())
示例12: logging_run
def logging_run(args):
options, args = run_webkit_tests.parse_args(args)
port_obj = port.get(options.platform, options)
buildbot_output = array_stream.ArrayStream()
regular_output = array_stream.ArrayStream()
res = run_webkit_tests.run(port_obj, options, args,
buildbot_output=buildbot_output,
regular_output=regular_output)
return (res, buildbot_output, regular_output)
示例13: run
def run(self):
options = self._options
port_obj = port.get(self._platform_name, options)
# FIXME: this won't work if the calling process is logging
# somewhere other than sys.stderr and sys.stdout, but I'm not sure
# if this will be an issue in practice.
printer = printing.Printer(port_obj, options, sys.stderr, sys.stdout,
int(options.child_processes), options.experimental_fully_parallel)
self._client.run(port_obj)
printer.cleanup()
示例14: get_host_port_object
def get_host_port_object(options):
"""Return a port object for the platform we're running on."""
# We want the ImageDiff logic to match that of the chromium bots, so we
# force the use of a Chromium port. We will look for either Debug or
# Release versions.
options.configuration = "Release"
options.chromium = True
port_obj = port.get(None, options)
if not port_obj.check_image_diff(override_step=None, logging=False):
_log.debug('No release version of the image diff binary was found.')
options.configuration = "Debug"
port_obj = port.get(None, options)
if not port_obj.check_image_diff(override_step=None, logging=False):
_log.error('No version of image diff was found. Check your build.')
return None
else:
_log.debug('Found the debug version of the image diff binary.')
else:
_log.debug('Found the release version of the image diff binary.')
return port_obj
示例15: get_host_port_object
def get_host_port_object(options):
"""Return a port object for the platform we're running on."""
# The only thing we really need on the host is a way to diff
# text files and image files, which means we need to check that some
# version of ImageDiff has been built. We will look for either Debug
# or Release versions of the default port on the platform.
options.configuration = "Release"
port_obj = port.get(None, options)
if not port_obj.check_image_diff(override_step=None, logging=False):
_log.debug('No release version of the image diff binary was found.')
options.configuration = "Debug"
port_obj = port.get(None, options)
if not port_obj.check_image_diff(override_step=None, logging=False):
_log.error('No version of image diff was found. Check your build.')
return None
else:
_log.debug('Found the debug version of the image diff binary.')
else:
_log.debug('Found the release version of the image diff binary.')
return port_obj