Skip to content

Apply black to Tests/ #2552

Closed
Closed

Description

@peterjc

This is a spin out from #2008, where we have agreed to adopt the black code formatting tool for Biopython:

https://github.com/psf/black

That issue focused on applying black to the main code base (Bio/, BioSQL/, and also Scripts/ and Doc/examples/).

This issue is for applying black to the Biopython test suite.

In principle this is a good issue for new contributors. However, many of the tests include expected data values, so compared to the Biopython main code there are more likely to be cases where black does a bad job - which will need some discussion (e.g. can it be improved with extra brackets, or do we turn off black for a portion of a test file?).

You will need to install black, flake8, and associated plugins as described in https://github.com/biopython/biopython/blob/master/CONTRIBUTING.rst - and we recommend turning on the git pre-commit hook).

Example workflow:

git checkout master # and make sure it is up to date
git checkout -b black_test_XXX # start a new branch
black Tests/test_XXX.py  # do the conversion
flake8 Tests/test_XXX.py # check for string concatenation etc
emacs Tests/test_XXX.py  # review and make any fixes
git commit Tests/test_XXX.py -m "Apply black to Tests/test_XXX.py"
git push my_fork black_text_XXX  # push the branch to your personal GitHub

To avoid duplication of effort, please comment here if you are going to work on a particular file, or group of files.

Activity

  1. added
    good first issue
    on Jan 15, 2020
  2. svalqui commented on Jan 20, 2020

    @svalqui
    Contributor

    I'll work on test_PDB*

  3. svalqui commented on Jan 22, 2020

    @svalqui
    Contributor

    I'll work on test_SeqIO*

  4. svalqui commented on Feb 5, 2020

    @svalqui
    Contributor

    I'll work on test_SearchIO* files.

  5. svalqui commented on Feb 9, 2020

    @svalqui
    Contributor

    I'll work on test_pro* files.

  6. svalqui commented on Feb 11, 2020

    @svalqui
    Contributor

    I'll work on test_Phylo* files.

  7. svalqui commented on Feb 12, 2020

    @svalqui
    Contributor

    I'll work on test_PAML* files.

  8. svalqui commented on Feb 13, 2020

    @svalqui
    Contributor

    I'll work on test_T* files.

  9. svalqui commented on Feb 16, 2020

    @svalqui
    Contributor

    I'll skip test_Tutorial.py as is raising errors with some doctest on the tutorial.
    ValueError: 4 Tutorial doctests failed:
    test_chapter_entrez_line_00202,
    test_chapter_entrez_line_00325,
    test_chapter_entrez_line_00419,
    test_chapter_entrez_line_00466,

  10. svalqui commented on Feb 17, 2020

    @svalqui
    Contributor

    I'll work on SCOP files

  11. peterjc commented on Feb 17, 2020

    @peterjc
    MemberAuthor

    You can try python run_tests.py test_Tutoturial.py --offline but it sounds like four of the online Entrez tests in the Tutorial were failing. Please confirm if that was only after running black or not. If not, please open a new issue. Thanks.

  12. svalqui commented on Feb 17, 2020

    @svalqui
    Contributor

    It was before running black, I have logged an issue for that.

  13. svalqui commented on Feb 17, 2020

    @svalqui
    Contributor

    I'll work on test_PopGen* files

  14. 40 remaining items

  15. jvfe commented on Jul 22, 2020

    @jvfe
    Contributor

    I'll work on test_Emboss.py and test_Clustalw_tool.py, fixing what was mentioned in #2835 as well.

  16. mariecrane commented on Jul 22, 2020

    @mariecrane
    Contributor

    I can work on Tests/test_KEGG.py

  17. jvfe commented on Jul 22, 2020

    @jvfe
    Contributor

    I'll work on test_HMM*

  18. jvfe commented on Jul 23, 2020

    @jvfe
    Contributor

    I'll work with the remaining test_*_tool.py

  19. jvfe commented on Jul 23, 2020

    @jvfe
    Contributor

    I'll work on the remaining test_C*.py

  20. jvfe commented on Jul 23, 2020

    @jvfe
    Contributor

    I'll work on test_pairwise*.py and test_AlignI*.py

  21. jvfe commented on Jul 24, 2020

    @jvfe
    Contributor

    I'll work on test_P*.py

  22. jvfe commented on Jul 24, 2020

    @jvfe
    Contributor

    I'll work on test_align*.py

  23. jvfe commented on Jul 25, 2020

    @jvfe
    Contributor

    I'll work on test_Seq*.py and test_N*.py

  24. jvfe commented on Jul 25, 2020

    @jvfe
    Contributor

    I'll work on the remaining tests, some also require changing assert statements, as specified in #2835, most should be minor changes and easy to merge.

  25. peterjc commented on Jul 25, 2020

    @peterjc
    MemberAuthor

    Almost there...

    $ cd Tests/
    $ black --check .
    would reformat /Users/xxx/repositories/biopython/Tests/requires_wise.py
    would reformat /Users/xxx/repositories/biopython/Tests/requires_internet.py
    would reformat /Users/xxx/repositories/biopython/Tests/search_tests_common.py
    would reformat /Users/xxx/repositories/biopython/Tests/PAML/gen_results.py
    would reformat /Users/xxx/repositories/biopython/Tests/seq_tests_common.py
    would reformat /Users/xxx/repositories/biopython/Tests/pairwise2_testCases.py
    would reformat /Users/xxx/repositories/biopython/Tests/test_Seq_objs.py
    
  26. jvfe commented on Jul 25, 2020

    @jvfe
    Contributor

    Almost there...

    $ cd Tests/
    $ black --check .
    would reformat /Users/xxx/repositories/biopython/Tests/requires_wise.py
    would reformat /Users/xxx/repositories/biopython/Tests/requires_internet.py
    would reformat /Users/xxx/repositories/biopython/Tests/search_tests_common.py
    would reformat /Users/xxx/repositories/biopython/Tests/PAML/gen_results.py
    would reformat /Users/xxx/repositories/biopython/Tests/seq_tests_common.py
    would reformat /Users/xxx/repositories/biopython/Tests/pairwise2_testCases.py
    would reformat /Users/xxx/repositories/biopython/Tests/test_Seq_objs.py
    

    Oh, must've missed those cause I checked test_*. I'll do another PR for them.

  27. peterjc commented on Jul 25, 2020

    @peterjc
    MemberAuthor

    And we're done - a real team effort, thank you to everyone including all the BCC2020 CoFest participants who helped with the final push.

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

    Stylegood first issuehelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions