Commits

Marcin Kasperski committed c006acf

Skipping tests if not running under desktop session

  • Participants
  • Parent commits 587d256

Comments (0)

Files changed (10)

 #!perl -T
 
-use Test::More tests => 1;
+use Test::More;
+
+plan tests => 1;
 
 BEGIN {
     use_ok( 'Passwd::Keyring::KDEWallet' ) || print "Bail out!\n";

t/01-set-and-get.t

 
 use strict;
 use warnings;
-use Test::More tests => 8;
+use Test::More;
+
+if($ENV{DESKTOP_SESSION} || $ENV{DBUS_SESSION_BUS_ADDRESS}) {
+    plan tests => 8;
+} else {
+    plan skip_all => "Keyring not available (not running under KDE/Gnome/other desktop session), skipping tests";
+}
+
 
 use Passwd::Keyring::KDEWallet;
 

t/02-is-persistent.t

 
 use strict;
 use warnings;
-use Test::Simple tests => 2;
+use Test::More;
+
+if($ENV{DESKTOP_SESSION} || $ENV{DBUS_SESSION_BUS_ADDRESS}) {
+    plan tests => 2;
+} else {
+    plan skip_all => "Keyring not available (not running under KDE/Gnome/other desktop session), skipping tests";
+}
+
 
 use Passwd::Keyring::KDEWallet;
 

t/03-many-sets-and-gets.t

 
 use strict;
 use warnings;
-use Test::Simple tests => 11;
+use Test::More;
+
+if($ENV{DESKTOP_SESSION} || $ENV{DBUS_SESSION_BUS_ADDRESS}) {
+    plan tests => 11;
+} else {
+    plan skip_all => "Keyring not available (not running under KDE/Gnome/other desktop session), skipping tests";
+}
+
 
 use Passwd::Keyring::KDEWallet;
 

t/04-recovering-in-sep-prog.t

 
 use strict;
 use warnings;
-use Test::Simple tests => 13;
+use Test::More;
+
+if($ENV{DESKTOP_SESSION} || $ENV{DBUS_SESSION_BUS_ADDRESS}) {
+    plan tests => 13;
+} else {
+    plan skip_all => "Keyring not available (not running under KDE/Gnome/other desktop session), skipping tests";
+}
+
 
 use Passwd::Keyring::KDEWallet;
 

t/05-many-sets-and-gets-with-name.t

 
 use strict;
 use warnings;
-use Test::Simple tests => 20;
+use Test::More;
+
+if($ENV{DESKTOP_SESSION} || $ENV{DBUS_SESSION_BUS_ADDRESS}) {
+    plan tests => 20;
+} else {
+    plan skip_all => "Keyring not available (not running under KDE/Gnome/other desktop session), skipping tests";
+}
+
 
 use Passwd::Keyring::KDEWallet;
 

t/06-recovering-with-app-change.t

 
 use strict;
 use warnings;
-use Test::More tests => 16;
+use Test::More;
+
+if($ENV{DESKTOP_SESSION} || $ENV{DBUS_SESSION_BUS_ADDRESS}) {
+    plan tests => 16;
+} else {
+    plan skip_all => "Keyring not available (not running under KDE/Gnome/other desktop session), skipping tests";
+}
+
 
 use Passwd::Keyring::KDEWallet;
 

t/07-ugly-chars.t

 
 use strict;
 use warnings;
-use Test::Simple tests => 4;
+use Test::More;
+
+if($ENV{DESKTOP_SESSION} || $ENV{DBUS_SESSION_BUS_ADDRESS}) {
+    plan tests => 4;
+} else {
+    plan skip_all => "Keyring not available (not running under KDE/Gnome/other desktop session), skipping tests";
+}
+
 
 use Passwd::Keyring::KDEWallet;
 

t/08-verylong-params.t

 
 use strict;
 use warnings;
-use Test::Simple tests => 4;
+use Test::More;
+
+if($ENV{DESKTOP_SESSION} || $ENV{DBUS_SESSION_BUS_ADDRESS}) {
+    plan tests => 4;
+} else {
+    plan skip_all => "Keyring not available (not running under KDE/Gnome/other desktop session), skipping tests";
+}
+
 
 use Passwd::Keyring::KDEWallet;
 
 use 5.006;
 use strict;
 use warnings;
-use Test::More tests => 3;
+use Test::More;
+
+plan tests => 3;
 
 sub not_in_file_ok {
     my ($filename, %regex) = @_;