@@ -96,7 +96,7 @@ def test_unrecognised_item_code_is_recorded(seed):
9696    assert  cons ._not_recognised_item_codes   # Some item_codes recorded as not recognised. 
9797
9898    # Check warning is issued at end of simulation 
99-     with  pytest .warns (None ) as  recorded_warnings :
99+     with  pytest .warns (UserWarning ) as  recorded_warnings :
100100        cons .on_simulation_end ()
101101
102102    assert  any_warnings_about_item_code (recorded_warnings )
@@ -479,35 +479,34 @@ def test_check_format_of_consumables_file():
479479
480480
481481@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 ):
483483    """Check that every item_code that is declared can be requested from a person at every district and facility_level. 
484484    """ 
485485
486486    sim  =  get_sim_with_dummy_module_registered (run = True )
487487    hs  =  sim .modules ['HealthSystem' ]
488488    item_codes  =  hs .consumables .item_codes 
489489
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 )
494493
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 )
505504
506-          sim .modules ['HealthSystem' ].on_simulation_end ()
505+     sim .modules ['HealthSystem' ].on_simulation_end ()
507506
508507    # Check that no warnings raised or item_codes recorded as being not recogised. 
509508    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 )
511510
512511
513512def  test_get_item_code_from_item_name ():
0 commit comments