Skip to content

Commit

Permalink
refs #6362 Now it will hopefully delete loose files from previous runs
Browse files Browse the repository at this point in the history
(to address test failing after forces stop)
  • Loading branch information
abuts committed Jan 22, 2013
1 parent 7fb89e8 commit f2595c3
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 14 deletions.
Expand Up @@ -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";
Expand All @@ -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() );

Expand Down
2 changes: 1 addition & 1 deletion Code/Mantid/Framework/MDAlgorithms/test/LoadMDTest.h
Expand Up @@ -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();

Expand Down
7 changes: 7 additions & 0 deletions Code/Mantid/Framework/MDAlgorithms/test/MergeMDFilesTest.h
Expand Up @@ -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() );

Expand Down
8 changes: 7 additions & 1 deletion Code/Mantid/Framework/MDAlgorithms/test/SaveMDTest.h
Expand Up @@ -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
Expand All @@ -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() );

Expand Down
14 changes: 6 additions & 8 deletions Code/Mantid/Framework/MDAlgorithms/test/SliceMDTest.h
Expand Up @@ -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() )
Expand All @@ -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)
Expand Down Expand Up @@ -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();
}


}

Expand Down

0 comments on commit f2595c3

Please sign in to comment.