diff --git a/Code/Mantid/Framework/MDAlgorithms/test/CreateMDWorkspaceTest.h b/Code/Mantid/Framework/MDAlgorithms/test/CreateMDWorkspaceTest.h index 4ebce40c48eb..8ae827db3a08 100644 --- a/Code/Mantid/Framework/MDAlgorithms/test/CreateMDWorkspaceTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/CreateMDWorkspaceTest.h @@ -79,10 +79,6 @@ class CreateMDWorkspaceTest : public CxxTest::TestSuite void do_test_exec(std::string Filename, bool lean, int MinRecursionDepth=0, int expectedNumMDBoxes=216) { - if (Filename != "") - { - if (Poco::File(Filename).exists()) Poco::File(Filename).remove(); - } std::string wsName = "CreateMDWorkspaceTest_out"; @@ -102,6 +98,11 @@ class CreateMDWorkspaceTest : public CxxTest::TestSuite alg.setPropertyValue("Filename", Filename); alg.setPropertyValue("Memory", "1"); + std::string fullName = alg.getPropertyValue("Filename"); + if (fullName!="") + if(Poco::File(fullName).exists()) Poco::File(fullName).remove(); + + TS_ASSERT_THROWS_NOTHING( alg.execute(); ); TS_ASSERT( alg.isExecuted() ); diff --git a/Code/Mantid/Framework/MDAlgorithms/test/LoadMDTest.h b/Code/Mantid/Framework/MDAlgorithms/test/LoadMDTest.h index d4a0f6814823..18e2a3579434 100644 --- a/Code/Mantid/Framework/MDAlgorithms/test/LoadMDTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/LoadMDTest.h @@ -199,7 +199,7 @@ class LoadMDTest : public CxxTest::TestSuite TS_ASSERT_THROWS_NOTHING( saver.setProperty("InputWorkspace", "LoadMDTest_ws" ) ); TS_ASSERT_THROWS_NOTHING( saver.setPropertyValue("Filename", "LoadMDTest" + Strings::toString(nd) + ".nxs") ); - // Retrieve the full path; delete any pre-existing file + // Retrieve the full path; delete any pre-existing file std::string filename = saver.getPropertyValue("Filename"); if (Poco::File(filename).exists()) Poco::File(filename).remove(); diff --git a/Code/Mantid/Framework/MDAlgorithms/test/MergeMDFilesTest.h b/Code/Mantid/Framework/MDAlgorithms/test/MergeMDFilesTest.h index a2af8083141f..565cc845f4cc 100644 --- a/Code/Mantid/Framework/MDAlgorithms/test/MergeMDFilesTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/MergeMDFilesTest.h @@ -69,6 +69,13 @@ class MergeMDFilesTest : public CxxTest::TestSuite TS_ASSERT_THROWS_NOTHING( alg.setProperty("Filenames", filenames) ); TS_ASSERT_THROWS_NOTHING( alg.setPropertyValue("OutputFilename", OutputFilename) ); TS_ASSERT_THROWS_NOTHING( alg.setPropertyValue("OutputWorkspace", outWSName) ); + + // clean up possible rubbish from previous runs + std::string fullName = alg.getPropertyValue("OutputFilename"); + if (fullName!="") + if(Poco::File(fullName).exists()) Poco::File(fullName).remove(); + + TS_ASSERT_THROWS_NOTHING( alg.execute(); ); TS_ASSERT( alg.isExecuted() ); diff --git a/Code/Mantid/Framework/MDAlgorithms/test/SaveMDTest.h b/Code/Mantid/Framework/MDAlgorithms/test/SaveMDTest.h index 40d9b13a1acf..234a14f76fcd 100644 --- a/Code/Mantid/Framework/MDAlgorithms/test/SaveMDTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/SaveMDTest.h @@ -69,7 +69,7 @@ class SaveMDTest : public CxxTest::TestSuite void do_test_exec(size_t numPerBox, std::string filename, bool MakeFileBacked = false, bool UpdateFileBackEnd = false) { - if (Poco::File(filename).exists()) Poco::File(filename).remove(); + // Make a 1D MDEventWorkspace MDEventWorkspace1Lean::sptr ws = MDEventsTestHelper::makeMDEW<1>(10, 0.0, 10.0, numPerBox); // Make sure it is split @@ -92,6 +92,12 @@ class SaveMDTest : public CxxTest::TestSuite TS_ASSERT_THROWS_NOTHING( alg.setPropertyValue("InputWorkspace", "SaveMDTest_ws") ); TS_ASSERT_THROWS_NOTHING( alg.setPropertyValue("Filename", filename) ); TS_ASSERT_THROWS_NOTHING( alg.setProperty("MakeFileBacked", MakeFileBacked) ); + + // clean up possible rubbish from the previous runs + std::string fullName = alg.getPropertyValue("Filename"); + if (fullName!="") + if(Poco::File(fullName).exists()) Poco::File(fullName).remove(); + alg.execute(); TS_ASSERT( alg.isExecuted() ); diff --git a/Code/Mantid/Framework/MDAlgorithms/test/SliceMDTest.h b/Code/Mantid/Framework/MDAlgorithms/test/SliceMDTest.h index a72a0c8137d5..ea0042ab46a2 100644 --- a/Code/Mantid/Framework/MDAlgorithms/test/SliceMDTest.h +++ b/Code/Mantid/Framework/MDAlgorithms/test/SliceMDTest.h @@ -130,10 +130,7 @@ class SliceMDTest : public CxxTest::TestSuite bool willFail = false, std::string OutputFilename = "") { - if (OutputFilename != "") - { - if (Poco::File(OutputFilename).exists()) Poco::File(OutputFilename).remove(); - } + SliceMD alg; TS_ASSERT_THROWS_NOTHING( alg.initialize() ) @@ -150,6 +147,10 @@ class SliceMDTest : public CxxTest::TestSuite TS_ASSERT_THROWS_NOTHING(alg.setPropertyValue("OutputWorkspace", "SliceMDTest_outWS")); TS_ASSERT_THROWS_NOTHING(alg.setPropertyValue("OutputFilename", OutputFilename)); + std::string fullName = alg.getPropertyValue("OutputFilename"); + if (fullName!="") + if(Poco::File(fullName).exists()) Poco::File(fullName).remove(); + TS_ASSERT_THROWS_NOTHING( alg.execute(); ) if (willFail) @@ -178,10 +179,7 @@ class SliceMDTest : public CxxTest::TestSuite // Clean up file out->getBoxController()->closeFile(true); - if (OutputFilename != "") - { - if (Poco::File(OutputFilename).exists()) Poco::File(OutputFilename).remove(); - } + }