Skip to content

Commit

Permalink
Update activefires_pp/tests/test_spatiotemporal_alarm_filtering.py
Browse files Browse the repository at this point in the history
Use monkeypatch to mock environment instead of patching os.environ

Co-authored-by: Martin Raspaud <martin.raspaud@smhi.se>
  • Loading branch information
adybbroe and mraspaud committed Sep 1, 2022
1 parent 2112414 commit ebc32e2
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions activefires_pp/tests/test_spatiotemporal_alarm_filtering.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,10 +453,9 @@ def test_create_alarms_from_fire_detections(fake_past_detections_dir):
assert alarms[0]['features']['properties']['observation_time'] == '2021-06-19T02:58:45.700000+02:00'


@patch('activefires_pp.spatiotemporal_alarm_filtering.os.environ.get')
def test_alarm_filter_runner_init_no_env(os_environ_get):
def test_alarm_filter_runner_init_no_env(monkeypatch):
"""Test initialize the AlarmFilterRunner class."""
os_environ_get.return_value = None
monkeypatch.delenv("FIREALARMS_XAUTH_FILEPATH", raising=False)

with pytest.raises(OSError) as exec_info:
_ = get_xauthentication_filepath_from_environment()
Expand Down

0 comments on commit ebc32e2

Please sign in to comment.