<#18958 A comment as the first entry of a try/exce...
# github-notifications
c
#18958 A comment as the first entry of a try/except stops imports from being weakened Issue created by thejcannon
Copy code
def test_uhoh(rule_runner: RuleRunner) -> None:
    content = dedent(
        """\
        try:
            # uh oh
            from one import thing, other_thing
        except ImportError:
            from .one import thing, other_thing
        """
    )
    assert_deps_parsed(
        rule_runner,
        content,
        filename=f"a/b/c/d.py",
        expected_imports={
            "one.thing": ImpInfo(lineno=3, weak=True),
            "one.other_thing": ImpInfo(lineno=3, weak=True),
            "a.b.c.one.thing": ImpInfo(lineno=5, weak=False),
            "a.b.c.one.other_thing": ImpInfo(lineno=5, weak=False),
        },
    )
Toggling the comment toggles the failure 😱 pantsbuild/pants