From 5c6db63aa73fa4d22cdc06cc856800e64a3b82b9 Mon Sep 17 00:00:00 2001 From: deadc0de6 Date: Sat, 15 Jun 2019 21:10:33 +0200 Subject: [PATCH] fix bug #160 --- dotdrop/templategen.py | 3 ++- tests/test_compare.py | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/dotdrop/templategen.py b/dotdrop/templategen.py index e532a5f..d1db7db 100644 --- a/dotdrop/templategen.py +++ b/dotdrop/templategen.py @@ -44,7 +44,8 @@ class Templategen: comment_end_string=COMMENT_END) # adding variables self.env.globals['env'] = os.environ - self.env.globals.update(variables) + if variables: + self.env.globals.update(variables) # adding header method self.env.globals['header'] = self._header # adding helper methods diff --git a/tests/test_compare.py b/tests/test_compare.py index 7bb10be..6c24db4 100644 --- a/tests/test_compare.py +++ b/tests/test_compare.py @@ -46,6 +46,11 @@ class TestCompare(unittest.TestCase): results[path] = diff == '' return results + def test_none(self): + t = Templategen(base=self.CONFIG_DOTPATH, + debug=True, variables=None) + self.assertTrue(t is not None) + def test_compare(self): """Test the compare function""" # setup some directories