diff options
author | Eric Wong <e@80x24.org> | 2021-04-24 09:28:41 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2021-04-24 16:10:00 -0400 |
commit | 81ed86d5f250adcb407b7278eec37c7ce1975e05 (patch) | |
tree | 0b1a595eb097cf98d3c9e4060692a99a0b904e5b | |
parent | 0c4604e2d5220e8ead46fd7a645a91b6db9bf504 (diff) | |
download | public-inbox-81ed86d5f250adcb407b7278eec37c7ce1975e05.tar.gz |
"lei import" behavior will may change w.r.t. keyword handling. Use separate $HOME between different test_lei to ensure isolation between the tests.
-rw-r--r-- | lib/PublicInbox/TestCommon.pm | 2 | ||||
-rw-r--r-- | t/lei_to_mail.t | 8 |
2 files changed, 6 insertions, 4 deletions
diff --git a/lib/PublicInbox/TestCommon.pm b/lib/PublicInbox/TestCommon.pm index b5d0b9f8..49cecacd 100644 --- a/lib/PublicInbox/TestCommon.pm +++ b/lib/PublicInbox/TestCommon.pm @@ -517,6 +517,7 @@ SKIP: { require_git(2.6, 1) or skip('git 2.6+ required for lei test', 2); require_mods(qw(json DBD::SQLite Search::Xapian), 2); require PublicInbox::Config; + require File::Path; local %ENV = %ENV; delete $ENV{XDG_DATA_HOME}; delete $ENV{XDG_CONFIG_HOME}; @@ -534,6 +535,7 @@ EOM $lei_opt = { 1 => \$lei_out, 2 => \$lei_err }; my ($daemon_pid, $for_destroy, $daemon_xrd); my $tmpdir = $test_opt->{tmpdir}; + File::Path::mkpath($tmpdir) if (defined $tmpdir && !-d $tmpdir); ($tmpdir, $for_destroy) = tmpdir unless $tmpdir; state $persist_xrd = $ENV{TEST_LEI_DAEMON_PERSIST_DIR}; SKIP: { diff --git a/t/lei_to_mail.t b/t/lei_to_mail.t index 51357257..32532a98 100644 --- a/t/lei_to_mail.t +++ b/t/lei_to_mail.t @@ -129,9 +129,9 @@ my $orig = do { $raw; }; -test_lei(sub { - ok(lei(qw(import -F), $mbox, $fn), 'imported mbox'); - ok(lei(qw(q s:x)), 'lei q works') or diag $lei_err; +test_lei({tmpdir => "$tmpdir/using -F"}, sub { + lei_ok(qw(import -F), $mbox, $fn, \'imported mbox'); + lei_ok(qw(q s:x), \'lei q works') or diag $lei_err; my $res = json_utf8->decode($lei_out); my $x = $res->[0]; is($x->{'s'}, 'x', 'subject imported') or diag $lei_out; @@ -139,7 +139,7 @@ test_lei(sub { is($res->[1], undef, 'only one result'); }); -test_lei(sub { +test_lei({tmpdir => "$tmpdir/using TYPE: prefix"}, sub { lei_ok('import', "$mbox:$fn", \'imported mbox:/path') or diag $lei_err; lei_ok(qw(q s:x), \'lei q works') or diag $lei_err; my $res = json_utf8->decode($lei_out); |