Skip to content

Commit 3e6be0b

Browse files
authored
Merge pull request osm-search#3530 from lonvia/clean-use-of-os-environ
Don't use OS environment variables when an explicit environment was set
2 parents 72be143 + 882fb16 commit 3e6be0b

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

src/nominatim_db/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class Configuration:
6161

6262
def __init__(self, project_dir: Optional[Union[Path, str]],
6363
environ: Optional[Mapping[str, str]] = None) -> None:
64-
self.environ = environ or os.environ
64+
self.environ = os.environ if environ is None else environ
6565
self.config_dir = paths.CONFIG_DIR
6666
self._config = dotenv_values(str(self.config_dir / 'env.defaults'))
6767
if project_dir is not None:

test/python/api/search/test_icu_query_analyzer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ async def conn(table_factory):
3838
table_factory('word',
3939
definition='word_id INT, word_token TEXT, type TEXT, word TEXT, info JSONB')
4040

41-
async with NominatimAPIAsync(environ={}) as api:
41+
async with NominatimAPIAsync() as api:
4242
async with api.begin() as conn:
4343
yield conn
4444

test/python/api/search/test_legacy_query_analyzer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class TEXT, type TEXT, country_code TEXT,
7272
temp_db_cursor.execute("""CREATE OR REPLACE FUNCTION make_standard_name(name TEXT)
7373
RETURNS TEXT AS $$ SELECT lower(name); $$ LANGUAGE SQL;""")
7474

75-
async with NominatimAPIAsync(environ={}) as api:
75+
async with NominatimAPIAsync() as api:
7676
async with api.begin() as conn:
7777
yield conn
7878

test/python/api/test_api_status.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def test_status_full(apiobj, frontend):
4545
def test_status_database_not_found(monkeypatch):
4646
monkeypatch.setenv('NOMINATIM_DATABASE_DSN', 'dbname=rgjdfkgjedkrgdfkngdfkg')
4747

48-
api = napi.NominatimAPI(environ={})
48+
api = napi.NominatimAPI()
4949

5050
result = api.status()
5151

0 commit comments

Comments
 (0)