Skip to content

Commit 175363c

Browse files
committed
Test trying to load missing config.ini file.
Noticed this case wasn't covered by tests. Low hanging fruit.
1 parent a2c64fd commit 175363c

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

test/test_config.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,23 @@ def testLoadConfig(self):
420420
self.assertEqual(config[('web','cookie_takes_precedence')], 0)
421421

422422

423+
def testLoadConfigNoConfig(self):
424+
""" run load on a directory missing config.ini """
425+
426+
c = os.path.join(self.dirname, configuration.Config.INI_FILE)
427+
if os.path.exists(c):
428+
os.remove(c)
429+
else:
430+
self.assertFalse("setup failed missing config.ini")
431+
432+
config = configuration.CoreConfig()
433+
434+
with self.assertRaises(configuration.NoConfigError) as cm:
435+
config.load(self.dirname)
436+
437+
print(cm.exception)
438+
self.assertEqual(cm.exception.args[0], self.dirname)
439+
423440
def testInvalidIndexerValue(self):
424441
""" Mistype native indexer. Verify exception is
425442
generated.

0 commit comments

Comments
 (0)