def test_multiple_threads(self): sim = Simulation(5, testing=True) sim.start() sim.join() # 10 days for each iteration, so 50 reports total self.assertEqual(DailyControls.objects.count(), 50)
def test_multiple_threads(self): sim = Simulation(5) sim.start() sim.join() # 4 days for each iteration, so 20 reports total self.assertEqual(DailyReport.objects.count(), 20)
def test_map_zip_no_output(self): settings = OutputSettings.objects.first() settings.save_map_output = False settings.save() close_old_connections() file_name = os.path.join(self.scenario_directory, 'Roundtrip_test Map Output.zip') folder_name = os.path.join(self.scenario_directory, 'Map') sim = Simulation(1, testing=True) sim.start() sim.join() self.assertFalse(os.access(file_name, os.F_OK))
def test_map_zip_with_output(self): settings = OutputSettings.objects.first() settings.save_daily_unit_states = True settings.save_map_output = True settings.save() close_old_connections() file_name = os.path.join(self.scenario_directory, 'Roundtrip_test Map Output.zip') folder_name = os.path.join(self.scenario_directory, 'Map') sim = Simulation(1, testing=True) sim.start() sim.join() self.assertTrue(os.access(file_name, os.F_OK)) with zipfile.ZipFile(file_name, 'r') as zf: self.assertListEqual(zf.namelist(), os.listdir(folder_name))
def test_supplemental_output_created(self): """ Ensures that prepare_supplemental_output_directory is being called, and that the directory created is being passed to adsm properly """ settings = OutputSettings.objects.first() settings.save_daily_unit_states = True settings.save() close_old_connections() output_file = os.path.join(self.scenario_directory, 'states_1.csv') sim = Simulation(1, testing=True) sim.start() sim.join() self.assertTrue(os.access(output_file, os.F_OK))
def test_single_thread(self): sim = Simulation(1, testing=True) sim.start() sim.join() self.assertEqual(DailyControls.objects.count(), 10)
def test_single_thread(self): sim = Simulation(1) sim.start() sim.join() self.assertEqual(DailyReport.objects.count(), 4)