fix various linter errors (#93)

This commit is contained in:
c-parsons 2019-01-14 12:41:43 -05:00 committed by GitHub
parent 9948d5538b
commit 197d869482
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 5 deletions

View File

@ -32,7 +32,7 @@ def register_unittest_toolchains():
TOOLCHAIN_TYPE = "@bazel_skylib//toolchains/unittest:toolchain_type" TOOLCHAIN_TYPE = "@bazel_skylib//toolchains/unittest:toolchain_type"
_UnittestToolchain = provider( _UnittestToolchainInfo = provider(
doc = "Execution platform information for rules in the bazel_skylib repository.", doc = "Execution platform information for rules in the bazel_skylib repository.",
fields = ["file_ext", "success_templ", "failure_templ", "join_on"], fields = ["file_ext", "success_templ", "failure_templ", "join_on"],
) )
@ -40,7 +40,7 @@ _UnittestToolchain = provider(
def _unittest_toolchain_impl(ctx): def _unittest_toolchain_impl(ctx):
return [ return [
platform_common.ToolchainInfo( platform_common.ToolchainInfo(
unittest_toolchain_info = _UnittestToolchain( unittest_toolchain_info = _UnittestToolchainInfo(
file_ext = ctx.attr.file_ext, file_ext = ctx.attr.file_ext,
success_templ = ctx.attr.success_templ, success_templ = ctx.attr.success_templ,
failure_templ = ctx.attr.failure_templ, failure_templ = ctx.attr.failure_templ,

View File

@ -45,7 +45,7 @@ def _assert_error(env, errors, expected_fragment, msg):
return return
unittest.fail(env, msg + ": did not find \"%s\" in: [%s]" % (expected_fragment, "\n".join(errors))) unittest.fail(env, msg + ": did not find \"%s\" in: [%s]" % (expected_fragment, "\n".join(errors)))
def _contains_substrings_in_order(env, s, substrings): def _contains_substrings_in_order(s, substrings):
index = 0 index = 0
for ss in substrings: for ss in substrings:
index = s.find(ss, index) index = s.find(ss, index)
@ -56,7 +56,7 @@ def _contains_substrings_in_order(env, s, substrings):
def _assert_error_fragments(env, errors, expected_fragments, msg): def _assert_error_fragments(env, errors, expected_fragments, msg):
for e in errors: for e in errors:
if _contains_substrings_in_order(env, e, expected_fragments): if _contains_substrings_in_order(e, expected_fragments):
return return
unittest.fail(env, msg + ": did not find expected fragments in \"%s\" in order" % "\n".join(errors)) unittest.fail(env, msg + ": did not find expected fragments in \"%s\" in order" % "\n".join(errors))
@ -337,7 +337,7 @@ def _create_outputs_test(ctx):
src3 = _mock_file(ctx, language + "/bar/src1.txt") src3 = _mock_file(ctx, language + "/bar/src1.txt")
foreach_srcs = [src1, src2, src3] foreach_srcs = [src1, src2, src3]
outs_dicts, all_output_files, src_placeholders_dicts, errors = ( outs_dicts, all_output_files, _, errors = (
maprule_testing.create_outputs( maprule_testing.create_outputs(
ctx, ctx,
"my_maprule", "my_maprule",

View File

@ -1,3 +1,5 @@
"""Dependency registration helpers for repositories which need to load bazel-skylib."""
load("@bazel_skylib//lib:unittest.bzl", "register_unittest_toolchains") load("@bazel_skylib//lib:unittest.bzl", "register_unittest_toolchains")
def bazel_skylib_workspace(): def bazel_skylib_workspace():