Example #1
0
def test_source_roots_request() -> None:
    rule_runner = RuleRunner(rules=[
        *source_root_rules(),
        QueryRule(SourceRootsResult, (SourceRootsRequest,
                                      OptionsBootstrapper)),
    ])
    req = SourceRootsRequest(
        files=(PurePath("src/python/foo/bar.py"),
               PurePath("tests/python/foo/bar_test.py")),
        dirs=(PurePath("src/python/foo"), PurePath("src/python/baz/qux")),
    )
    res = rule_runner.request_product(
        SourceRootsResult,
        [
            req,
            create_options_bootstrapper(
                args=["--source-root-patterns=['src/python','tests/python']"]),
        ],
    )
    assert {
        PurePath("src/python/foo/bar.py"): SourceRoot("src/python"),
        PurePath("tests/python/foo/bar_test.py"): SourceRoot("tests/python"),
        PurePath("src/python/foo"): SourceRoot("src/python"),
        PurePath("src/python/baz/qux"): SourceRoot("src/python"),
    } == dict(res.path_to_root)
Example #2
0
def rule_runner() -> RuleRunner:
    return RuleRunner(
        target_types=[HelmChartTarget, HelmUnitTestTestTarget],
        rules=[
            *external_tool.rules(),
            *tool.rules(),
            *chart.rules(),
            *test_rules(),
            *stripped_source_files.rules(),
            *source_root_rules(),
            *target_types_rules(),
            QueryRule(TestResult, (HelmUnitTestFieldSet,)),
        ],
    )
Example #3
0
def rule_runner() -> RuleRunner:
    return RuleRunner(
        target_types=[HelmChartTarget],
        rules=[
            *config_files.rules(),
            *external_tool.rules(),
            *tool.rules(),
            *chart.rules(),
            *package.rules(),
            *stripped_source_files.rules(),
            *source_root_rules(),
            *sources.rules(),
            SubsystemRule(HelmSubsystem),
            QueryRule(BuiltPackage, [HelmPackageFieldSet]),
        ],
    )
Example #4
0
def rule_runner() -> RuleRunner:
    rule_runner = RuleRunner(
        target_types=[HelmChartTarget],
        rules=[
            *config_files.rules(),
            *chart.rules(),
            *external_tool.rules(),
            *helm_lint_rules(),
            *tool.rules(),
            *stripped_source_files.rules(),
            *source_root_rules(),
            *sources.rules(),
            SubsystemRule(HelmSubsystem),
            QueryRule(LintResults, (HelmLintRequest, )),
        ],
    )
    return rule_runner
Example #5
0
def rules():
    return (*collect_rules(), *source_root_rules(), *source_files_rules())
Example #6
0
 def rules(cls):
     return [
         *super().rules(), *source_root_rules(),
         RootRule(SourceRootsRequest)
     ]