From 3d794473ee9a65b81dbdc4b10280abb1c74e0254 Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Mon, 12 Aug 2013 14:13:54 -0400 Subject: [PATCH] if passed, test results data file now cleaned up --- tests/test_basic/test_basic.py | 7 +++++-- .../test_confidence_intervals.py | 8 ++++++-- tests/test_density_atombcm/test_density_atombcm.py | 7 +++++-- tests/test_density_atomcm3/test_density_atomcm3.py | 7 +++++-- 4 files changed, 21 insertions(+), 8 deletions(-) diff --git a/tests/test_basic/test_basic.py b/tests/test_basic/test_basic.py index 5c5b236f32..2f43cbd3f6 100644 --- a/tests/test_basic/test_basic.py +++ b/tests/test_basic/test_basic.py @@ -21,10 +21,13 @@ def test_created_statepoint(): def test_results(): os.system('python results.py') - assert filecmp.cmp('results_test.dat', 'results_true.dat') + compare = filecmp.cmp('results_test.dat', 'results_true.dat') + if not compare: + os.system('cp results_test.dat results_error.dat') + assert compare def teardown(): - output = [pwd + '/statepoint.10.binary'] + output = [pwd + '/statepoint.10.binary', pwd + '/results_test.dat'] for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_confidence_intervals/test_confidence_intervals.py b/tests/test_confidence_intervals/test_confidence_intervals.py index 33590e0e28..7ccc665679 100644 --- a/tests/test_confidence_intervals/test_confidence_intervals.py +++ b/tests/test_confidence_intervals/test_confidence_intervals.py @@ -24,10 +24,14 @@ def test_created_output(): def test_results(): os.system('python results.py') - assert filecmp.cmp('results_test.dat', 'results_true.dat') + compare = filecmp.cmp('results_test.dat', 'results_true.dat') + if not compare: + os.system('cp results_test.dat results_error.dat') + assert compare def teardown(): - output = [pwd + '/statepoint.10.binary', pwd + '/tallies.out'] + output = [pwd + '/statepoint.10.binary', pwd + '/tallies.out', + pwd + '/results_test.dat'] for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_density_atombcm/test_density_atombcm.py b/tests/test_density_atombcm/test_density_atombcm.py index 5c5b236f32..2f43cbd3f6 100644 --- a/tests/test_density_atombcm/test_density_atombcm.py +++ b/tests/test_density_atombcm/test_density_atombcm.py @@ -21,10 +21,13 @@ def test_created_statepoint(): def test_results(): os.system('python results.py') - assert filecmp.cmp('results_test.dat', 'results_true.dat') + compare = filecmp.cmp('results_test.dat', 'results_true.dat') + if not compare: + os.system('cp results_test.dat results_error.dat') + assert compare def teardown(): - output = [pwd + '/statepoint.10.binary'] + output = [pwd + '/statepoint.10.binary', pwd + '/results_test.dat'] for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_density_atomcm3/test_density_atomcm3.py b/tests/test_density_atomcm3/test_density_atomcm3.py index 5c5b236f32..2f43cbd3f6 100644 --- a/tests/test_density_atomcm3/test_density_atomcm3.py +++ b/tests/test_density_atomcm3/test_density_atomcm3.py @@ -21,10 +21,13 @@ def test_created_statepoint(): def test_results(): os.system('python results.py') - assert filecmp.cmp('results_test.dat', 'results_true.dat') + compare = filecmp.cmp('results_test.dat', 'results_true.dat') + if not compare: + os.system('cp results_test.dat results_error.dat') + assert compare def teardown(): - output = [pwd + '/statepoint.10.binary'] + output = [pwd + '/statepoint.10.binary', pwd + '/results_test.dat'] for f in output: if os.path.exists(f): os.remove(f)