From 426b85d0467cdea4967f1875684a86c19d8c3b6d Mon Sep 17 00:00:00 2001 From: Oliver Beckstein Date: Mon, 23 Apr 2018 14:38:11 -0700 Subject: [PATCH] silence duecredit import failure - fix #1872 - Do not show a warning if duecredit is not installed; if users want the functionality they can install duecredit but we should not bother all others. - NOTE: This was manually tested in a local installation without duecredit but doing a real unit test is difficult and has not been attempted. --- package/CHANGELOG | 5 +++-- package/MDAnalysis/due.py | 8 ++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/package/CHANGELOG b/package/CHANGELOG index cbff0e53b1d..3e16d7e8467 100644 --- a/package/CHANGELOG +++ b/package/CHANGELOG @@ -13,7 +13,7 @@ The rules for this file: * release numbers follow "Semantic Versioning" http://semver.org ------------------------------------------------------------------------------ -??/??/18 richardjgowers, palnabarun +??/??/18 richardjgowers, palnabarun, orbeckst * 0.18.1 @@ -22,7 +22,8 @@ Enhancements Fixes * Fixed order of indices in Angle/Dihedral/Improper repr * coordinates.memory.MemoryReader now takes np.ndarray only (Issue #1685) - + * Silenced warning when duecredit is not installed (Issue #1872) + Changes diff --git a/package/MDAnalysis/due.py b/package/MDAnalysis/due.py index 23346908280..8570f9a722f 100644 --- a/package/MDAnalysis/due.py +++ b/package/MDAnalysis/due.py @@ -82,10 +82,10 @@ def _donothing_func(*args, **kwargs): warnings.warn(errmsg) logging.getLogger("duecredit").error( "Failed to import duecredit due to {}".format(str(err))) - else: - # for debugging - import warnings - warnings.warn(str(err)) + # else: + # Do not issue any warnings if duecredit is not installed; + # this is the user's choice (Issue #1872) + # Initiate due stub due = InactiveDueCreditCollector() BibTeX = Doi = Url = _donothing_func