summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Unterwaditzer <markus@unterwaditzer.net>2014-08-25 23:38:50 +0200
committerMarkus Unterwaditzer <markus@unterwaditzer.net>2014-08-25 23:53:07 +0200
commit2956f7548169820c5439abd0c503274a09a65870 (patch)
tree5eff335d88ed93e246bbadbebead06b37d26d111
parent1b53c8144ecd914a2c33cc02b95650cbb3f45db8 (diff)
downloadconfigobj-git-2956f7548169820c5439abd0c503274a09a65870.tar.gz
Fix unhelpful error message when nesting invalid.
See https://github.com/geier/khal/issues/105
-rw-r--r--configobj.py1
-rw-r--r--tests/test_validate_errors.py9
2 files changed, 9 insertions, 1 deletions
diff --git a/configobj.py b/configobj.py
index 4499e60..ba886e8 100644
--- a/configobj.py
+++ b/configobj.py
@@ -1603,6 +1603,7 @@ class ConfigObj(Section):
else:
self._handle_error("Section too nested",
NestingError, infile, cur_index)
+ continue
sect_name = self._unquote(sect_name)
if sect_name in parent:
diff --git a/tests/test_validate_errors.py b/tests/test_validate_errors.py
index f96b613..644dfb3 100644
--- a/tests/test_validate_errors.py
+++ b/tests/test_validate_errors.py
@@ -2,7 +2,7 @@ import os
import pytest
-from configobj import ConfigObj, get_extra_values, ParseError
+from configobj import ConfigObj, get_extra_values, ParseError, NestingError
from validate import Validator
@pytest.fixture()
@@ -70,3 +70,10 @@ def test_invalid_lines_with_percents(tmpdir, specpath):
ini.write('extra: %H:%M\n')
with pytest.raises(ParseError):
conf = ConfigObj(str(ini), configspec=specpath, file_error=True)
+
+
+def test_no_parent(tmpdir, specpath):
+ ini = tmpdir.join('config.ini')
+ ini.write('[[haha]]')
+ with pytest.raises(NestingError):
+ conf = ConfigObj(str(ini), configspec=specpath, file_error=True)