Skip to content

Commit

Permalink
Merge pull request #3530 from lonvia/clean-use-of-os-environ
Browse files Browse the repository at this point in the history
Don't use OS environment variables when an explicit environment was set
  • Loading branch information
lonvia authored Sep 2, 2024
2 parents 72be143 + 882fb16 commit 3e6be0b
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/nominatim_db/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class Configuration:

def __init__(self, project_dir: Optional[Union[Path, str]],
environ: Optional[Mapping[str, str]] = None) -> None:
self.environ = environ or os.environ
self.environ = os.environ if environ is None else environ
self.config_dir = paths.CONFIG_DIR
self._config = dotenv_values(str(self.config_dir / 'env.defaults'))
if project_dir is not None:
Expand Down
2 changes: 1 addition & 1 deletion test/python/api/search/test_icu_query_analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ async def conn(table_factory):
table_factory('word',
definition='word_id INT, word_token TEXT, type TEXT, word TEXT, info JSONB')

async with NominatimAPIAsync(environ={}) as api:
async with NominatimAPIAsync() as api:
async with api.begin() as conn:
yield conn

Expand Down
2 changes: 1 addition & 1 deletion test/python/api/search/test_legacy_query_analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class TEXT, type TEXT, country_code TEXT,
temp_db_cursor.execute("""CREATE OR REPLACE FUNCTION make_standard_name(name TEXT)
RETURNS TEXT AS $$ SELECT lower(name); $$ LANGUAGE SQL;""")

async with NominatimAPIAsync(environ={}) as api:
async with NominatimAPIAsync() as api:
async with api.begin() as conn:
yield conn

Expand Down
2 changes: 1 addition & 1 deletion test/python/api/test_api_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def test_status_full(apiobj, frontend):
def test_status_database_not_found(monkeypatch):
monkeypatch.setenv('NOMINATIM_DATABASE_DSN', 'dbname=rgjdfkgjedkrgdfkngdfkg')

api = napi.NominatimAPI(environ={})
api = napi.NominatimAPI()

result = api.status()

Expand Down

0 comments on commit 3e6be0b

Please sign in to comment.