[Bioperl-l] hardcoded filenames in test scripts

Hilmar Lapp lapp@gnf.org
Mon, 26 Feb 2001 13:24:13 -0800


I took on this issue, and using a automated approach I probably caught
most instances. I already figured that some escaped, e.g., in some of
the LiveSeq tests. If no-one else addresses them before, I'll try to
catch the rest tonight.

In general, if you write a test script that accesses a file (usually
in the test directory), for the sake of not breaking cross-platform
compatibility please do the following:

1) Put 'use Bio::Root::IO;' somewhere at the top, where you put your
other 'use' statements.
2) Instead of writing "t/myfile.fasta" (or whatever name), write
	Bio::Root::IO->catfile("t","myfile.fasta")
This will usually work even if File::Spec is not available.

BTW this is not only true for test scripts. Whenever you specify a
file's path in a module, use the above method instead of a hardcoded
way. Otherwise you might break cross-platform.

	Hilmar
-- 
-------------------------------------------------------------
Hilmar Lapp                            email: lapp@gnf.org
GNF, San Diego, Ca. 92121              phone: +1-858-812-1757
-------------------------------------------------------------