| 1 |
from configparser import ConfigParser |
| 2 |
from pathlib import Path |
| 3 |
|
| 4 |
|
| 5 |
def load_source_settings(): |
| 6 |
"""Load settings.conf from a checkout or a nested package build tree.""" |
| 7 |
for parent in Path(__file__).resolve().parents: |
| 8 |
settings_path = parent / "config/settings/settings.conf" |
| 9 |
if settings_path.is_file(): |
| 10 |
config = ConfigParser(interpolation=None) |
| 11 |
config.read(settings_path) |
| 12 |
return config |
| 13 |
|
| 14 |
raise FileNotFoundError( |
| 15 |
"Could not find config/settings/settings.conf above the test directory" |
| 16 |
) |