Skip to content

Commit

Permalink
Merge pull request #137 from ibachar-es/fix-infinite-recursion-on-win…
Browse files Browse the repository at this point in the history
…dows

Fix infinite recursion on Windows
  • Loading branch information
henriquebastos authored Mar 1, 2023
2 parents dc6d2e6 + 8153122 commit 35a4cec
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion decouple.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,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)

0 comments on commit 35a4cec

Please sign in to comment.