本文整理汇总了Python中webkitpy.layout_tests.lint_test_expectations.lint函数的典型用法代码示例。如果您正苦于以下问题:Python lint函数的具体用法?Python lint怎么用?Python lint使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了lint函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_all_configurations
def test_all_configurations(self):
host = MockHost()
host.ports_parsed = []
host.port_factory = FakeFactory(host, (FakePort(host, 'a', 'path-to-a'),
FakePort(host, 'b', 'path-to-b'),
FakePort(host, 'b-win', 'path-to-b')))
logging_stream = StringIO.StringIO()
options = optparse.Values({'platform': None})
res = lint_test_expectations.lint(host, options, logging_stream)
self.assertEqual(res, 0)
self.assertEqual(host.ports_parsed, ['a', 'b', 'b-win'])
示例2: test_lint_test_files
def test_lint_test_files(self):
logging_stream = StringIO.StringIO()
options = optparse.Values({'platform': 'test-mac-leopard'})
host = MockHost()
# pylint appears to complain incorrectly about the method overrides pylint: disable=E0202,C0322
# FIXME: incorrect complaints about spacing pylint: disable=C0322
host.port_factory.all_port_names = lambda platform=None: [platform]
res = lint_test_expectations.lint(host, options, logging_stream)
self.assertEqual(res, 0)
self.assertIn('Lint succeeded', logging_stream.getvalue())
示例3: test_lint_test_files
def test_lint_test_files(self):
logging_stream = StringIO.StringIO()
options = optparse.Values({'platform': 'test-mac-leopard'})
host = MockHost()
# pylint appears to complain incorrectly about the method overrides pylint: disable=E0202,C0322
# FIXME: incorrect complaints about spacing pylint: disable=C0322
host.port_factory.all_port_names = lambda platform=None: [platform]
logger, handler = lint_test_expectations.set_up_logging(logging_stream)
try:
res = lint_test_expectations.lint(host, options)
self.assertEqual(res, 0)
finally:
lint_test_expectations.tear_down_logging(logger, handler)
示例4: test_all_configurations
def test_all_configurations(self):
host = MockHost()
host.ports_parsed = []
host.port_factory = FakeFactory(host, (FakePort(host, 'a', 'path-to-a'),
FakePort(host, 'b', 'path-to-b'),
FakePort(host, 'b-win', 'path-to-b')))
logging_stream = StringIO.StringIO()
options = optparse.Values({'platform': None})
logger, handler = lint_test_expectations.set_up_logging(logging_stream)
try:
res = lint_test_expectations.lint(host, options)
finally:
lint_test_expectations.tear_down_logging(logger, handler)
self.assertEqual(res, 0)
self.assertEqual(host.ports_parsed, ['a', 'b', 'b-win'])
示例5: test_all_configurations
def test_all_configurations(self):
host = MockHost()
host.ports_parsed = []
host.port_factory = FakeFactory(
host,
(FakePort(host, "a", "path-to-a"), FakePort(host, "b", "path-to-b"), FakePort(host, "b-win", "path-to-b")),
)
logging_stream = StringIO.StringIO()
options = optparse.Values({"platform": None})
logger, handler = lint_test_expectations.set_up_logging(logging_stream)
try:
res = lint_test_expectations.lint(host, options)
finally:
lint_test_expectations.tear_down_logging(logger, handler)
self.assertEqual(res, [])
self.assertEqual(host.ports_parsed, ["a", "b", "b-win"])
示例6: test_lint_test_files__errors
def test_lint_test_files__errors(self):
options = optparse.Values({'platform': 'test', 'debug_rwt_logging': False})
host = MockHost()
# FIXME: incorrect complaints about spacing pylint: disable=C0322
port = host.port_factory.get(options.platform, options=options)
port.expectations_dict = lambda: {'foo': '-- syntax error1', 'bar': '-- syntax error2'}
host.port_factory.get = lambda platform, options=None: port
host.port_factory.all_port_names = lambda platform=None: [port.name()]
logging_stream = StringIO.StringIO()
res = lint_test_expectations.lint(host, options, logging_stream)
self.assertEqual(res, -1)
self.assertIn('Lint failed', logging_stream.getvalue())
self.assertIn('foo:1', logging_stream.getvalue())
self.assertIn('bar:1', logging_stream.getvalue())
示例7: test_lint_flag_specific_expectation_errors
def test_lint_flag_specific_expectation_errors(self):
options = optparse.Values({'platform': 'test', 'debug_rwt_logging': False})
host = MockHost()
# FIXME: incorrect complaints about spacing pylint: disable=C0322
port = host.port_factory.get(options.platform, options=options)
port.expectations_dict = lambda: {'flag-specific': 'does/not/exist', 'noproblem': ''}
host.port_factory.get = lambda platform, options=None: port
host.port_factory.all_port_names = lambda platform=None: [port.name()]
logging_stream = StringIO.StringIO()
logger, handler = lint_test_expectations.set_up_logging(logging_stream)
try:
res = lint_test_expectations.lint(host, options)
finally:
lint_test_expectations.tear_down_logging(logger, handler)
self.assertTrue(res)
self.assertIn('flag-specific:1 Path does not exist. does/not/exist', logging_stream.getvalue())
self.assertNotIn('noproblem', logging_stream.getvalue())
示例8: test_lint_test_files__errors
def test_lint_test_files__errors(self):
options = optparse.Values({"platform": "test", "debug_rwt_logging": False})
host = MockHost()
# FIXME: incorrect complaints about spacing pylint: disable=C0322
port = host.port_factory.get(options.platform, options=options)
port.expectations_dict = lambda: {"foo": "-- syntax error1", "bar": "-- syntax error2"}
host.port_factory.get = lambda platform, options=None: port
host.port_factory.all_port_names = lambda platform=None: [port.name()]
logging_stream = StringIO.StringIO()
logger, handler = lint_test_expectations.set_up_logging(logging_stream)
try:
res = lint_test_expectations.lint(host, options)
finally:
lint_test_expectations.tear_down_logging(logger, handler)
self.assertTrue(res)
self.assertIn("foo:1", logging_stream.getvalue())
self.assertIn("bar:1", logging_stream.getvalue())
示例9: main
def main(argv, stdout, stderr):
options, args = parse_args(argv)
if options.platform and 'test' in options.platform:
# It's a bit lame to import mocks into real code, but this allows the user
# to run tests against the test platform interactively, which is useful for
# debugging test failures.
from webkitpy.common.host_mock import MockHost
host = MockHost()
else:
host = Host()
if options.lint_test_files:
from webkitpy.layout_tests.lint_test_expectations import lint
return lint(host, options, stderr)
try:
port = host.port_factory.get(options.platform, options)
except NotImplementedError, e:
# FIXME: is this the best way to handle unsupported port names?
print >> stderr, str(e)
return EXCEPTIONAL_EXIT_STATUS