本文整理汇总了Python中webkitpy.common.webkit_finder.WebKitFinder.path_from_webkit_base方法的典型用法代码示例。如果您正苦于以下问题:Python WebKitFinder.path_from_webkit_base方法的具体用法?Python WebKitFinder.path_from_webkit_base怎么用?Python WebKitFinder.path_from_webkit_base使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类webkitpy.common.webkit_finder.WebKitFinder
的用法示例。
在下文中一共展示了WebKitFinder.path_from_webkit_base方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from webkitpy.common.webkit_finder import WebKitFinder [as 别名]
# 或者: from webkitpy.common.webkit_finder.WebKitFinder import path_from_webkit_base [as 别名]
def __init__(self, host, source_directory, options):
self.host = host
self.source_directory = source_directory
self.options = options
self.filesystem = self.host.filesystem
webkit_finder = WebKitFinder(self.filesystem)
self._webkit_root = webkit_finder.webkit_base()
self.destination_directory = webkit_finder.path_from_webkit_base("LayoutTests", options.destination)
self.tests_w3c_relative_path = self.filesystem.join('imported', 'w3c')
self.layout_tests_path = webkit_finder.path_from_webkit_base('LayoutTests')
self.layout_tests_w3c_path = self.filesystem.join(self.layout_tests_path, self.tests_w3c_relative_path)
self.tests_download_path = webkit_finder.path_from_webkit_base('WebKitBuild', 'w3c-tests')
self._test_downloader = None
self._potential_test_resource_files = []
self.import_list = []
self._importing_downloaded_tests = source_directory is None
self._test_resource_files_json_path = self.filesystem.join(self.layout_tests_w3c_path, "resources", "resource-files.json")
self._test_resource_files = json.loads(self.filesystem.read_text_file(self._test_resource_files_json_path)) if self.filesystem.exists(self._test_resource_files_json_path) else None
self._tests_options_json_path = self.filesystem.join(self.layout_tests_path, 'tests-options.json')
self._tests_options = json.loads(self.filesystem.read_text_file(self._tests_options_json_path)) if self.filesystem.exists(self._tests_options_json_path) else None
self._slow_tests = []
if self.options.clean_destination_directory and self._test_resource_files:
self._test_resource_files["files"] = []
if self._tests_options:
self.remove_slow_from_w3c_tests_options()
示例2: _run_pylint
# 需要导入模块: from webkitpy.common.webkit_finder import WebKitFinder [as 别名]
# 或者: from webkitpy.common.webkit_finder.WebKitFinder import path_from_webkit_base [as 别名]
def _run_pylint(self, path):
wkf = WebKitFinder(FileSystem())
executive = Executive()
env = os.environ.copy()
env['PYTHONPATH'] = ('%s%s%s' % (wkf.path_from_webkit_base('Tools', 'Scripts'),
os.pathsep,
wkf.path_from_webkit_base('Tools', 'Scripts', 'webkitpy', 'thirdparty')))
return executive.run_command([sys.executable, wkf.path_from_depot_tools_base('pylint.py'),
'--output-format=parseable',
'--errors-only',
'--rcfile=' + wkf.path_from_webkit_base('Tools', 'Scripts', 'webkitpy', 'pylintrc'),
path],
env=env,
error_handler=executive.ignore_error)
示例3: load_test_repositories
# 需要导入模块: from webkitpy.common.webkit_finder import WebKitFinder [as 别名]
# 或者: from webkitpy.common.webkit_finder.WebKitFinder import path_from_webkit_base [as 别名]
def load_test_repositories():
filesystem = FileSystem()
webkit_finder = WebKitFinder(filesystem)
test_repositories_path = webkit_finder.path_from_webkit_base(
"LayoutTests", "imported", "w3c", "resources", "TestRepositories"
)
return json.loads(filesystem.read_text_file(test_repositories_path))
示例4: __init__
# 需要导入模块: from webkitpy.common.webkit_finder import WebKitFinder [as 别名]
# 或者: from webkitpy.common.webkit_finder.WebKitFinder import path_from_webkit_base [as 别名]
def __init__(self, repository_directory, host, options):
self._options = options
self._host = host
self._filesystem = host.filesystem
self._test_suites = []
self.repository_directory = repository_directory
self.test_repositories = self.load_test_repositories()
self.paths_to_skip = []
self.paths_to_import = []
for test_repository in self.test_repositories:
self.paths_to_skip.extend(
[self._filesystem.join(test_repository["name"], path) for path in test_repository["paths_to_skip"]]
)
self.paths_to_import.extend(
[self._filesystem.join(test_repository["name"], path) for path in test_repository["paths_to_import"]]
)
if not self._options.import_all:
webkit_finder = WebKitFinder(self._filesystem)
import_expectations_path = webkit_finder.path_from_webkit_base(
"LayoutTests", "imported", "w3c", "resources", "ImportExpectations"
)
self._init_paths_from_expectations(import_expectations_path)
示例5: __init__
# 需要导入模块: from webkitpy.common.webkit_finder import WebKitFinder [as 别名]
# 或者: from webkitpy.common.webkit_finder.WebKitFinder import path_from_webkit_base [as 别名]
def __init__(self, host, source_directory, options):
self.host = host
self.source_directory = source_directory
self.options = options
self.filesystem = self.host.filesystem
webkit_finder = WebKitFinder(self.filesystem)
self._webkit_root = webkit_finder.webkit_base()
self.destination_directory = webkit_finder.path_from_webkit_base("LayoutTests", options.destination)
self.layout_tests_w3c_path = webkit_finder.path_from_webkit_base('LayoutTests', 'imported', 'w3c')
self.tests_download_path = webkit_finder.path_from_webkit_base('WebKitBuild', 'w3c-tests')
self._test_downloader = None
self.import_list = []
self._importing_downloaded_tests = source_directory is None
示例6: _run_pylint
# 需要导入模块: from webkitpy.common.webkit_finder import WebKitFinder [as 别名]
# 或者: from webkitpy.common.webkit_finder.WebKitFinder import path_from_webkit_base [as 别名]
def _run_pylint(self, path):
wkf = WebKitFinder(FileSystem())
executive = Executive()
return executive.run_command([sys.executable, wkf.path_from_depot_tools_base('pylint.py'),
'--output-format=parseable',
'--errors-only',
'--rcfile=' + wkf.path_from_webkit_base('Tools', 'Scripts', 'webkitpy', 'pylintrc'),
path],
error_handler=executive.ignore_error)
示例7: main
# 需要导入模块: from webkitpy.common.webkit_finder import WebKitFinder [as 别名]
# 或者: from webkitpy.common.webkit_finder.WebKitFinder import path_from_webkit_base [as 别名]
def main():
filesystem = FileSystem()
wkf = WebKitFinder(filesystem)
tester = Tester(filesystem, wkf)
tester.add_tree(wkf.path_from_webkit_base('tools'), 'webkitpy')
tester.skip(('webkitpy.common.checkout.scm.scm_unittest',), 'are really, really, slow', 31818)
if sys.platform == 'win32':
tester.skip(('webkitpy.common.checkout', 'webkitpy.common.config', 'webkitpy.tool', 'webkitpy.w3c', 'webkitpy.layout_tests.layout_package.bot_test_expectations'), 'fail horribly on win32', 54526)
return not tester.run()
示例8: __init__
# 需要导入模块: from webkitpy.common.webkit_finder import WebKitFinder [as 别名]
# 或者: from webkitpy.common.webkit_finder.WebKitFinder import path_from_webkit_base [as 别名]
def __init__(self, host, source_directory, options):
self.host = host
self.source_directory = source_directory
self.options = options
self.filesystem = self.host.filesystem
webkit_finder = WebKitFinder(self.filesystem)
self._webkit_root = webkit_finder.webkit_base()
self.destination_directory = webkit_finder.path_from_webkit_base("LayoutTests", options.destination)
self.tests_w3c_relative_path = self.filesystem.join("imported", "w3c")
self.layout_tests_w3c_path = webkit_finder.path_from_webkit_base("LayoutTests", self.tests_w3c_relative_path)
self.tests_download_path = webkit_finder.path_from_webkit_base("WebKitBuild", "w3c-tests")
self._test_downloader = None
self._potential_test_resource_files = []
self.import_list = []
self._importing_downloaded_tests = source_directory is None
示例9: main
# 需要导入模块: from webkitpy.common.webkit_finder import WebKitFinder [as 别名]
# 或者: from webkitpy.common.webkit_finder.WebKitFinder import path_from_webkit_base [as 别名]
def main():
filesystem = FileSystem()
wkf = WebKitFinder(filesystem)
tester = Tester(filesystem, wkf)
tester.add_tree(wkf.path_from_webkit_base('Tools', 'Scripts'), 'webkitpy')
tester.skip(('webkitpy.common.checkout.scm.scm_unittest',), 'are really, really, slow', 31818)
if sys.platform == 'win32':
tester.skip(('webkitpy.common.checkout', 'webkitpy.common.config', 'webkitpy.tool', 'webkitpy.w3c', 'webkitpy.layout_tests.layout_package.bot_test_expectations'), 'fail horribly on win32', 54526)
# This only needs to run on Unix, so don't worry about win32 for now.
appengine_sdk_path = '/usr/local/google_appengine'
if os.path.exists(appengine_sdk_path):
if not appengine_sdk_path in sys.path:
sys.path.append(appengine_sdk_path)
import dev_appserver
from google.appengine.dist import use_library
use_library('django', '1.2')
dev_appserver.fix_sys_path()
tester.add_tree(wkf.path_from_webkit_base('Tools', 'TestResultServer'))
else:
_log.info('Skipping TestResultServer tests; the Google AppEngine Python SDK is not installed.')
return not tester.run()
示例10: __init__
# 需要导入模块: from webkitpy.common.webkit_finder import WebKitFinder [as 别名]
# 或者: from webkitpy.common.webkit_finder.WebKitFinder import path_from_webkit_base [as 别名]
def __init__(self, repository_directory, host, options):
self._options = options
self._host = host
self._filesystem = host.filesystem
self._test_suites = []
self.repository_directory = repository_directory
self.test_repositories = self.load_test_repositories(self._filesystem)
self.paths_to_skip = []
self.paths_to_import = []
for test_repository in self.test_repositories:
self.paths_to_skip.extend([self._filesystem.join(test_repository['name'], path) for path in test_repository['paths_to_skip']])
self.paths_to_import.extend([self._filesystem.join(test_repository['name'], path) for path in test_repository['paths_to_import']])
if not self._options.import_all:
webkit_finder = WebKitFinder(self._filesystem)
import_expectations_path = webkit_finder.path_from_webkit_base('LayoutTests', 'imported', 'w3c', 'resources', 'ImportExpectations')
self._init_paths_from_expectations(import_expectations_path)
示例11: do_POST
# 需要导入模块: from webkitpy.common.webkit_finder import WebKitFinder [as 别名]
# 或者: from webkitpy.common.webkit_finder.WebKitFinder import path_from_webkit_base [as 别名]
def do_POST(self):
json_raw_data = self.rfile.read(int(self.headers.getheader('content-length')))
json_data = json.loads(json_raw_data)
test_list = ''
for each in json_data['tests']:
test_list += each + ' '
filesystem = FileSystem()
webkit_finder = WebKitFinder(filesystem)
script_dir = webkit_finder.path_from_webkit_base('Tools', 'Scripts')
executable_path = script_dir + "/run-webkit-tests"
cmd = "python " + executable_path + " --no-show-results "
cmd += test_list
process = subprocess.Popen(cmd, shell=True, cwd=script_dir, env=None, stdout=subprocess.PIPE, stderr=STDOUT)
self.send_response(200)
self.send_header('Access-Control-Allow-Origin', '*')
self.send_header("Content-type", "text/html")
self.end_headers()
while process.poll() is None:
html_output = '<br>' + str(process.stdout.readline())
self.wfile.write(html_output)
self.wfile.flush()
time.sleep(0.05)
process.wait()
示例12: Bisector
# 需要导入模块: from webkitpy.common.webkit_finder import WebKitFinder [as 别名]
# 或者: from webkitpy.common.webkit_finder.WebKitFinder import path_from_webkit_base [as 别名]
class Bisector(object):
def __init__(self, tests, is_debug):
self.executive = Executive()
self.tests = tests
self.expected_failure = tests[-1]
self.is_debug = is_debug
self.webkit_finder = WebKitFinder(FileSystem())
def bisect(self):
if self.test_fails_in_isolation():
self.buckets = [Bucket([self.expected_failure])]
print '%s fails when run in isolation.' % self.expected_failure
self.print_result()
return 0
if not self.test_fails(self.tests):
_log.error('%s does not fail' % self.expected_failure)
return 1
# Split the list of test into buckets. Each bucket has at least one test required to cause
# the expected failure at the end. Split buckets in half until there are only buckets left
# with one item in them.
self.buckets = [Bucket(self.tests[:-1]), Bucket([self.expected_failure])]
while not self.is_done():
self.print_progress()
self.split_largest_bucket()
self.print_result()
self.verify_non_flaky()
return 0
def test_fails_in_isolation(self):
return self.test_bucket_list_fails([Bucket([self.expected_failure])])
def verify_non_flaky(self):
print 'Verifying the failure is not flaky by running 10 times.'
count_failures = 0
for i in range(0, 10):
if self.test_bucket_list_fails(self.buckets):
count_failures += 1
print 'Failed %d/10 times' % count_failures
def print_progress(self):
count = 0
for bucket in self.buckets:
count += len(bucket.tests)
print '%d tests left, %d buckets' % (count, len(self.buckets))
def print_result(self):
tests = []
for bucket in self.buckets:
tests += bucket.tests
extra_args = ' --debug' if self.is_debug else ''
print 'run-webkit-tests%s --child-processes=1 --order=none %s' % (extra_args, " ".join(tests))
def is_done(self):
for bucket in self.buckets:
if bucket.size() > 1:
return False
return True
def split_largest_bucket(self):
index = 0
largest_index = 0
largest_size = 0
for bucket in self.buckets:
if bucket.size() > largest_size:
largest_index = index
largest_size = bucket.size()
index += 1
bucket_to_split = self.buckets[largest_index]
halfway_point = int(largest_size / 2)
first_half = Bucket(bucket_to_split.tests[:halfway_point])
second_half = Bucket(bucket_to_split.tests[halfway_point:])
buckets_before = self.buckets[:largest_index]
buckets_after = self.buckets[largest_index + 1:]
# Do the second half first because it tends to be faster because the http tests are front-loaded and slow.
new_buckets = buckets_before + [second_half] + buckets_after
if self.test_bucket_list_fails(new_buckets):
self.buckets = new_buckets
return
new_buckets = buckets_before + [first_half] + buckets_after
if self.test_bucket_list_fails(new_buckets):
self.buckets = new_buckets
return
self.buckets = buckets_before + [first_half, second_half] + buckets_after
def test_bucket_list_fails(self, buckets):
tests = []
for bucket in buckets:
tests += bucket.tests
return self.test_fails(tests)
def test_fails(self, tests):
extra_args = ['--debug'] if self.is_debug else []
path_to_run_webkit_tests = self.webkit_finder.path_from_webkit_base('tools', 'test_sky')
output = self.executive.popen([path_to_run_webkit_tests, '--child-processes', '1', '--order', 'none', '--no-retry', '--no-show-results', '--verbose'] + extra_args + tests, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
#.........这里部分代码省略.........
示例13: absolute_chromium_wpt_dir
# 需要导入模块: from webkitpy.common.webkit_finder import WebKitFinder [as 别名]
# 或者: from webkitpy.common.webkit_finder.WebKitFinder import path_from_webkit_base [as 别名]
def absolute_chromium_wpt_dir(self):
finder = WebKitFinder(self.host.filesystem)
return finder.path_from_webkit_base("LayoutTests", "imported", "wpt")
示例14: TestImporter
# 需要导入模块: from webkitpy.common.webkit_finder import WebKitFinder [as 别名]
# 或者: from webkitpy.common.webkit_finder.WebKitFinder import path_from_webkit_base [as 别名]
class TestImporter(object):
def __init__(self, host, source_repo_path, options):
self.host = host
self.source_repo_path = source_repo_path
self.options = options
self.filesystem = self.host.filesystem
self.webkit_finder = WebKitFinder(self.filesystem)
self._webkit_root = self.webkit_finder.webkit_base()
self.layout_tests_dir = self.webkit_finder.path_from_webkit_base('LayoutTests')
self.destination_directory = self.filesystem.normpath(
self.filesystem.join(
self.layout_tests_dir,
options.destination,
self.filesystem.basename(self.source_repo_path)))
self.import_in_place = (self.source_repo_path == self.destination_directory)
self.dir_above_repo = self.filesystem.dirname(self.source_repo_path)
self.import_list = []
# This is just a FYI list of CSS properties that still need to be prefixed,
# which may be output after importing.
self._prefixed_properties = {}
def do_import(self):
_log.info("Importing %s into %s", self.source_repo_path, self.destination_directory)
self.find_importable_tests()
self.import_tests()
def find_importable_tests(self):
"""Walks through the source directory to find what tests should be imported.
This function sets self.import_list, which contains information about how many
tests are being imported, and their source and destination paths.
"""
paths_to_skip = self.find_paths_to_skip()
for root, dirs, files in self.filesystem.walk(self.source_repo_path):
cur_dir = root.replace(self.dir_above_repo + '/', '') + '/'
_log.info(' scanning ' + cur_dir + '...')
total_tests = 0
reftests = 0
jstests = 0
# Files in 'tools' are not for browser testing, so we skip them.
# See: http://testthewebforward.org/docs/test-format-guidelines.html#tools
DIRS_TO_SKIP = ('.git', 'test-plan', 'tools')
# We copy all files in 'support', including HTML without metadata.
# See: http://testthewebforward.org/docs/test-format-guidelines.html#support-files
DIRS_TO_INCLUDE = ('resources', 'support')
if dirs:
for d in DIRS_TO_SKIP:
if d in dirs:
dirs.remove(d)
for path in paths_to_skip:
path_base = path.replace(self.options.destination + '/', '')
path_base = path_base.replace(cur_dir, '')
path_full = self.filesystem.join(root, path_base)
if path_base in dirs:
dirs.remove(path_base)
if not self.options.dry_run and self.import_in_place:
_log.info(" pruning %s", path_base)
self.filesystem.rmtree(path_full)
else:
_log.info(" skipping %s", path_base)
copy_list = []
for filename in files:
path_full = self.filesystem.join(root, filename)
path_base = path_full.replace(self.source_repo_path + '/', '')
path_base = self.destination_directory.replace(self.layout_tests_dir + '/', '') + '/' + path_base
if path_base in paths_to_skip:
if not self.options.dry_run and self.import_in_place:
_log.info(" pruning %s", path_base)
self.filesystem.remove(path_full)
continue
else:
continue
# FIXME: This block should really be a separate function, but the early-continues make that difficult.
if filename.startswith('.') or filename.endswith('.pl'):
# The w3cs repos may contain perl scripts, which we don't care about.
continue
if filename == 'OWNERS' or filename == 'reftest.list':
# These files fail our presubmits.
# See http://crbug.com/584660 and http://crbug.com/582838.
continue
fullpath = self.filesystem.join(root, filename)
mimetype = mimetypes.guess_type(fullpath)
if ('html' not in str(mimetype[0]) and
'application/xhtml+xml' not in str(mimetype[0]) and
'application/xml' not in str(mimetype[0])):
copy_list.append({'src': fullpath, 'dest': filename})
#.........这里部分代码省略.........
示例15: DepsUpdater
# 需要导入模块: from webkitpy.common.webkit_finder import WebKitFinder [as 别名]
# 或者: from webkitpy.common.webkit_finder.WebKitFinder import path_from_webkit_base [as 别名]
class DepsUpdater(object):
def __init__(self, host):
self.host = host
self.executive = host.executive
self.fs = host.filesystem
self.finder = WebKitFinder(self.fs)
self.verbose = False
self.allow_local_blink_commits = False
self.keep_w3c_repos_around = False
def main(self, argv=None):
self.parse_args(argv)
self.cd('')
if not self.checkout_is_okay():
return 1
self.print_('## noting the current Blink commitish')
blink_commitish = self.run(['git', 'show-ref', 'HEAD'])[1].split()[0]
wpt_import_text = self.update('web-platform-tests',
'https://chromium.googlesource.com/external/w3c/web-platform-tests.git')
css_import_text = self.update('csswg-test',
'https://chromium.googlesource.com/external/w3c/csswg-test.git')
self.commit_changes_if_needed(blink_commitish, css_import_text, wpt_import_text)
return 0
def parse_args(self, argv):
parser = argparse.ArgumentParser()
parser.description = __doc__
parser.add_argument('-v', '--verbose', action='store_true',
help='log what we are doing')
parser.add_argument('--allow-local-blink-commits', action='store_true',
help='allow script to run even if we have local blink commits')
parser.add_argument('--keep-w3c-repos-around', action='store_true',
help='leave the w3c repos around that were imported previously.')
args = parser.parse_args(argv)
self.allow_local_blink_commits = args.allow_local_blink_commits
self.keep_w3c_repos_around = args.keep_w3c_repos_around
self.verbose = args.verbose
def checkout_is_okay(self):
if self.run(['git', 'diff', '--quiet', 'HEAD'], exit_on_failure=False)[0]:
self.print_('## blink checkout is dirty, aborting')
return False
local_blink_commits = self.run(['git', 'log', '--oneline', 'origin/master..HEAD'])[1]
if local_blink_commits and not self.allow_local_blink_commits:
self.print_('## blink checkout has local commits, aborting')
return False
if self.fs.exists(self.path_from_webkit_base('web-platform-tests')):
self.print_('## web-platform-tests repo exists, aborting')
return False
if self.fs.exists(self.path_from_webkit_base('csswg-test')):
self.print_('## csswg-test repo exists, aborting')
return False
return True
def update(self, repo, url):
self.print_('## cloning %s' % repo)
self.cd('')
self.run(['git', 'clone', url])
self.print_('## noting the revision we are importing')
master_commitish = self.run(['git', 'show-ref', 'origin/master'])[1].split()[0]
self.print_('## cleaning out tests from LayoutTests/imported/%s' % repo)
dest_repo = self.path_from_webkit_base('LayoutTests', 'imported', repo)
files_to_delete = self.fs.files_under(dest_repo, file_filter=self.is_not_baseline)
for subpath in files_to_delete:
self.remove('LayoutTests', 'imported', subpath)
self.print_('## importing the tests')
src_repo = self.path_from_webkit_base(repo)
import_path = self.path_from_webkit_base('Tools', 'Scripts', 'import-w3c-tests')
self.run([self.host.executable, import_path, '-d', 'imported', src_repo])
self.cd('')
self.run(['git', 'add', '--all', 'LayoutTests/imported/%s' % repo])
self.print_('## deleting manual tests')
files_to_delete = self.fs.files_under(dest_repo, file_filter=self.is_manual_test)
for subpath in files_to_delete:
self.remove('LayoutTests', 'imported', subpath)
self.print_('## deleting any orphaned baselines')
previous_baselines = self.fs.files_under(dest_repo, file_filter=self.is_baseline)
for subpath in previous_baselines:
full_path = self.fs.join(dest_repo, subpath)
if self.fs.glob(full_path.replace('-expected.txt', '*')) == [full_path]:
self.fs.remove(full_path)
if not self.keep_w3c_repos_around:
#.........这里部分代码省略.........