diff --git a/bifacial_radiance/module.py b/bifacial_radiance/module.py index 18549a64..cbf7757a 100644 --- a/bifacial_radiance/module.py +++ b/bifacial_radiance/module.py @@ -272,7 +272,7 @@ def readModule(self, name=None): return moduleDict else: - print('Error: module name {} doesnt exist'.format(name)) + raise Exception('Error: module name "{}" doesnt exist'.format(name)) return {} diff --git a/tests/test_bifacial_radiance.py b/tests/test_bifacial_radiance.py index cfa6e60f..99fa585f 100644 --- a/tests/test_bifacial_radiance.py +++ b/tests/test_bifacial_radiance.py @@ -604,5 +604,19 @@ def test_raypath(): assert '.' in re.split(':|;', os.environ['RAYPATH']) os.environ['RAYPATH'] = raypath0 + +def test_GH256_nomodule_error(): + moduletype = 'moduletypeNOTonJason' + startdate= '09_23_08' + enddate = '09_23_08' + demo = bifacial_radiance.RadianceObj('test') + metdata = demo.readWeatherFile(MET_FILENAME, starttime=startdate, endtime=enddate) + demo.setGround() + sceneDict = {'pitch': 7,'hub_height':2, 'nMods':1, 'nRows': 1, 'module_type':moduletype} + trackerdict = demo.set1axis(metdata = metdata, cumulativesky = False) + foodict = demo.gendaylit1axis() + with pytest.raises(Exception): + foodict = demo.makeScene1axis(trackerdict=foodict, module=moduletype, + sceneDict=sceneDict, cumulativesky=False) \ No newline at end of file