summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2020-02-10 20:53:26 -0700
committerSean Whitton <spwhitton@spwhitton.name>2020-02-10 20:55:23 -0700
commitd5003c566d49b2c43726dc0575dd934476e5f9a4 (patch)
treecc193a6cffd1a7ec469090c82f820e7ed53c6f4b
parent0e8636ba575c0125437d445d56bab18c393fb331 (diff)
downloadp5-Git-Annex-d5003c566d49b2c43726dc0575dd934476e5f9a4.tar.gz
skip most tests when git-annex not available
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
-rwxr-xr-xt/10_init.t14
-rwxr-xr-xt/11_utils.t3
-rwxr-xr-xt/12_unused.t2
-rwxr-xr-xt/13_batchcommand.t3
-rwxr-xr-xt/21_annex-to-annex.t1
-rwxr-xr-xt/22_annex-to-annex-dropunused.t1
-rwxr-xr-xt/23_annex-to-annex-reinject.t2
-rwxr-xr-xt/24_annex-review-unused.t2
-rw-r--r--t/lib/t/Util.pm8
9 files changed, 30 insertions, 6 deletions
diff --git a/t/10_init.t b/t/10_init.t
index 9e50a93..2ed4567 100755
--- a/t/10_init.t
+++ b/t/10_init.t
@@ -10,6 +10,7 @@ use Git::Annex;
use File::chdir;
use File::Temp qw(tempdir);
use t::Setup;
+use t::Util;
use File::Spec::Functions qw(catfile file_name_is_absolute);
{
@@ -45,10 +46,13 @@ use File::Spec::Functions qw(catfile file_name_is_absolute);
# "Git::Repository has correct toplevel";
# };
-with_temp_annexes {
- my $source1_dir = catfile shift, "source1";
- my $annex = Git::Annex->new(catfile $source1_dir, "foo");
- is $annex->toplevel, $source1_dir, "it rises to top of working tree";
-};
+SKIP: {
+ skip "git-annex not available", 1 unless git_annex_available;
+ with_temp_annexes {
+ my $source1_dir = catfile shift, "source1";
+ my $annex = Git::Annex->new(catfile $source1_dir, "foo");
+ is $annex->toplevel, $source1_dir, "it rises to top of working tree";
+ };
+}
done_testing;
diff --git a/t/11_utils.t b/t/11_utils.t
index 3d3cb55..3925e0d 100755
--- a/t/11_utils.t
+++ b/t/11_utils.t
@@ -10,11 +10,14 @@ use Test::More;
use Git::Annex;
use File::Spec::Functions qw(catfile rel2abs);
use t::Setup;
+use t::Util;
use Storable;
use Data::Compare;
use File::chdir;
use File::Basename qw(basename);
+plan skip_all => "git-annex not available" unless git_annex_available;
+
with_temp_annexes {
my $temp = shift;
my $annex = Git::Annex->new("source1");
diff --git a/t/12_unused.t b/t/12_unused.t
index 2a7b9bd..7fda274 100755
--- a/t/12_unused.t
+++ b/t/12_unused.t
@@ -17,6 +17,8 @@ use File::Slurp;
use File::Spec::Functions qw(catfile);
use Scalar::Util qw(looks_like_number);
+plan skip_all => "git-annex not available" unless git_annex_available;
+
with_temp_annexes {
my (undef, $source1) = @_;
$source1->rm("foo/foo2/baz");
diff --git a/t/13_batchcommand.t b/t/13_batchcommand.t
index bb529a4..d1777bf 100755
--- a/t/13_batchcommand.t
+++ b/t/13_batchcommand.t
@@ -9,9 +9,12 @@ use Test::More;
use Git::Annex;
use Git::Annex::BatchCommand;
use t::Setup;
+use t::Util;
use Scalar::Util qw(looks_like_number);
use Try::Tiny;
+plan skip_all => "git-annex not available" unless git_annex_available;
+
with_temp_annexes {
my (undef, $source1) = @_;
diff --git a/t/21_annex-to-annex.t b/t/21_annex-to-annex.t
index 9589b59..0e68d94 100755
--- a/t/21_annex-to-annex.t
+++ b/t/21_annex-to-annex.t
@@ -16,6 +16,7 @@ use File::Spec::Functions qw(catfile rel2abs);
use File::chdir;
plan skip_all => "device ID issues" if device_id_issues;
+plan skip_all => "git-annex not available" unless git_annex_available;
my ($output, $error, $exit, @output);
diff --git a/t/22_annex-to-annex-dropunused.t b/t/22_annex-to-annex-dropunused.t
index 41db816..f1e533a 100755
--- a/t/22_annex-to-annex-dropunused.t
+++ b/t/22_annex-to-annex-dropunused.t
@@ -16,6 +16,7 @@ use File::Basename qw(dirname);
use File::Copy qw(copy);
plan skip_all => "device ID issues" if device_id_issues;
+plan skip_all => "git-annex not available" unless git_annex_available;
with_temp_annexes {
my (undef, undef, $source2) = @_;
diff --git a/t/23_annex-to-annex-reinject.t b/t/23_annex-to-annex-reinject.t
index 5791c81..9e79ce3 100755
--- a/t/23_annex-to-annex-reinject.t
+++ b/t/23_annex-to-annex-reinject.t
@@ -13,6 +13,8 @@ use t::Setup;
use t::Util;
use File::chdir;
+plan skip_all => "git-annex not available" unless git_annex_available;
+
with_temp_annexes {
my (undef, undef, $source2) = @_;
diff --git a/t/24_annex-review-unused.t b/t/24_annex-review-unused.t
index 0e8742c..4947455 100755
--- a/t/24_annex-review-unused.t
+++ b/t/24_annex-review-unused.t
@@ -13,6 +13,8 @@ use File::chdir;
use File::Spec::Functions qw(rel2abs);
use Capture::Tiny qw(capture_stdout);
+plan skip_all => "git-annex not available" unless git_annex_available;
+
with_temp_annexes {
my (undef, $source1) = @_;
my ($output, $exit);
diff --git a/t/lib/t/Util.pm b/t/lib/t/Util.pm
index 350dfeb..dea6a42 100644
--- a/t/lib/t/Util.pm
+++ b/t/lib/t/Util.pm
@@ -12,7 +12,8 @@ use File::Temp qw(tempdir);
use Try::Tiny;
use Capture::Tiny qw(capture);
-our @EXPORT = qw( corrupt_annexed_file device_id_issues run_bin );
+our @EXPORT
+ = qw( corrupt_annexed_file device_id_issues git_annex_available run_bin );
sub corrupt_annexed_file {
my ($git, $file) = @_;
@@ -40,6 +41,11 @@ sub device_id_issues {
return ($foo_id != $bar_id);
}
+sub git_annex_available {
+ `which git-annex`;
+ return !$?;
+}
+
sub run_bin {
(my $bin = "App::" . shift) =~ tr/-/_/;
local @ARGV = @_;