Skip to content

Fix untested doctest phen_micro - #2235

Closed
dizak wants to merge 14 commits into
biopython:masterfrom
dizak:fix_untested_doctest_phen_micro
Closed

dizak wants to merge 14 commits into
biopython:masterfrom
dizak:fix_untested_doctest_phen_micro

Conversation

@dizak

@dizak dizak commented Aug 28, 2019

Copy link
Copy Markdown

This pull request addresses untested doctests of Bio.phenotype.phen_micro

  • I hereby agree to dual licence this and any previous contributions under both
    the Biopython License Agreement AND the BSD 3-Clause License.

  • I have read the CONTRIBUTING.rst file, have run flake8 locally, and
    understand that AppVeyor and TravisCI will be used to confirm the Biopython unit
    tests and style checks pass with these changes.

  • I have added my name to the alphabetical contributors listings in the files
    NEWS.rst and CONTRIB.rst as part of this pull request, am listed
    already, or do not wish to be listed. (This acknowledgement is optional.)

The tests were run on TravisCi activated for my fork of this repository. For this purpose, the Tests.run_tests.py and .travis-tox.ini were modified. Otherwise, the tests would be skipped since this module requires numpy. I suppose the modifications of .travis-tox.ini should be reverted once the rest of the changes in this pull request are accepted.

The tests failed for Python 3.8 due to unsuccessful installation of numpy. It seems it is independent of the doctests themselves.

dizak added 14 commits August 27, 2019 16:56
Paths phenotype/Plate.json were changed to Tests/phenotype/Plate.json
Path phenotype/Plates.csv changed to  Tests/phenotype/Plates.csv
Print an ID of previously selected well instead of erroneously iterating
over
Show complete output in the print output.
Show complete output in the print output
This reverts commit 7310782.
The path are OK if doctest invoked with Tests/run_tests.py
This reverts commit 43ccaf9.
The paths are OK if doctest invoked with Tests/run_tests.py
…ak/biopython into fix_untested_doctest_phenotype
Travis builds did not fail with py38 when .travis-tox.ini was not edited
yet
NumPy fails to build for py38-dev but Bio.phenotype.phen_micro needs to
be removed from Tests.run_tests.EXCLUDE_DOCTEST_MODULES in order to be
tested at TravisCI.
@dizak dizak mentioned this pull request Aug 28, 2019
34 of 36 tasks
@MarkusPiotrowski

MarkusPiotrowski commented Aug 28, 2019 •

Copy link
Copy Markdown
Contributor

@dizak The files which are listed in the 'numpy-requiring' section of run_tests.py don't need to be addressed. They need to stay there to allow running the test suite locally even if numpy is not installed.
Actually, the doctests of phen_micro.py seemed to be fine before:

> python run_tests.py docstest
...
Bio.phenotype docstring test ... ok
Bio.phenotype.phen_micro docstring test ... ok
Bio.phenotype.pm_fitting docstring test ... skipped, missing Python dependency
...

If numpy is installed, the doctests of phen_micro.py are started and don't make any issues. Thus it seems that your changes were not necessary. The three dots ... in the doctests output are called ELLIPSIS and they match any output, so it is not necessary to reproduce the whole output, e.g. a larger list etc.

Or do I miss something?


>>> for well in plate.get_column(12):
... print(well.id)
...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you put this ... line back, you would see it at the interactive python prompt.

H01
H02
H03
...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why fill out the full list? You could list 1, 2, 3, ..., 12 if you wanted to be a little more explicit.

Comment thread Tests/run_tests.py
"Bio.PDB.Vector",
"Bio.phenotype",
"Bio.phenotype.parse",
"Bio.phenotype.phen_micro",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you removing this check? Don't the Bio.phenotype.phen_micro tests require NumPy?

@peterjc

peterjc commented Aug 29, 2019

Copy link
Copy Markdown
Member

Markus is right, e.g. a very recent master branch test, looking at Python 3.7 where numpy is installed:

https://travis-ci.org/biopython/biopython/jobs/578252955

...
test_pairwise_aligner ... ok
test_phenotype ... ok
test_phenotype_fit ... ok
test_phyml_tool ... ok
test_prodoc ... ok
...
Bio.pairwise2 docstring test ... ok
Bio.phenotype docstring test ... ok
Bio.phenotype.phen_micro docstring test ... ok
Bio.phenotype.pm_fitting docstring test ... ok
Bio.triefind docstring test ... ok
...

I don't see anything which needs fixing here?

@dizak

dizak commented Aug 29, 2019

Copy link
Copy Markdown
Author

All your remarks are correct. I am sorry I wasted your time.

The first changes were made after running the doctests manually, without the ELLIPSIS flag. Running the tests with Tests/run_tests.py goes as expected, since:

suite = doctest.DocTestSuite(module,
optionflags=doctest.ELLIPSIS)

I should see this before. Apologies once more, this can be closed.
Please mark the Bio.phenotype.phen_micro as done #1902

@peterjc

peterjc commented Aug 29, 2019

Copy link
Copy Markdown
Member

Ticked on #1902, thanks for spotting that oversight.

When you said you ran the doctests manually, what did you mean?

You can also run an individual file's doctests via this snippet at the end of the file:

if __name__ == "__main__":
    from Bio._utils import run_doctest
    run_doctest(verbose=0)

(However we've found for some modules this does not work on Python 3 due to local imports)

@peterjc peterjc closed this Aug 29, 2019
@dizak

dizak commented Aug 29, 2019

Copy link
Copy Markdown
Author

In my stupidity, I have just run python -m doctest phen_micro.py -v. If run like this, the doctest treats ELLIPSE literally. I did my reading later (too late).

@peterjc

peterjc commented Aug 29, 2019

Copy link
Copy Markdown
Member

Ah, in that case python -m doctest -o ELLIPSIS phen_micro.py -v ought to work? Thanks for clarifying, and do let us know if our testing documentation could be clarified (especially the chapter in the tutorial).

@dizak

dizak commented Aug 30, 2019

Copy link
Copy Markdown
Author

I believe the documentation is fine, it was just the #1902 TODO that made me think there must be something wrong with it since it's on the list :)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants