-
Notifications
You must be signed in to change notification settings - Fork 0
/
update_valid_files.py
25 lines (22 loc) · 1.04 KB
/
update_valid_files.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import os
import shutil
import sys
import run_bkmkr_tests as runtests
if __name__ == '__main__':
# # \/ Can set up to update valid files for a single testfile only too
# if len(sys.argv) == 2:
# vfile = sys.argv[1]
# else:
# vfile = None
for filename in os.listdir(runtests.test_manuscript_dir):
if os.path.splitext(filename)[1] == '.docx':
no_ext_fname = os.path.splitext(filename)[0]
new_validfiles_dir = os.path.join(runtests.tests_tmp_dir, 'verified_files', no_ext_fname)
if os.path.isdir(new_validfiles_dir):
# rm and recreate vfiledir in repo
current_vfile_dir = os.path.join(runtests.current_validfiles_dir, no_ext_fname)
runtests.rmExistingFSObject(current_vfile_dir)
runtests.mkdir_p(current_vfile_dir)
# copy files
for vfile in os.listdir(new_validfiles_dir):
shutil.copyfile(os.path.join(new_validfiles_dir, vfile), os.path.join(current_vfile_dir, vfile))