-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from erickwilder/skip-invalid-inifiles
Handle MissingSectionHeaderError and ignore them when loading Ini Files
- Loading branch information
Showing
4 changed files
with
43 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# coding: utf-8 | ||
from __future__ import unicode_literals | ||
|
||
from testfixtures import TempDirectory | ||
|
||
from prettyconf.exceptions import InvalidConfigurationFile | ||
|
||
from .base import BaseTestCase | ||
|
||
|
||
class IniFileConfigurationLoaderTestCase(BaseTestCase): | ||
|
||
def setUp(self): | ||
super(IniFileConfigurationLoaderTestCase, self).setUp() | ||
self.tmp_dir = TempDirectory() | ||
|
||
def tearDown(self): | ||
super(IniFileConfigurationLoaderTestCase, self).tearDown() | ||
self.tmp_dir.cleanup_all() | ||
|
||
def test_skip_invalid_ini_file(self): | ||
from prettyconf.loaders import IniFileConfigurationLoader | ||
|
||
test_file = self.tmp_dir.write('some/strange/config.cfg', '*&ˆ%$#$%ˆ&*('.encode('utf8')) | ||
with self.assertRaises(InvalidConfigurationFile): | ||
IniFileConfigurationLoader(test_file) |