@@ -29,12 +29,17 @@ class MigrationTests(unittest.TestCase):
2929
3030 @classmethod
3131 def setUpClass (cls ):
32-
32+ cls . output_folder = os . path . join ( manifest . output_folder , "migration" )
3333 cls .user = environ ["USERNAME" ] if system () == "Windows" else environ ["USER" ]
3434 filename = os .path .join (manifest .migration_folder , "Kenya_Regional_Migration_from_Census.bin" )
3535 cls .kenya_regional_migration = from_file (filename )
3636 cls .guinea_pig = Migration ()
3737
38+ @classmethod
39+ def tearDownClass (cls ):
40+ # Class level cleanup after all tests in the class
41+ cls .resource = None # Example cleanup
42+
3843 def test_defaults (self ):
3944 """
4045 Changing the defaults is a breaking change.
@@ -534,7 +539,6 @@ def test_to_csv(self):
534539
535540 def test_examine_file (self ):
536541 filename = os .path .join (manifest .migration_folder , "Seattle_30arcsec_local_migration.bin" )
537- output = os .path .join (manifest .output_folder , "seattle_csv.csv" )
538542
539543 expected_output = ["Author:" , "DatavalueCount:" , "DateCreated:" , "GenderDataType:" , "IdReference:" ,
540544 "InterpolationType:" , "MigrationType:" , "NodeCount:" , "NodeOffsets:" , "Tool:" , "Nodes:" ]
@@ -795,7 +799,7 @@ def verify_distance(migration_rate_list, node_locations):
795799 migration_local = from_demog_and_param_gravity (demographics_file , gravity_params = [1 , 1 , 1 , - 1 ],
796800 id_ref = id_ref , migration_type = Migration .REGIONAL )
797801
798- migration_local_file = Path (os .path .join (manifest .output_folder , 'gravity_distance.bin' ))
802+ migration_local_file = Path (os .path .join (self .output_folder , 'gravity_distance.bin' ))
799803 migration_local .to_file (migration_local_file )
800804
801805 f = io .StringIO ()
@@ -812,7 +816,7 @@ def test_from_demog_and_param_gravity_with_reference(self):
812816 id_ref = 'from_demog_and_param_gravity_test' ,
813817 migration_type = Migration .LOCAL )
814818
815- migration_file = Path (os .path .join (manifest .output_folder , 'test_from_demog_and_param_gravity_with_reference.bin' ))
819+ migration_file = Path (os .path .join (self .output_folder , 'test_from_demog_and_param_gravity_with_reference.bin' ))
816820 migration .to_file (migration_file )
817821
818822 reference_file = Path (os .path .join (manifest .migration_folder , 'migration_gravity_model_reference.bin' ))
@@ -823,11 +827,11 @@ def test_from_csv(self):
823827 'destination' : [2 , 3 , 4 ],
824828 'rate' : [0.1 , 0.2 , 0.3 ]}
825829
826- csv_file = Path (os .path .join (manifest .output_folder , "test_migration.csv" ))
830+ csv_file = Path (os .path .join (self .output_folder , "test_migration.csv" ))
827831 pd .DataFrame .from_dict (temp ).to_csv (csv_file , index = False )
828832 migration = from_csv (csv_file , id_ref = "testing" )
829833
830- migration_file = os .path .join (manifest .output_folder , "test_migration.bin" )
834+ migration_file = os .path .join (self .output_folder , "test_migration.bin" )
831835 migration .to_file (migration_file )
832836 migration_from_bin = from_file (migration_file )
833837
0 commit comments