def METHOD_NAME(rule_runner: RuleRunner, caplog) -> None:
    rule_runner.set_options(["--source-root-patterns=['src/thrifts']"])
    rule_runner.write_files(
        {
            "src/thrifts/project/f1.thrift": dedent(
                """\
                include 'tests/f.thrift';
                include 'unrelated_path/foo.thrift";
                """
            ),
            "src/thrifts/project/f2.thrift": "include 'project/f1.thrift';",
            "src/thrifts/project/BUILD": "thrift_sources()",
            "src/thrifts/tests/f.thrift": "",
            "src/thrifts/tests/BUILD": "thrift_sources()",
            # Test handling of ambiguous imports. We should warn on the ambiguous dependency, but
            # not warn on the disambiguated one and should infer a dep.
            "src/thrifts/ambiguous/dep.thrift": "",
            "src/thrifts/ambiguous/disambiguated.thrift": "",
            "src/thrifts/ambiguous/main.thrift": dedent(
                """\
                include 'ambiguous/dep.thrift';
                include 'ambiguous/disambiguated.thrift";
                """
            ),
            "src/thrifts/ambiguous/BUILD": dedent(
                """\
                thrift_sources(name='dep1', sources=['dep.thrift', 'disambiguated.thrift'])
                thrift_sources(name='dep2', sources=['dep.thrift', 'disambiguated.thrift'])
                thrift_sources(
                    name='main',
                    sources=['main.thrift'],
                    dependencies=['!./disambiguated.thrift:dep2'],
                )
                """
            ),
        }
    )
    def run_dep_inference(address: Address) -> InferredDependencies:
        tgt = rule_runner.get_target(address)
        return rule_runner.request(
            InferredDependencies,
            [InferThriftDependencies(ThriftDependenciesInferenceFieldSet.create(tgt))],
        )
    assert run_dep_inference(
        Address("src/thrifts/project", relative_file_path="f1.thrift")
    ) == InferredDependencies([Address("src/thrifts/tests", relative_file_path="f.thrift")])
    assert run_dep_inference(
        Address("src/thrifts/project", relative_file_path="f2.thrift")
    ) == InferredDependencies([Address("src/thrifts/project", relative_file_path="f1.thrift")])
    caplog.clear()
    assert run_dep_inference(
        Address("src/thrifts/ambiguous", target_name="main", relative_file_path="main.thrift")
    ) == InferredDependencies(
        [
            Address(
                "src/thrifts/ambiguous",
                target_name="dep1",
                relative_file_path="disambiguated.thrift",
            )
        ]
    )
    assert len(caplog.records) == 1
    assert (
        "The target src/thrifts/ambiguous/main.thrift:main imports `ambiguous/dep.thrift`"
        in caplog.text
    )
    assert (
        "['src/thrifts/ambiguous/dep.thrift:dep1', 'src/thrifts/ambiguous/dep.thrift:dep2']"
        in caplog.text
    )
    assert "disambiguated.thrift" not in caplog.text