def test_operate_dome(config_with_simulated_dome): simulator = hardware.get_all_names(without=['dome', 'night']) observatory = Observatory(config=config_with_simulated_dome, simulator=simulator, ignore_local_config=True) assert observatory.has_dome assert observatory.open_dome() assert observatory.dome.is_open assert observatory.close_dome() assert observatory.dome.is_closed
def test_camera_import_error(config): conf = config.copy() conf['cameras']['devices'][0]['model'] = 'foobar' conf['cameras']['devices'][0]['port'] = 'usb:001,002' simulator = hardware.get_all_names(without=['camera']) with pytest.raises(error.NotFound): Observatory(simulator=simulator, config=conf, auto_detect=False, ignore_local_config=True)
def test_bad_mount(config): conf = config.copy() simulator = hardware.get_all_names(without=['mount']) conf['mount']['port'] = '/dev/' conf['mount']['driver'] = 'foobar' with pytest.raises(error.NotFound): Observatory(simulator=simulator, config=conf, ignore_local_config=True)
def test_bad_mount(config): conf = config.copy() simulator = ['weather', 'camera', 'night'] conf['mount']['port'] = '/dev/' conf['mount']['driver'] = 'foobar' with pytest.raises(error.NotFound): Observatory(simulator=simulator, config=conf, ignore_local_config=True)
def pocs_with_dome(config_with_simulated_dome): os.environ['POCSTIME'] = '2016-08-13 13:00:00' simulator = hardware.get_all_names(without=['dome']) observatory = Observatory(config=config_with_simulated_dome, simulator=simulator, ignore_local_config=True) pocs = POCS(observatory, run_once=True, config=config_with_simulated_dome, ignore_local_config=True, db='panoptes_testing') pocs.observatory.scheduler.fields_list = [ {'name': 'Wasp 33', 'position': '02h26m51.0582s +37d33m01.733s', 'priority': '100', 'exp_time': 2, 'min_nexp': 2, 'exp_set_size': 2, }, ] yield pocs pocs.power_down()
def test_bad_camera(config): conf = config.copy() simulator = ['weather', 'mount', 'night'] with pytest.raises(error.PanError): Observatory(simulator=simulator, config=conf, auto_detect=True, ignore_local_config=True)
def test_camera_port_error(config): conf = config.copy() conf['cameras']['devices'][0]['model'] = 'foobar' simulator = ['weather', 'mount', 'night'] with pytest.raises(error.CameraNotFound): Observatory(simulator=simulator, config=conf, auto_detect=False, ignore_local_config=True)
def observatory(): observatory = Observatory(simulator=['all']) yield observatory
def test_camera_not_found(config): conf = config.copy() simulator = hardware.get_all_names(without=['camera']) with pytest.raises(error.PanError): Observatory(simulator=simulator, config=conf, ignore_local_config=True)
def test_bad_camera(config): conf = config.copy() simulator = hardware.get_all_names(without=['camera']) with pytest.raises(error.PanError): Observatory(simulator=simulator, config=conf, auto_detect=True, ignore_local_config=True)
def test_bad_scheduler_fields_file(config): conf = config.copy() simulator = ['all'] conf['scheduler']['fields_file'] = 'foobar' with pytest.raises(error.NotFound): Observatory(simulator=simulator, config=conf, ignore_local_config=True)
def test_bad_site(simulator, config): conf = config.copy() conf['location'] = {} with pytest.raises(error.PanError): Observatory(simulator=simulator, config=conf, ignore_local_config=True)
def test_error_exit(config): with pytest.raises(SystemExit): Observatory(ignore_local_config=True, simulator=['none'])
def observatory(config, simulator): """Return a valid Observatory instance with a specific config.""" obs = Observatory(config=config, simulator=simulator, ignore_local_config=True) return obs
def test_camera_not_found(config): conf = config.copy() simulator = ['weather', 'mount', 'night'] with pytest.raises(error.PanError): Observatory(simulator=simulator, config=conf, ignore_local_config=True)
def observatory(config): observatory = Observatory(config=config, simulator=['all'], ignore_local_config=True) return observatory