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)
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,)), ], )
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]), ], )
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
def rules(): return (*collect_rules(), *source_root_rules(), *source_files_rules())
def rules(cls): return [ *super().rules(), *source_root_rules(), RootRule(SourceRootsRequest) ]