9 # Setup the code to clean out %ENV
11 # Environment variables which might effect our testing
12 my @delete_env_keys = qw(
25 # Remember the ENV values because on VMS %ENV is global
26 # to the user, not the process.
30 for my $key (@delete_env_keys) {
31 if( exists $ENV{$key} ) {
32 $restore_env_keys{$key} = delete $ENV{$key};
41 while( my($key, $val) = each %restore_env_keys ) {
51 # In case the test wants to use our other bundled
52 # modules, make sure they can be loaded.
53 my $t_lib = File::Spec->catdir('t', 'bundled');
54 push @INC, $t_lib; # Let user's installed version override
56 if ($ENV{PERL_CORE}) {
57 # We change directories, so expand @INC and $^X to absolute paths
59 @INC = (map(File::Spec->rel2abs($_), @INC), ".");
60 $^X = File::Spec->rel2abs($^X);
69 # We pass everything through to Test::More
70 use vars qw($VERSION @ISA @EXPORT %EXPORT_TAGS $TODO);
72 @ISA = qw(Test::More); # Test::More isa Exporter
73 @EXPORT = @Test::More::EXPORT;
74 %EXPORT_TAGS = %Test::More::EXPORT_TAGS;
76 # We have a few extra exports, but Test::More has a special import()
77 # that won't take extra additions.
78 my @extra_exports = qw(
80 push @EXPORT, @extra_exports;
81 __PACKAGE__->export(scalar caller, @extra_exports);
82 # XXX ^-- that should really happen in import()
85 ########################################################################
87 # always return to the current directory
89 my $cwd = File::Spec->rel2abs(Cwd::cwd);
91 sub original_cwd { return $cwd }
94 # Go back to where you came from!
95 chdir $cwd or die "Couldn't chdir to $cwd";
98 ########################################################################
100 # Setup a temp directory
102 my ($self, @args) = @_;
103 my $dir = $ENV{PERL_CORE} ? MBTest->original_cwd : File::Spec->tmpdir;
104 return File::Temp::tempdir('MB-XXXXXXXX', CLEANUP => 1, DIR => $dir, @args);
108 $ENV{HOME} = tmpdir; # don't want .modulebuildrc or other things interfering
112 # vim:ts=2:sw=2:et:sta