Example #1
0
def observatory(cameras, mount, site_details, scheduler):
    """Return a valid Observatory instance with a specific config."""

    obs = Observatory(scheduler=scheduler, simulator=['power', 'weather'])
    for cam_name, cam in cameras.items():
        obs.add_camera(cam_name, cam)

    obs.set_mount(mount)

    return obs
Example #2
0
def observatory(mount, cameras, images_dir):
    """Return a valid Observatory instance with a specific config."""

    site_details = create_location_from_config()
    scheduler = create_scheduler_from_config(observer=site_details['observer'])

    obs = Observatory(scheduler=scheduler)
    obs.set_mount(mount)
    for cam_name, cam in cameras.items():
        obs.add_camera(cam_name, cam)

    return obs
Example #3
0
def test_set_mount():
    obs = Observatory()
    assert obs.mount is None

    obs.set_mount(mount=None)
    assert obs.mount is None

    set_config(
        'mount', {
            'brand': 'Simulacrum',
            'driver': 'simulator',
            'model': 'panoptes.pocs.camera.simulator.dslr',
        })
    mount = create_mount_from_config()
    obs.set_mount(mount=mount)
    assert isinstance(obs.mount, AbstractMount) is True

    err_msg = 'Mount is not an instance of .*AbstractMount'
    with pytest.raises(TypeError, match=err_msg):
        obs.set_mount(mount='mount')
    err_msg = ".*missing 1 required positional argument.*"
    with pytest.raises(TypeError, match=err_msg):
        obs.set_mount()