17 lines
558 B
Python
17 lines
558 B
Python
from configparser import ConfigParser
|
|
from pathlib import Path
|
|
|
|
|
|
def load_source_settings():
|
|
"""Load settings.conf from a checkout or a nested package build tree."""
|
|
for parent in Path(__file__).resolve().parents:
|
|
settings_path = parent / "config/settings/settings.conf"
|
|
if settings_path.is_file():
|
|
config = ConfigParser(interpolation=None)
|
|
config.read(settings_path)
|
|
return config
|
|
|
|
raise FileNotFoundError(
|
|
"Could not find config/settings/settings.conf above the test directory"
|
|
)
|