def test_get_pinned_versions_from_requirement(requirement, expected_pkgs):
    result = main.get_pinned_versions_from_requirement(
        main.parse_requirement(requirement), )
    # These are to make this not flaky in future when things change
    assert isinstance(result, set)
    result = sorted(result)
    split = [req.split('==') for req in result]
    packages = [package for package, _ in split]
    assert packages == expected_pkgs
def test_get_pinned_versions_from_requirement_circular():
    # Used to hang forever
    assert main.get_pinned_versions_from_requirement(
        main.parse_requirement('sphinx'), )
def test_parse_requirement(reqin, reqout):
    assert (main.parse_requirement(reqin) == pkg_resources.Requirement.parse(
        reqout))