Use hash to clean the test dirs (#6475)

* Use hash to clean the test dirs

* Use hash to clean the test dirs

* Use hash to clean the test dirs

* fix
This commit is contained in:
Kevin Canwen Xu
2020-08-14 15:34:39 +08:00
committed by GitHub
parent 680f1337c3
commit eb613b566a
2 changed files with 27 additions and 17 deletions

View File

@@ -20,7 +20,7 @@ def get_setup_file():
return args.f
def clean_test_dir(path="./tests/fixtures/tests_samples/temp_dir"):
def clean_test_dir(path):
shutil.rmtree(path, ignore_errors=True)
@@ -37,7 +37,6 @@ class PabeeTests(unittest.TestCase):
--task_name mrpc
--do_train
--do_eval
--output_dir ./tests/fixtures/tests_samples/temp_dir
--per_gpu_train_batch_size=2
--per_gpu_eval_batch_size=1
--learning_rate=2e-5
@@ -46,10 +45,13 @@ class PabeeTests(unittest.TestCase):
--overwrite_output_dir
--seed=42
--max_seq_length=128
""".split()
"""
output_dir = "./tests/fixtures/tests_samples/temp_dir_{}".format(hash(testargs))
testargs += "--output_dir " + output_dir
testargs = testargs.split()
with patch.object(sys, "argv", testargs):
result = run_glue_with_pabee.main()
for value in result.values():
self.assertGreaterEqual(value, 0.75)
clean_test_dir()
clean_test_dir(output_dir)