Skip to content

exclude rather than include doctests in "run_tests.py doctest" - #1906

Merged
peterjc merged 2 commits into
biopython:masterfrom
rwst:run_tests
Mar 18, 2019
Merged

peterjc merged 2 commits into
biopython:masterfrom
rwst:run_tests

Conversation

@rwst

@rwst rwst commented Jan 23, 2019

Copy link
Copy Markdown
Contributor

This pull request addresses issue #1904

  • 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 and understand that AppVeyor and
    TravisCI will be used to confirm the Biopython unit tests and flake8 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.)

@codecov

codecov Bot commented Jan 23, 2019

Copy link
Copy Markdown

Codecov Report

Merging #1906 into master will decrease coverage by 1.02%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1906      +/-   ##
==========================================
- Coverage   84.98%   83.95%   -1.03%     
==========================================
  Files         310      293      -17     
  Lines       49913    46938    -2975     
==========================================
- Hits        42417    39408    -3009     
- Misses       7496     7530      +34
Impacted Files Coverage Δ
Bio/Phylo/CDAOIO.py 5.42% <0%> (-80.1%) ⬇️
Bio/Graphics/__init__.py 25% <0%> (-58.34%) ⬇️
Bio/Phylo/CDAO.py 42.85% <0%> (-57.15%) ⬇️
Bio/_py3k/__init__.py 38.09% <0%> (-38.1%) ⬇️
Bio/PDB/mmtf/__init__.py 72.22% <0%> (-16.67%) ⬇️
BioSQL/BioSeqDatabase.py 65.92% <0%> (-11.7%) ⬇️
Bio/Phylo/_cdao_owl.py 88.88% <0%> (-11.12%) ⬇️
BioSQL/DBUtils.py 64.38% <0%> (-10.96%) ⬇️
Bio/Phylo/_utils.py 57.37% <0%> (-7.79%) ⬇️
Bio/KEGG/KGML/KGML_pathway.py 72.08% <0%> (-7.05%) ⬇️
... and 50 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0593e2f...79f1a8d. Read the comment docs.

@codecov

codecov Bot commented Jan 23, 2019 •

Copy link
Copy Markdown

Codecov Report

Merging #1906 into master will decrease coverage by <.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1906      +/-   ##
==========================================
- Coverage   85.04%   85.04%   -0.01%     
==========================================
  Files         311      312       +1     
  Lines       50137    50139       +2     
==========================================
- Hits        42640    42639       -1     
- Misses       7497     7500       +3
Impacted Files Coverage Δ
Bio/Cluster/__init__.py 82.19% <0%> (-0.74%) ⬇️
Bio/PopGen/GenePop/Utils.py 100% <0%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f23ac56...05ff690. Read the comment docs.

Comment thread Tests/run_tests.py Outdated
'BioSQL.BioSeqDatabase',
'Bio.SubsMat',
'Bio.SubsMat.FreqTable',
'Bio.TogoWS',

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.

Bio.TogoWS is an online module, probably best to treat it the same as Bio.Entrez (below), and ultimately make this conditional on the --offline switch if we can make these into working doctests.

Comment thread Tests/run_tests.py Outdated
for pkg in find_packages(path):
modules.add(pkg)
pkgpath = path + '/' + pkg.replace('.', '/')
if sys.version_info.major == 2 or sys.version_info.minor < 6:

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.

Would this not be clearer?: sys.version_info < (3, 6)

Comment thread Tests/run_tests.py Outdated
modules = find_modules(self.testdir + '/..')
modules.difference_update(set(EXCLUDE_DOCTEST_MODULES))
mods_list = list(modules)
mods_list.sort()

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.

In place of these two lines,

mods_list = list(modules)
mods_list.sort()

I'd save a line here using:

mod_list = sorted(modules)

@peterjc

peterjc commented Jan 23, 2019

Copy link
Copy Markdown
Member

I like how this is going. I see we have some failures as follows:

