Skip to content

Commit

Permalink
Fix lowercase names (MDAnalysis#117)
Browse files Browse the repository at this point in the history
  • Loading branch information
hejamu committed Mar 28, 2024
1 parent f1f0a37 commit 7d93b48
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions docs/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Changelog

* Replace Boolean ``debug`` option in ``setup_logging`` by more flexible integer
``level`` parameter.
* Change handling of lowercase module names

v0.1.28 (2023-09-29)
------------------------------------------
Expand Down
5 changes: 3 additions & 2 deletions src/mdacli/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
A command line interface (CLI) to the analysis modules of MDAnalysis.
The modules are all structured as part of a single mdacli wrapper, and invoked
with commands like `mda RMSD`. This command uses the class
:class:`MDAnalysis.analysis.rms.RMSD` for calculating the RMSD.
with commands like `mda RMSD` (The lowercase `mda rmsd` is also supported).
This command uses the class :class:`MDAnalysis.analysis.rms.RMSD` for
calculating the RMSD.
Documentation for each module can be found at the respective sections on the
`MDAnalysis Documentation`_, as well as
`mda command -h`.
Expand Down
2 changes: 1 addition & 1 deletion src/mdacli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def cli(name,

# Get the correct ArgumentParser instance from all subparsers
# `[0]` selects the first subparser where our analysises live in.
_key = analysis_callable.__name__.lower()
_key = analysis_callable.__name__
ap_sup = ap._subparsers._group_actions[0].choices[_key]
arg_grouped_dict = split_argparse_into_groups(ap_sup, args)

Expand Down
7 changes: 7 additions & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ def test_case_insensitive(args):
subprocess.check_call(["mda", args, "-h"])


@pytest.mark.parametrize('args', ("RMSF", "rmsf"))
def test_case_insensitive_with_flags(args):
"""Test for module name being case insensitive with additional flags."""
# Check if it still works if the module name is not the second argument
subprocess.check_call(['mda', '--debug', args, "-h"])


def test_running_analysis(tmpdir):
"""Test running a complete analysis."""
with tmpdir.as_cwd():
Expand Down

0 comments on commit 7d93b48

Please sign in to comment.