Skip to content

fix untested doctests #1902

Closed
Closed

Description

@rwst

The following modules are not tested because of failing doctests:

  • Bio.AlignIO.MauveIO
  • Bio.Cluster
  • Bio.Data.CodonTable
  • Bio.ExPASy
  • Bio.ExPASy.cellosaurus
  • Bio.File
  • Bio.Medline
  • Bio.motifs.jaspar.db
  • Bio.motifs.mast
  • Bio.motifs.meme
  • Bio.motifs.minimal
  • Bio.PDB
  • Bio.PDB.AbstractPropertyMap
  • Bio.PDB.Atom
  • Bio.PDB.DSSP
  • Bio.PDB.Entity
  • Bio.PDB.FragmentMapper
  • Bio.PDB.mmcifio
  • Bio.PDB.PDBIO
  • Bio.PDB.ResidueDepth
  • Bio.PDB.vectors
  • Bio.phenotype
  • Bio.phenotype.parse
  • Bio.phenotype.phen_micro
  • Bio.Phylo.Applications._Fasttree
  • Bio.Phylo._io
  • Bio.Phylo.TreeConstruction
  • Bio.Phylo._utils
  • Bio.Restriction
  • Bio.Restriction.PrintFormat
  • Bio.Restriction.Restriction
  • Bio.SearchIO.ExonerateIO._base
  • BioSQL.BioSeqDatabase
  • Bio.SubsMat
  • Bio.SubsMat.FreqTable
  • Bio.TogoWS

