diff options
author | Rob Dennis <rdennis@gmail.com> | 2014-08-25 20:57:05 -0400 |
---|---|---|
committer | Rob Dennis <rdennis@gmail.com> | 2014-08-25 20:57:05 -0400 |
commit | e184b1c89da95fd65cef8d77bcdd3f6b5d340b3e (patch) | |
tree | 5eff335d88ed93e246bbadbebead06b37d26d111 | |
parent | 1b53c8144ecd914a2c33cc02b95650cbb3f45db8 (diff) | |
parent | 2956f7548169820c5439abd0c503274a09a65870 (diff) | |
download | configobj-git-e184b1c89da95fd65cef8d77bcdd3f6b5d340b3e.tar.gz |
Merge pull request #67 from untitaker/no_parent
Fix unhelpful error message when nesting invalid.
-rw-r--r-- | configobj.py | 1 | ||||
-rw-r--r-- | tests/test_validate_errors.py | 9 |
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) |