From: Eric Wong Date: Thu, 28 Oct 2021 19:16:50 +0000 (+0000) Subject: test_common: clear XDG_CACHE_HOME before lei tests X-Git-Tag: v1.7.0~30 X-Git-Url: http://www.git.stargrave.org/?p=public-inbox.git;a=commitdiff_plain;h=0bb44530cbc51488240df5027f9f00808dcc13ce test_common: clear XDG_CACHE_HOME before lei tests We don't want to read a users' $XDG_CACHE_HOME/lei/all_locals_ever.git during tests. Reported-by: Thomas Weißschuh Tested-by: Thomas Weißschuh Link: https://public-inbox.org/meta/f239abac-4aee-4573-a0d6-e533c7a32662@t-8ch.de/ --- diff --git a/lib/PublicInbox/TestCommon.pm b/lib/PublicInbox/TestCommon.pm index c3820d3a..052d6e45 100644 --- a/lib/PublicInbox/TestCommon.pm +++ b/lib/PublicInbox/TestCommon.pm @@ -556,16 +556,20 @@ SKIP: { require_git(2.6, 1) or skip('git 2.6+ required for lei test', 2); my $mods = $test_opt->{mods} // [ 'lei' ]; require_mods(@$mods, 2); + + # set PERL_INLINE_DIRECTORY before clobbering XDG_CACHE_HOME + require PublicInbox::Spawn; require PublicInbox::Config; require File::Path; + local %ENV = %ENV; delete $ENV{XDG_DATA_HOME}; delete $ENV{XDG_CONFIG_HOME}; + delete $ENV{XDG_CACHE_HOME}; $ENV{GIT_COMMITTER_EMAIL} = 'lei@example.com'; $ENV{GIT_COMMITTER_NAME} = 'lei user'; my (undef, $fn, $lineno) = caller(0); my $t = "$fn:$lineno"; - require PublicInbox::Spawn; state $lei_daemon = PublicInbox::Spawn->can('send_cmd4') || eval { require Socket::MsgHdr; 1 }; unless ($lei_daemon) {