summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lps_gen.py8
-rw-r--r--tests/test_lps_gen.py3
2 files changed, 10 insertions, 1 deletions
diff --git a/lps_gen.py b/lps_gen.py
index 13bf7a3..49bc477 100644
--- a/lps_gen.py
+++ b/lps_gen.py
@@ -99,7 +99,13 @@ def template_read(name):
p = 'lpschedule_generator'
r = 'data/{}'.format(name)
- return pkgr.resource_string(p, r).decode('utf-8')
+ t = None
+ try:
+ t = pkgr.resource_string(p, r).decode('utf-8')
+ except Exception as e:
+ print(e, file=sys.stderr)
+
+ return t
class LPiCal(object):
diff --git a/tests/test_lps_gen.py b/tests/test_lps_gen.py
index 26c6132..c4ff1dd 100644
--- a/tests/test_lps_gen.py
+++ b/tests/test_lps_gen.py
@@ -113,6 +113,9 @@ class TestTemplates(object):
assert type(t) is str
assert len(t) > 0
+ t = template_read('nonexistent.jinja2')
+ assert t is None
+
class TestLPiCal(object):
"""