Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix infinite recursion on Windows #137

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion decouple.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ def _find_file(self, path):

# search the parent
parent = os.path.dirname(path)
if parent and parent != os.path.abspath(os.sep):
if parent and os.path.normcase(parent) != os.path.normcase(os.path.abspath(os.sep)):
return self._find_file(parent)

# reached root without finding any files.
Expand Down
10 changes: 10 additions & 0 deletions tests/test_autoconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,13 @@ def test_autoconfig_env_default_encoding():
assert config.encoding == DEFAULT_ENCODING
assert 'ENV' == config('KEY', default='ENV')
mopen.assert_called_once_with(filename, encoding=DEFAULT_ENCODING)


def test_autoconfig_no_repository():
path = os.path.join(os.path.dirname(__file__), 'autoconfig', 'ini', 'no_repository')
config = AutoConfig(path)

with pytest.raises(UndefinedValueError):
config('KeyNotInEnvAndNotInRepository')

assert isinstance(config.config.repository, RepositoryEmpty)