======================================================================
ERROR: Bio.PopGen.GenePop.Utils
----------------------------------------------------------------------
Traceback (most recent call last):
  File "run_tests.py", line 508, in runTest
    optionflags=doctest.ELLIPSIS)
  File "/opt/python/2.7.14/lib/python2.7/doctest.py", line 2414, in DocTestSuite
    raise ValueError(module, "has no docstrings")
ValueError: (<module 'Bio.PopGen.GenePop.Utils' from '/home/travis/build/biopython/biopython/build/lib.linux-x86_64-2.7/Bio/PopGen/GenePop/Utils.py'>, 'has no docstrings')
======================================================================
ERROR: Bio.Restriction.Restriction_Dictionary
----------------------------------------------------------------------
Traceback (most recent call last):
  File "run_tests.py", line 508, in runTest
    optionflags=doctest.ELLIPSIS)
  File "/opt/python/2.7.14/lib/python2.7/doctest.py", line 2414, in DocTestSuite
    raise ValueError(module, "has no docstrings")
ValueError: (<module 'Bio.Restriction.Restriction_Dictionary' from '/home/travis/build/biopython/biopython/build/lib.linux-x86_64-2.7/Bio/Restriction/Restriction_Dictionary.py'>, 'has no docstrings')
----------------------------------------------------------------------

Those modules ought to have a minimal docstring anyway, so we should do that - which would help with resolving #1203, where I'd like to enable the D100 check in Bio/.flake8

For Bio/PopGen/GenePop/Utils.py this is trivial - there is an intended module docstring but it is below an import line.

In the case of Bio/Restriction/Restriction_Dictionary.py both this and the code to generate the file would need updating, see Scripts/Restriction/ranacompiler.py - We can just turn some of the # prefixed comment into a module level docstring.

@rwst

rwst commented Jan 24, 2019

Copy link
Copy Markdown
Contributor Author

I adapted the restriction stuff and comments match too. I left out the (C) Frederic Sohm because I'm skeptical. These are autogenerated and, if any, the (C) of the sources should be on them. Opinions?

@peterjc

peterjc commented Jan 24, 2019

Copy link
Copy Markdown
Member

Frederic Sohm has some claim to any copyright on the autogenerated file, and thus far we don't have permission to dual license his contributions (See #898). I would be inclined to leave the copyright statement in place, and the old license only. Being pragmatic, we want to replace Bio.Restriction so the problem will go away.

@rwst

rwst commented Jan 25, 2019

Copy link
Copy Markdown
Contributor Author

Passes now. Please review. Sorry again for the number of commits.

@peterjc

peterjc commented Jan 25, 2019

Copy link
Copy Markdown
Member

The pillow / PIL import is a puzzle, I was thinking something had changed on AppVeyor or the Python ecosystem in Jan 2019, resulting in a new failure:

e.g.

Python version: 2.7.15 |Anaconda, Inc.| (default, Dec 10 2018, 21:57:18) [MSC v.1500 64 bit (AMD64)]
Operating system: nt win32
===============================
ERROR: Bio.Graphics.KGML_vis
----------------------------------------------------------------------
Traceback (most recent call last):
  File "run_tests.py", line 683, in runTest
    module = __import__(name, fromlist=name.split("."))
  File "C:\projects\biopython\build\lib.win-amd64-2.7\Bio\Graphics\KGML_vis.py", line 24, in <module>
    from PIL import Image
  File "C:\Py\lib\site-packages\PIL\Image.py", line 94, in <module>
    from . import _imaging as core
ImportError: DLL load failed: The specified module could not be found.
----------------------------------------------------------------------
Ran 471 tests in 643.032 seconds

This worked on Monday https://ci.appveyor.com/project/biopython/biopython/builds/21768582 but failed days later with https://ci.appveyor.com/project/biopython/biopython/builds/21822450/job/xi33e20t6kyoyy3m even though the associated pull request which added Bio.Graphics.KGML_vis to the doctests passed #1900

