Esempio n. 1
0
def test__load_variants():
    from rospkg.distro import _load_variants
    raw_data = yaml.load("""variants:
- ros-base:
    stacks: [ros, ros_comm]
- ros-full:
    extends: ros-base
    stacks: [rx, documentation]
- viz:
    stacks: [visualization_common, visualization]
- robot:
    extends: [ros-base]
    stacks: [common_msgs, common, diagnostics]
- desktop:
    extends: [robot, viz, ros-full]
    stacks: [ros_tutorials, common_tutorials]
""")
    raw_data = raw_data['variants']
    # mock data so variants validate
    stacks = dict(ros=1, ros_comm=2, rx=3, documentation=4, visualization_common=5,
                  visualization=6, common_msgs=7, common=8, ros_tutorials=9, common_tutorials=10, diagnostics=11)
    variants = _load_variants(raw_data, stacks)
    assert set(variants.keys()) == set(['ros-base', 'ros-full', 'viz', 'robot', 'desktop']), variants.keys()
    assert variants['ros-base'].extends == []
    assert variants['ros-full'].extends == ['ros-base']    
    assert variants['desktop'].extends == ['robot', 'viz', 'ros-full']

    assert set(variants['ros-base'].get_stack_names(True)) == set(['ros', 'ros_comm'])
    assert set(variants['ros-base'].get_stack_names(False)) == set(['ros', 'ros_comm'])

    assert set(variants['ros-full'].get_stack_names(True)) == set(['rx', 'documentation', 'ros', 'ros_comm'])
    assert set(variants['ros-full'].get_stack_names(False)) == set(['rx', 'documentation'])

    assert set(variants['desktop'].get_stack_names(True)) == set(stacks.keys())
    assert set(variants['desktop'].get_stack_names(False)) == set(['ros_tutorials', 'common_tutorials'])
Esempio n. 2
0
def test__load_variants():
    from rospkg.distro import _load_variants
    raw_data = yaml.load("""variants:
- ros-base:
    stacks: [ros, ros_comm]
- ros-full:
    extends: ros-base
    stacks: [rx, documentation]
- viz:
    stacks: [visualization_common, visualization]
- robot:
    extends: [ros-base]
    stacks: [common_msgs, common, diagnostics]
- desktop:
    extends: [robot, viz, ros-full]
    stacks: [ros_tutorials, common_tutorials]
""")
    raw_data = raw_data['variants']
    # mock data so variants validate
    stacks = dict(ros=1, ros_comm=2, rx=3, documentation=4, visualization_common=5,
                  visualization=6, common_msgs=7, common=8, ros_tutorials=9, common_tutorials=10, diagnostics=11)
    variants = _load_variants(raw_data, stacks)
    assert set(variants.keys()) == set(['ros-base', 'ros-full', 'viz', 'robot', 'desktop']), variants.keys()
    assert variants['ros-base'].extends == []
    assert variants['ros-full'].extends == ['ros-base']
    assert variants['desktop'].extends == ['robot', 'viz', 'ros-full']

    assert set(variants['ros-base'].get_stack_names(True)) == set(['ros', 'ros_comm'])
    assert set(variants['ros-base'].get_stack_names(False)) == set(['ros', 'ros_comm'])

    assert set(variants['ros-full'].get_stack_names(True)) == set(['rx', 'documentation', 'ros', 'ros_comm'])
    assert set(variants['ros-full'].get_stack_names(False)) == set(['rx', 'documentation'])

    assert set(variants['desktop'].get_stack_names(True)) == set(stacks.keys())
    assert set(variants['desktop'].get_stack_names(False)) == set(['ros_tutorials', 'common_tutorials'])
Esempio n. 3
0
def test__load_variants():
    from rospkg.distro import _load_variants

    raw_data = yaml.load(
        """variants:
- ros-base:
    stacks: [ros, ros_comm]
- ros-full:
    extends: ros-base
    stacks: [rx, documentation]
- viz:
    stacks: [visualization_common, visualization]
- robot:
    extends: [ros-base]
    stacks: [common_msgs, common, diagnostics]
- desktop:
    extends: [robot, viz, ros-full]
    stacks: [ros_tutorials, common_tutorials]
"""
    )
    raw_data = raw_data["variants"]
    # mock data so variants validate
    stacks = dict(
        ros=1,
        ros_comm=2,
        rx=3,
        documentation=4,
        visualization_common=5,
        visualization=6,
        common_msgs=7,
        common=8,
        ros_tutorials=9,
        common_tutorials=10,
        diagnostics=11,
    )
    variants = _load_variants(raw_data, stacks)
    assert set(variants.keys()) == set(["ros-base", "ros-full", "viz", "robot", "desktop"]), variants.keys()
    assert variants["ros-base"].extends == []
    assert variants["ros-full"].extends == ["ros-base"]
    assert variants["desktop"].extends == ["robot", "viz", "ros-full"]

    assert set(variants["ros-base"].get_stack_names(True)) == set(["ros", "ros_comm"])
    assert set(variants["ros-base"].get_stack_names(False)) == set(["ros", "ros_comm"])

    assert set(variants["ros-full"].get_stack_names(True)) == set(["rx", "documentation", "ros", "ros_comm"])
    assert set(variants["ros-full"].get_stack_names(False)) == set(["rx", "documentation"])

    assert set(variants["desktop"].get_stack_names(True)) == set(stacks.keys())
    assert set(variants["desktop"].get_stack_names(False)) == set(["ros_tutorials", "common_tutorials"])