@@ -96,7 +96,7 @@ def test_unrecognised_item_code_is_recorded(seed):
96
96
assert cons ._not_recognised_item_codes # Some item_codes recorded as not recognised.
97
97
98
98
# Check warning is issued at end of simulation
99
- with pytest .warns (None ) as recorded_warnings :
99
+ with pytest .warns (UserWarning ) as recorded_warnings :
100
100
cons .on_simulation_end ()
101
101
102
102
assert any_warnings_about_item_code (recorded_warnings )
@@ -479,35 +479,34 @@ def test_check_format_of_consumables_file():
479
479
480
480
481
481
@pytest .mark .slow
482
- def test_every_declared_consumable_for_every_possible_hsi_using_actual_data ():
482
+ def test_every_declared_consumable_for_every_possible_hsi_using_actual_data (recwarn ):
483
483
"""Check that every item_code that is declared can be requested from a person at every district and facility_level.
484
484
"""
485
485
486
486
sim = get_sim_with_dummy_module_registered (run = True )
487
487
hs = sim .modules ['HealthSystem' ]
488
488
item_codes = hs .consumables .item_codes
489
489
490
- with pytest .warns (None ) as recorded_warnings :
491
- for month in range (1 , 13 ):
492
- sim .date = Date (2010 , month , 1 )
493
- hs .consumables ._refresh_availability_of_consumables (date = sim .date )
490
+ for month in range (1 , 13 ):
491
+ sim .date = Date (2010 , month , 1 )
492
+ hs .consumables ._refresh_availability_of_consumables (date = sim .date )
494
493
495
- for _district in sim .modules ['Demography' ].PROPERTIES ['district_of_residence' ].categories :
496
- # Change the district of person 0 (for whom the HSI is created.)
497
- sim .population .props .at [0 , 'district_of_residence' ] = _district
498
- for _facility_id in fac_ids :
499
- hsi_event = get_dummy_hsi_event_instance (
500
- module = sim .modules ['DummyModule' ],
501
- facility_id = _facility_id
502
- )
503
- for _item_code in item_codes :
504
- hsi_event .get_consumables (item_codes = _item_code )
494
+ for _district in sim .modules ['Demography' ].PROPERTIES ['district_of_residence' ].categories :
495
+ # Change the district of person 0 (for whom the HSI is created.)
496
+ sim .population .props .at [0 , 'district_of_residence' ] = _district
497
+ for _facility_id in fac_ids :
498
+ hsi_event = get_dummy_hsi_event_instance (
499
+ module = sim .modules ['DummyModule' ],
500
+ facility_id = _facility_id
501
+ )
502
+ for _item_code in item_codes :
503
+ hsi_event .get_consumables (item_codes = _item_code )
505
504
506
- sim .modules ['HealthSystem' ].on_simulation_end ()
505
+ sim .modules ['HealthSystem' ].on_simulation_end ()
507
506
508
507
# Check that no warnings raised or item_codes recorded as being not recogised.
509
508
assert not sim .modules ['HealthSystem' ].consumables ._not_recognised_item_codes
510
- assert not any_warnings_about_item_code (recorded_warnings )
509
+ assert not any_warnings_about_item_code (recwarn )
511
510
512
511
513
512
def test_get_item_code_from_item_name ():
0 commit comments