From 56173ab3d4d89212f8e9198a50089cc97333d79b Mon Sep 17 00:00:00 2001 From: GeorgeClark Date: Tue, 13 Jul 2010 03:36:32 +0000 Subject: [PATCH] Item9312: Make test conditional (oops) .. and fix TemplateTests to use a temporary directory instead of cwd. git-svn-id: http://svn.foswiki.org/trunk@8151 0b4bb1d4-4e5a-0410-9cc4-b2b747904278 --- UnitTestContrib/lib/Unit/TestRunner.pm | 2 +- UnitTestContrib/test/unit/TemplatesTests.pm | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/UnitTestContrib/lib/Unit/TestRunner.pm b/UnitTestContrib/lib/Unit/TestRunner.pm index 4f37c5ca42..72d93718db 100644 --- a/UnitTestContrib/lib/Unit/TestRunner.pm +++ b/UnitTestContrib/lib/Unit/TestRunner.pm @@ -130,7 +130,7 @@ sub start { $action = runOne( $tester, $suite, $testToRun ); } - die "CWD changed to " . Cwd->cwd() . " by previous test!! \n" ;#if ( Cwd->cwd() ne $start_cwd) ; + die "CWD changed to " . Cwd->cwd() . " by previous test!! \n" if ( Cwd->cwd() ne $start_cwd) ; # untaint action for the case where the test is run in # another process diff --git a/UnitTestContrib/test/unit/TemplatesTests.pm b/UnitTestContrib/test/unit/TemplatesTests.pm index 4dbd29630e..307fe03000 100644 --- a/UnitTestContrib/test/unit/TemplatesTests.pm +++ b/UnitTestContrib/test/unit/TemplatesTests.pm @@ -28,7 +28,10 @@ sub set_up { my $this = shift; $this->SUPER::set_up(); - my $here = Cwd::cwd(); + $this->{tempdir} = $Foswiki::cfg{TempfileDir} . '/test_TemplateTests'; + mkpath( $this->{tempdir} ); + + my $here = $this->{tempdir}; $here =~ m/^(.*)$/; $test_tmpls = $1 . '/fake_templates'; $test_data = $1 . '/fake_data'; @@ -54,8 +57,7 @@ sub tear_down { my $this = shift; $session->finish(); $this->SUPER::tear_down(); - File::Path::rmtree($test_tmpls); - File::Path::rmtree($test_data); + rmtree( $this->{tempdir} ); # Cleanup any old tests } sub write_template {