a6add8ae090edaf8ce525d49d9fe0cf38a0a91c7,src/python/pants/backend/python/dependency_inference/module_mapper_test.py,,test_map_module_to_address,#Any#,186

Before Change


    // can handle when the module includes a symbol (like a class name) at the end.
    rule_runner.create_file("script.py")
    rule_runner.add_to_build_file("", "python_library(name="script")")
    assert get_owners("script.Demo") == [
        Address("", relative_file_path="script.py", target_name="script")
    ]

After Change


    rule_runner.create_files("source_root1/ambiguous", ["f1.py", "f2.py", "f3.py"])
    rule_runner.add_to_build_file(
        "source_root1/ambiguous",
        dedent(
            \
            // Ambiguity purely within third-party deps.
            python_requirement_library(name="thirdparty1", requirements=["foo"])
            python_requirement_library(name="thirdparty2", requirements=["foo"])

            // Ambiguity purely within first-party deps.
            python_library(name="firstparty1", sources=["f1.py"])
            python_library(name="firstparty2", sources=["f1.py"])

            // Ambiguity within third-party, which should result in ambiguity for first-party too.
            // These all share the module `ambiguous.f2`.
            python_requirement_library(
                name="thirdparty3", requirements=["bar"], module_mapping={"bar": ["ambiguous.f2"]}
            )
            python_requirement_library(
                name="thirdparty4", requirements=["bar"], module_mapping={"bar": ["ambiguous.f2"]}
            )
            python_library(name="firstparty3", sources=["f2.py"])

            // Ambiguity within first-party, which should result in ambiguity for third-party too.
            // These all share the module `ambiguous.f3`.
            python_library(name="firstparty4", sources=["f3.py"])
            python_library(name="firstparty5", sources=["f3.py"])
            python_requirement_library(
                name="thirdparty5", requirements=["baz"], module_mapping={"baz": ["ambiguous.f3"]}
            )
            
        ),
    )
    assert_owners(
        "foo",
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 2

Instances


Project Name: pantsbuild/pants
Commit Name: a6add8ae090edaf8ce525d49d9fe0cf38a0a91c7
Time: 2021-03-23
Author: 14852634+Eric-Arellano@users.noreply.github.com
File Name: src/python/pants/backend/python/dependency_inference/module_mapper_test.py
Class Name:
Method Name: test_map_module_to_address


Project Name: pantsbuild/pants
Commit Name: df75d99aa353ecf4dd69185232041c952a3f72b7
Time: 2014-12-03
Author: john.sirois@gmail.com
File Name: tests/python/pants_test/graph/test_build_graph.py
Class Name: BuildGraphTest
Method Name: test_transitive_closure_address


Project Name: pantsbuild/pants
Commit Name: 4cc0da1c0d7a147b28913c3bb0c2f270ced70a87
Time: 2015-03-31
Author: john.sirois@gmail.com
File Name: tests/python/pants_test/backend/python/tasks/test_setup_py.py
Class Name: TestSetupPy
Method Name: test_pants_contrib_case


Project Name: pantsbuild/pants
Commit Name: 6af8bc8142ec5575947b8f87dccdf629bc4c45b7
Time: 2020-07-02
Author: 14852634+Eric-Arellano@users.noreply.github.com
File Name: tests/python/pants_test/backend/python/test_python_requirement_list.py
Class Name: PythonRequirementListTest
Method Name: test_bad_list