I found a similar issue back with Pillow 4.1 and the exact version of Python used: https://stackoverflow.com/questions/43264773/pil-dll-load-failed-specified-procedure-could-not-be-found

However, specifically installing pillow 5.3, 5.2, 5.1, 5.0, or 4.3 didn't work here (tested on my fork). However pillow 4.2 did,

https://ci.appveyor.com/project/peterjc/biopython/builds/21865494

I'm not convinced this isn't just a transient problem elsewhere... but tweaking how we test the import also seemed to work (your latest commit passed).

Comment thread Tests/run_tests.py Outdated
from PIL import Image
del Image
except ImportError:
# Missing on Jython or Python 2.4

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.

This comment can be removed (not relevant to the PIL / pillow import for Image)

@rwst

rwst commented Jan 25, 2019

Copy link
Copy Markdown
Contributor Author

Why do I get the flake8 BioSQL/ error now? Some change elsewhere?

@peterjc

peterjc commented Jan 25, 2019

Copy link
Copy Markdown
Member

@rwst the flake8 error was down to a bug in a flake8 dependency, config-parser, since fixed. See #1909 (comment)

I expect quite a few people/projects would have been caught out by this, even though it was fixed the same day - which was good.

@peterjc

peterjc commented Feb 1, 2019

Copy link
Copy Markdown
Member

I've push some trivial additions to your branch...

peterjc pushed a commit that referenced this pull request Feb 2, 2019
Originally part of pull request #1906, see also issue #1203.
peterjc pushed a commit that referenced this pull request Feb 2, 2019
Originally part of pull request #1906, see also issue #1203.
@peterjc

peterjc commented Feb 2, 2019

Copy link
Copy Markdown
Member

I've extracted the docstring work with git cherry-pick and applied that to the master for #1203 (thank you!), and will take care of the merge conflict that has made - you don't need to update this branch.

@rwst

rwst commented Mar 15, 2019

Copy link
Copy Markdown
Contributor Author

Looks like I can close this one.

@rwst rwst closed this Mar 15, 2019
@rwst
rwst deleted the run_tests branch March 15, 2019 06:43
@peterjc

peterjc commented Mar 15, 2019

Copy link
Copy Markdown
Member

Is it too late to undelete the branch and reopen this? The core improvement has not yet been merged.

@rwst
rwst restored the run_tests branch March 16, 2019 14:02
@rwst

rwst commented Mar 16, 2019

Copy link
Copy Markdown
Contributor Author

I was not aware that things were not merged, sorry, it seems recovered. What needs to be done?

@rwst rwst reopened this Mar 16, 2019
@peterjc

peterjc commented Mar 16, 2019

Copy link
Copy Markdown
Member

GitHub says there is a merge conflict now (not surprising as there have been a few more doctest added to Tests/run_tests.py, and in Scripts/Restriction/ranacompiler.py where I did some minor style changes).

Are you familiar and confident with using git rebase origin/master? If so, that would be ideal.

@rwst

rwst commented Mar 17, 2019

Copy link
Copy Markdown
Contributor Author

Let's see if this worked. Better no longer delay the merge if it's good.

@peterjc

peterjc commented Mar 18, 2019

Copy link
Copy Markdown
Member

Looks like 3e65121 got lost, presumably during manual fixing of the merge conflicts. Leave this with me...

@peterjc

peterjc commented Mar 18, 2019

Copy link
Copy Markdown
Member

How does this look? Rebased (again) and squashed down to one commit (still with your name).

I then included a second commit to update the Tutorial chapter.

@rwst

rwst commented Mar 18, 2019

Copy link
Copy Markdown
Contributor Author

Fine with me.

@peterjc
peterjc merged commit e85e349 into biopython:master Mar 18, 2019
@peterjc

peterjc commented Mar 18, 2019

Copy link
Copy Markdown
Member

Applied, thank you!

@peterjc peterjc mentioned this pull request Mar 18, 2019
3 tasks done
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.

2 participants