[Biopython-dev] Deprecating Bio.ParserSupport, Bio.Blast.NCBIStandalone

Peter Cock p.j.a.cock at googlemail.com
Fri Feb 1 09:32:46 EST 2013


On Fri, Feb 1, 2013 at 2:12 PM, Michiel de Hoon <mjldehoon at yahoo.com> wrote:
> Hi Peter,
>
> As we misunderstood each other, let me try once to make the case for
> putting test files in Bio/*. If I fail to convince you, let's either go back
> to the situation before Bio._utils, or remove the "if __name__ ==
> '__main__':" stuff altogether.

I'm not convinced about putting test files under Bio/* so lets revert
the use of the helper function Bio._utils.run_doctest(), and if you
wish proceed with removing Bio/_utils.py as well.

Shall I go ahead and revert 8b59d89bb4e282192ddee751e24ceef4afa63528
then remove run_doctest and find_test_dir from Bio/_utils.py now?

> First of all, if we use "if __name__ == '__main__':" to run the docstring
> tests, then those tests should pass if a user executes the script.
> Otherwise, we have installed some code that makes no sense outside of the
> distribution. This is also a problem with the
> os.path.isfile("Fasta/sweetpea.nu"), "Run from Tests/ folder"
> solution, as after installation there is no Tests/ folder any more.

That is a good point, this has always been a weakness of the __main__
hook to run the doctests.

> Suppose we make a subdirectory Examples in each module that uses docstring
> tests which need some data files, and put the data files in the Examples
> subdirectory. The docstring tests are supposed to be simple (full testing is
> done by the unittests), so the example data files can be tiny.
>
> The docstring tests can then use
>>>> record = SeqIO.read(open("Examples/sweetpea.nu"),"fasta")
> which is simple enough.
> The unit tests can switch to the appropriate directory when running the
> docstring tests.
> A user, finding the example in the docstring tests, can try out the
> example directly, since the data file is provided together with the relevant
> module.
> And since the data file is in the subdirectory Examples/, there is still
> some separation between the code and the data.

Did you envision installing the examples subdirectories next to the code
under site-packages? Technically that is doable, but I'm not sure if that
is considered good practice (does anyone know the relevant Debian
policies for example - they're quite keen on this kind of thing?).

I much prefer the simplicity of having all the test files in one place
(under the Tests/ folder) especially as things like simple FASTA files
get used in doctests and unittests for multiple different areas of
Biopython.

Regards,

Peter


More information about the Biopython-dev mailing list