Skip to content

Commit

Permalink
silence duecredit import failure
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
orbeckst committed Apr 23, 2018
1 parent 8c331d7 commit 426b85d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions package/CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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


Expand Down
8 changes: 4 additions & 4 deletions package/MDAnalysis/due.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 426b85d

Please sign in to comment.