Skip to content

Commit 35a4cec

Browse files
Merge pull request #137 from ibachar-es/fix-infinite-recursion-on-windows
Fix infinite recursion on Windows
2 parents dc6d2e6 + 8153122 commit 35a4cec

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

decouple.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ def _find_file(self, path):
219219

220220
# search the parent
221221
parent = os.path.dirname(path)
222-
if parent and parent != os.path.abspath(os.sep):
222+
if parent and os.path.normcase(parent) != os.path.normcase(os.path.abspath(os.sep)):
223223
return self._find_file(parent)
224224

225225
# reached root without finding any files.

tests/test_autoconfig.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,3 +97,13 @@ def test_autoconfig_env_default_encoding():
9797
assert config.encoding == DEFAULT_ENCODING
9898
assert 'ENV' == config('KEY', default='ENV')
9999
mopen.assert_called_once_with(filename, encoding=DEFAULT_ENCODING)
100+
101+
102+
def test_autoconfig_no_repository():
103+
path = os.path.join(os.path.dirname(__file__), 'autoconfig', 'ini', 'no_repository')
104+
config = AutoConfig(path)
105+
106+
with pytest.raises(UndefinedValueError):
107+
config('KeyNotInEnvAndNotInRepository')
108+
109+
assert isinstance(config.config.repository, RepositoryEmpty)

0 commit comments

Comments
 (0)