Activity

  1. peterjc commented on Jan 21, 2019

    @peterjc
    Member

    Cross reference #1901 to test more doctests in run_tests.py.

  2. added
    good first issue
    on Jan 21, 2019
  3. peterjc commented on Jan 21, 2019

    @peterjc
    Member

    This looks like a good idea for new-comers. If you want to work on this, you'd need to update Tests/run_tests.py to add one of the problem modules like Bio.SubsMat to the DOCTEST_MODULES list (update: Nowadays instead remove it from the EXCLUDE_DOCTEST_MODULES list) - and then:

    python3 setup.py install
    cd Tests
    python3 run_tests.py doctest
    

    And then edit Bio/SubsMat/__init__.py to try to fix the doctest, and repeat.

    Some of the examples might be intended to work as doctests, but might just need a file path adjusted or a missing import added.

    Others would have been written as incomplete illustrative examples, which may not be practical to turn into self contained doctests.

  4. pcapel commented on Mar 10, 2019

    @pcapel
    Contributor

    Is it preferred to fix a single module at a time or is it ok to group a few modules together in one merge request?

  5. peterjc commented on Mar 11, 2019

    @peterjc
    Member

    @pcapel one top level folder per pull request is probably best here (e.g. Bio/PDB/, or Bio/motifs/), in part as they will tend to have different maintainers so that simplifies reviewing changes.

  6. kaskales commented on Mar 15, 2019

    @kaskales
    Contributor

    Hello, about fixing the doctest for Bio.motifs.jaspar.db, it seems that the doctest uses an example database host, user, and password. If I'm correctly understanding this, it doesn't seem like this doctest will ever pass since everyone has their database configured differently.

  7. peterjc commented on Mar 16, 2019

    @peterjc
    Member

    In cases like that, we either exclude the whole file from running doctests (not ideal), or for that example don't write it as a doctest but an RST literal block (i.e. indented code, but no >>> lines).

    (Assuming you can't create a temp database as part of the example, with something like SQLite3 that's not a problem - see for examples the Bio.SeqIO.index_db tests).

  8. added a commit that references this issue on Mar 18, 2019
  9. peterjc commented on Mar 19, 2019

    @peterjc
    Member

    Note that some of the modules on this list are simply missing any doctests at all, e.g. Bio.Restriction as noted by @MarkusPiotrowski 4a9dcbc#commitcomment-32819770

  10. MarkusPiotrowski commented on Mar 21, 2019

    @MarkusPiotrowski
    Contributor

    Sorry, I was wrong, actually they have doctests. I thougth that doctests are only self-running doctests (those modules with if __name__ = "__main__"...run_doctest()).

    So, I'm taking care for the Restriction module.

  11. peterjc commented on Mar 22, 2019

    @peterjc
    Member

    Great - it looks like they need some missing imports added, and blank lines where the expected output otherwise merges into the text - e.g.

    https://github.com/biopython/biopython/blob/master/Bio/Restriction/Restriction.py#L286

            """Override '/' operator to use as search method.
    
            >>> from Bio.Restriction import EcoRI
            >>> EcoRI/Seq('GAATTC')
            [2]
            Returns RE.search(other).
            """

    to:

            """Override '/' operator to use as search method.
    
            >>> from Bio.Seq import Seq
            >>> from Bio.Restriction import EcoRI
            >>> EcoRI / Seq('GAATTC')
            [2]
    
            Returns RE.search(other).
            """
  12. kritikadusad commented on Apr 2, 2019

    @kritikadusad

    Hi there! I am new to contributing to open source projects. Please bear with me...
    I am working on fixing the Bio.PDB.AbstractPropertyMap doctest. I want to make an AbstractPropertyMap object to fix the test. Trying to figure out where the property_dict, property_keys, property_list can be obtained to make the object.

  13. kaskales commented on Apr 3, 2019

    @kaskales
    Contributor

    @kritikadusad I've never used the AbstractPropertyMap class myself, but if you take a took at the ResidueDepth class you can see that it creates a AbstractPropertyMap with the three attributes you need. If you have the test for it running, test_PDB_ResidueDepth.py, you could edit it to try and print the ResidueDepth objects contents maybe?

  14. 4 remaining items

  15. svalqui commented on May 1, 2019

    @svalqui
    Contributor

    I'll work on Bio.SearchIO.ExonerateIO._base

  16. svalqui commented on May 24, 2019

    @svalqui
    Contributor

    I'll Work on Bio.Phylo.

  17. added a commit that references this issue on May 29, 2019
  18. svalqui commented on Jun 12, 2019

    @svalqui
    Contributor

    I'll work on Bio.phenotype

  19. svalqui commented on Jun 26, 2019

    @svalqui
    Contributor

    I'll work on Bio.PDB.

  20. Andrey-Raspopov commented on Jul 8, 2019

    @Andrey-Raspopov
    Contributor

    Hello! I'm looking into BioSQL.BioSeqDatabase and besides the simple import error there is a bigger concern. The existing doctest assumes that user not only has some DB software installed, but:

    1. It has 'root' user
    2. Without a password
    3. This user has access to the existing 'minidb' database

    Since we can't guarantee these, my only solution to this could be moving the doctest to the commentary block. Does that seem good?

  21. MarkusPiotrowski commented on Jul 8, 2019

    @MarkusPiotrowski
    Contributor

    You can/should make it into a literal block. To do this you end the paragraph before with two colons (::) and remove the >>> from the code block. In this way it is rendered similar to a code block, but it is not run as doctest.

  22. dizak commented on Aug 28, 2019

    @dizak

    I have done Bio/phenotype/phen_micro and created pr #2235 I have tested it on TravisCI so it required changes to .travis-tox.ini. Since the test passed (except for Python3.8 for which numpy installation fails) I guess I should revert the changes in this file?

  23. peterjc commented on Aug 30, 2019

    @peterjc
    Member

    Updated the check boxes, just two left:

    # Following modules have historic failures. If you fix one of these
    # please remove here!
    EXCLUDE_DOCTEST_MODULES = [
        "Bio.PDB",
        "Bio.PDB.AbstractPropertyMap",
    ]
    

    https://github.com/biopython/biopython/blob/master/Tests/run_tests.py#L78

  24. farAtGitHub commented on Jan 1, 2020

    @farAtGitHub
    Contributor

    I created #2482 trying to fix Bio.PDB.AbstractPropertyMap. Hope it's not too far off.

  25. farAtGitHub commented on Jan 1, 2020

    @farAtGitHub
    Contributor

    I stumbled over biopython/Doc/Tutorial/chapter_testing.tex which also contains EXCLUDE_DOCTEST_MODULES (see below). Does that file need any attention as well?

    # Following modules have historic failures. If you fix one of these
    # please remove here!
    EXCLUDE_DOCTEST_MODULES = [
        "Bio.PDB",
        "Bio.PDB.AbstractPropertyMap",
        "Bio.Phylo.Applications._Fasttree",
        "Bio.Phylo._io",
        "Bio.Phylo.TreeConstruction",
        "Bio.Phylo._utils",
    ]
    
  26. peterjc commented on Jan 3, 2020

    @peterjc
    Member

    Since EXCLUDE_DOCTEST_MODULES is now empty, we could perhaps remove it including the code implementing, and this documentation describing it.

    Any comments @mdehoon? As I recall, problematic doctests have either been different versions of Python, or cross platform issues - although in that case the test itself can usually be tweaked (e.g. reduce number of significant figures). e.g. there was a 32 vs 64 bit issue recently.

  27. mdehoon commented on Jan 4, 2020

    @mdehoon
    Contributor

    Yes let's remove it

  28. peterjc commented on Jul 30, 2020

    @peterjc
    Member

    Belatedly closing.

    We still use EXCLUDE_DOCTEST_MODULES for things like ignoring online doctests in offline mode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Testinggood first issuehelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions