[Bioperl-l] Fwd: [Bioperl-guts-l] [15178] bioperl-live/trunk: new test method test_output_dir(), a wrapper around Temp::File::tempdir

Jason Stajich jason at bioperl.org
Tue Dec 16 17:19:59 UTC 2008


Bio::Root::IO already had a tempdir function which did some  
workarounds if File::Temp wasn't installed.
I guess we assume File::Temp is installed as an essential module now  
then to install (in order to run tests)?

Does it make sense to consolidate and depend on File::Temp aspects?

-jason
Begin forwarded message:

> From: Senduran  Balasubramaniam <sendu at dev.open-bio.org>
> Date: December 16, 2008 4:48:22 AM PST
> To: bioperl-guts-l at bioperl.org
> Subject: [Bioperl-guts-l] [15178] bioperl-live/trunk: new test  
> method test_output_dir(), a wrapper around Temp::File::tempdir
>
> Revision: 15178
> Author:   sendu
> Date:     2008-12-16 07:48:21 -0500 (Tue, 16 Dec 2008)
>
> Log Message:
> -----------
> new test method test_output_dir(), a wrapper around  
> Temp::File::tempdir
>
> Modified Paths:
> --------------
>    bioperl-live/trunk/Bio/Root/Test.pm
>    bioperl-live/trunk/t/LocalDB/DBFasta.t
>    bioperl-live/trunk/t/LocalDB/DBQual.t
>    bioperl-live/trunk/t/LocalDB/Flat.t
>    bioperl-live/trunk/t/RemoteDB/Taxonomy.t
>
> Modified: bioperl-live/trunk/Bio/Root/Test.pm
> ===================================================================
> --- bioperl-live/trunk/Bio/Root/Test.pm	2008-12-16 07:49:26 UTC (rev  
> 15177)
> +++ bioperl-live/trunk/Bio/Root/Test.pm	2008-12-16 12:48:21 UTC (rev  
> 15178)
> @@ -51,6 +51,10 @@
>   # deleted when the test script finishes
>   my $output_file = test_output_file();
>
> +  # we want the name of a directory we can store files in, that  
> will be
> +  # automatically deleted when the test script finishes
> +  my $output_dir = test_output_dir();
> +
> =head1 DESCRIPTION
>
> This provides a common base for all Bioperl test scripts. It safely  
> handles the
> @@ -104,7 +108,7 @@
> use strict;
> use warnings;
>
> -use File::Temp ();
> +use File::Temp qw(tempdir);
> use File::Spec;
> use Exporter qw(import);
>
> @@ -159,6 +163,7 @@
>                  test_begin
>                  test_skip
>                  test_output_file
> +                 test_output_dir
>                  test_input_file
>                  test_network
>                  test_debug);
> @@ -292,6 +297,25 @@
>     return $tmp->filename;
> }
>
> +=head2 test_output_dir
> +
> + Title   : test_output_dir
> + Usage   : my $output_dir = test_output_dir();
> + Function: Get the full path of a directory suitable for storing  
> temporary files
> +           in.
> +           When your test script ends, the directory and its  
> contents will be
> +           automatically deleted.
> + Returns : string (path)
> + Args    : none
> +
> +=cut
> +
> +sub test_output_dir {
> +    die "test_output_dir takes no args\n" if @_;
> +
> +    return tempdir(CLEANUP => 1);
> +}
> +



More information about the Bioperl-l mailing list