From 411e4d0c2458ec5319b8ea88129dff807793f7d7 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Fri, 8 Dec 2023 11:30:31 -0500 Subject: [PATCH] Let tests themselves intentionally leak temp dir (#1320) * Let tests themselves intentionally leak temp dir By default Yath will clean up temporary files, so the result is the same. But `--keep-dirs` can be passed to `yath test` telling Yath to *not* clean them up instead. This is very useful for debugging. * Update t/lib/HydraTestContext.pm Co-authored-by: Cole Helbling --- t/lib/HydraTestContext.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/t/lib/HydraTestContext.pm b/t/lib/HydraTestContext.pm index 53eaa0f7..a22c3df1 100644 --- a/t/lib/HydraTestContext.pm +++ b/t/lib/HydraTestContext.pm @@ -39,7 +39,9 @@ use Hydra::Helper::Exec; sub new { my ($class, %opts) = @_; - my $dir = File::Temp->newdir(); + # Cleanup will be managed by yath. By the default it will be cleaned + # up, but can be kept to aid in debugging test failures. + my $dir = File::Temp->newdir(CLEANUP => 0); $ENV{'HYDRA_DATA'} = "$dir/hydra-data"; mkdir $ENV{'HYDRA_DATA'};