Open artgoldberg opened 4 years ago
This test code can be reused
def test_ckpt_dir_processing_2(self):
# checkpoints_dir exists, and is empty
root_dir = self.args['results_dir']
self.simulation.process_and_validate_args(self.args)
# process_and_validate_args creates 1 timestamped sub-dir
self.assertEqual(len(os.listdir(root_dir)), 1)
def test_ckpt_dir_processing_4(self):
# timestamped sub-directory of checkpoints-dir already exists
root_dir = self.args['results_dir']
self.simulation.process_and_validate_args(self.args)
# given the chance, albeit small, that the second has advanced and
# a different timestamped sub-directory is made, try repeatedly to create the error
# the for loop takes about 0.01 sec
raised = False
for i in range(10):
self.args['results_dir'] = root_dir
try:
self.simulation.process_and_validate_args(self.args)
except:
raised = True
self.assertTrue(raised)
Finish writing
simulation.run_batch()
. Can reuse this code to make subdirs for results.