Skip to content

Commit

Permalink
Update duecredit paths (#45)
Browse files Browse the repository at this point in the history
* Update duecredit paths
* Add tests, move a few things around
* update changelog & gitignore
* enable duecredit
  • Loading branch information
IAlibay authored Jan 14, 2024
1 parent 9271592 commit d24c397
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/gh-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,9 @@ jobs:
conda info
conda list
- name: Run tests
env:
DUECREDIT_ENABLE: 'yes'
run: |
pytest -n 2 -v --cov=mdahole2 --cov-report=xml --color=yes mdahole2/tests/
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,6 @@ ENV/

# poetry
poetry.lock

# duecredit
*.duecredit.p
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ The rules for this file:
<!-- New added features -->

### Fixed
- Duecredit paths now point to mdahole2
<!-- Bug fixes -->

### Changed
Expand Down
1 change: 1 addition & 0 deletions devtools/conda-envs/test_env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ dependencies:
- pytest-xdist
- codecov
- hole2
- duecredit
1 change: 1 addition & 0 deletions mdahole2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
mdahole2
A Python interface for the HOLE suite tools to analyze an ion channel pore or transporter pathway as a function of time or arbitrary order parameters.
"""
from . import analysis

# Handle version
from importlib.metadata import version
Expand Down
9 changes: 5 additions & 4 deletions mdahole2/analysis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,20 +305,21 @@
:func:``hole`` on each of them.
"""
from MDAnalysis.due import due, Doi
from .hole import hole, HoleAnalysis
from .utils import create_vmd_surface

from MDAnalysis.due import due, Doi

due.cite(Doi("10.1016/S0006-3495(93)81293-1"),
description="HOLE program",
path="MDAnalysis.analysis.hole2",
path="mdahole2.analysis.hole",
cite_module=True)
due.cite(Doi("10.1016/S0263-7855(97)00009-X"),
description="HOLE program",
path="MDAnalysis.analysis.hole2",
path="mdahole2.analysis.hole",
cite_module=True)
due.cite(Doi("10.1016/j.jmb.2013.10.024"),
description="HOLE trajectory analysis with orderparameters",
path="MDAnalysis.analysis.hole2",
path="mdahole2.analysis.hole",
cite_module=True)
del Doi
26 changes: 26 additions & 0 deletions mdahole2/tests/test_duecredit.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import os
import importlib
import pytest
import mdahole2

pytest.importorskip('duecredit')


@pytest.mark.skipif((os.environ.get('DUECREDIT_ENABLE', 'no').lower()
in ('no', '0', 'false')),
reason="duecredit is disabled")
class TestDuecredit:
def test_duecredit_active(self):
assert mdahole2.analysis.due.active

def test_duecredit_collection(self):
importlib.import_module('mdahole2.analysis.hole')

dois = [
"10.1016/s0006-3495(93)81293-1",
"10.1016/s0263-7855(97)00009-x",
"10.1016/j.jmb.2013.10.024"
]

for doi in dois:
assert mdahole2.analysis.due.citations[("mdahole2.analysis.hole", doi)].cites_module

0 comments on commit d24c397

Please sign in to comment.