2
0
Fork 0

Fix bug when default config paths do not exist

when fetching initial path listing, to create config object.  should
only affect situations where default file paths are needed, i.e. when
caller does not specify
This commit is contained in:
Lance Edgar 2024-05-28 22:55:53 -05:00
parent cd79f949d2
commit 6777f02e06
3 changed files with 10 additions and 0 deletions

View file

@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
## Unreleased ## Unreleased
### Changed
- Fix bug when default config paths do not exist.
## [0.1.11] - 2024-04-14 ## [0.1.11] - 2024-04-14
### Changed ### Changed

View file

@ -777,6 +777,8 @@ def get_config_paths(
files = [default_files] files = [default_files]
else: else:
files = list(default_files) files = list(default_files)
files = [path for path in files
if os.path.exists(path)]
else: else:
files = [] files = []

View file

@ -437,6 +437,12 @@ winsvc.RattailFileMonitor = /path/to/other/file
files = conf.get_config_paths(files=[myconf], winsvc='RattailFileMonitor') files = conf.get_config_paths(files=[myconf], winsvc='RattailFileMonitor')
self.assertEqual(files, ['/path/to/other/file']) self.assertEqual(files, ['/path/to/other/file'])
def test_nonexistent_default_files(self):
files = conf.get_config_paths(files=None,
env_files_name='IGNORE_THIS',
default_files=['/this/does/not/exist'])
self.assertEqual(files, [])
class TestMakeConfig(FileConfigTestCase): class TestMakeConfig(FileConfigTestCase):