diff --git a/rnsutils/instrument.py b/rnsutils/instrument.py index 0219a12..6ea04eb 100644 --- a/rnsutils/instrument.py +++ b/rnsutils/instrument.py @@ -43,7 +43,7 @@ class RenoiseInstrument(object): else: try: self.load(template_filename) - except FileNotFoundError: + except IOError: self.load(io.BytesIO(pkgutil.get_data('rnsutils', 'data/{}'.format(template_filename)))) self.extract_sample_template() diff --git a/rnsutils/tests/test_parse.py b/rnsutils/tests/test_parse.py index 6e513d2..ac16510 100644 --- a/rnsutils/tests/test_parse.py +++ b/rnsutils/tests/test_parse.py @@ -1,6 +1,13 @@ +import unittest + from rnsutils.instrument import RenoiseInstrument -def test_open_template(): - # creates an empty instrument, which trigger template loading - RenoiseInstrument() +class TestParse(unittest.TestCase): + def test_open_template(self): + # creates an empty instrument, which trigger template loading + RenoiseInstrument() + + def test_missing_template(self): + with self.assertRaises(Exception): + RenoiseInstrument(template_filename='I dont exist.xnri')