Add ability to generate multiple test dirs so that different input mixes can be tested. (#5310)

This commit is contained in:
Scott McKay 2020-09-29 12:55:15 +10:00 committed by GitHub
parent eae2473dc1
commit 1ff3b2d5b8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -82,10 +82,18 @@ def create_test_dir(model_path, root_path, test_name,
model_path = os.path.abspath(model_path)
root_path = os.path.abspath(root_path)
test_dir = os.path.join(root_path, test_name)
test_data_dir = os.path.join(test_dir, "test_data_set_0")
if not os.path.exists(test_dir):
os.makedirs(test_dir)
if not os.path.exists(test_dir) or not os.path.exists(test_data_dir):
os.makedirs(test_data_dir)
# add to existing test data sets if present
test_num = 0
while True:
test_data_dir = os.path.join(test_dir, "test_data_set_" + str(test_num))
if not os.path.exists(test_data_dir):
os.mkdir(test_data_dir)
break
test_num += 1
model_filename = os.path.split(model_path)[-1]
test_model_filename = os.path.join(test_dir, model_filename)