From fd038bde60c202965b79dc7fbad711e0dbb50594 Mon Sep 17 00:00:00 2001 From: Jacob C <44846403+chusloj@users.noreply.github.com> Date: Fri, 26 Feb 2021 17:24:26 -0500 Subject: [PATCH] stop rerun of test if TAXSIM32 files exist --- taxcalc/validation/taxsim32/README.md | 3 +++ taxcalc/validation/taxsim32/tests_32.py | 13 ++++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/taxcalc/validation/taxsim32/README.md b/taxcalc/validation/taxsim32/README.md index 0fcb5e42c..11af5234d 100644 --- a/taxcalc/validation/taxsim32/README.md +++ b/taxcalc/validation/taxsim32/README.md @@ -43,6 +43,9 @@ the document that generates data for input into TAXSIM-32, see the TAXSIM-32 web Instructions ------------------ 1. Navigate to `taxcalc/validation/taxsim32` and run the Python script `tests_32.py`. +2. If you would like to generate new input files and and get new files from TAXSIM-32, +just delete all of the `.in.out-taxsim` files. On Mac/Linux, this can be done with +`rm -f *.in.out-taxsim`. Troubleshooting diff --git a/taxcalc/validation/taxsim32/tests_32.py b/taxcalc/validation/taxsim32/tests_32.py index 830ce401d..cb4d568d8 100644 --- a/taxcalc/validation/taxsim32/tests_32.py +++ b/taxcalc/validation/taxsim32/tests_32.py @@ -1,14 +1,21 @@ import os +import glob import input_setup import main_comparison +CUR_PATH = os.path.abspath(os.path.dirname(__file__)) + # setup input files -input_setup.main() +if not glob.glob(os.path.join(CUR_PATH, '*in.out-taxsim')): + input_setup.main() # run taxcalc/taxsim comparison for assump_set in ('a', 'b', 'c'): for year in (18, 19): main_comparison.main(assump_set, year) -# clean up auxillary files -os.system('rm -f *.in* *.out*') \ No newline at end of file +# clean up all files except those retrieved from TAXSIM32 +for file in CUR_PATH: + for file in glob.glob('*.out*') and glob.glob('*.in*'): + if not file.endswith('taxsim'): + os.remove(file) \ No newline at end of file