File tree Expand file tree Collapse file tree 2 files changed +30
-3
lines changed
Expand file tree Collapse file tree 2 files changed +30
-3
lines changed Original file line number Diff line number Diff line change @@ -66,11 +66,18 @@ if __name__ == '__main__':
6666 )
6767
6868 parser .add_argument (
69- '-o' , '- -overwrite' ,
70- type = bool , default = True ,
71- help = 'Should exiting files be overwritten'
69+ '--overwrite' ,
70+ action = 'store_true' ,
71+ help = 'Exiting files will be overwritten'
7272 )
7373
74+ parser .add_argument (
75+ '--no-overwrite' ,
76+ action = 'store_false' ,
77+ help = 'Exiting files will not be overwritten'
78+ )
79+
80+ parser .set_defaults (overwrite = False )
7481 args = parser .parse_args ()
7582
7683 just_in_time_library_generator (
Original file line number Diff line number Diff line change 44
55
66import os
7+ import time
78import unittest
89from pathlib import Path
910
@@ -146,3 +147,22 @@ def test_sab_download_with_endf(self):
146147 assert Path ("ENDFB-7.1-NNDC_c_Be_in_BeO.h5" ).is_file ()
147148 assert Path ("materials.xml" ).is_file ()
148149 assert len (list (Path ("." ).glob ("*.h5" ))) == 5
150+
151+ def test_download_single_file_with_overwrite_speed_up (self ):
152+ """Checks that downloading with overwrite to False is quicker"""
153+
154+ current_time = time .time ()
155+ os .system (
156+ "openmc_data_downloader -l ENDFB-7.1-NNDC TENDL-2019 -e Be --overwrite"
157+ )
158+ time_after_download = time .time ()
159+ time_to_download = time_after_download - current_time
160+
161+ current_time = time .time ()
162+ os .system (
163+ "openmc_data_downloader -l ENDFB-7.1-NNDC TENDL-2019 -e Be --no-overwrite" ,
164+ )
165+ time_after_download = time .time ()
166+ time_to_not_download = time_after_download - current_time
167+
168+ assert time_to_not_download < time_to_download
You can’t perform that action at this time.
0 commit comments