Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/source/whats_new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Requirements

Bugs
~~~~
- None yet.
- Fix the ``-e``/``--evaluations`` flag of ``python -m moabb.run``, which used ``type=list`` and so split its value into single characters: ``-e WithinSession`` reached :func:`moabb.benchmark` as ``['W', 'i', 't', ...]`` and raised ``KeyError: 'W'``. It now takes one or more evaluation names, space separated (by `Iain`_)

Code health
~~~~~~~~~~~
Expand Down
7 changes: 4 additions & 3 deletions moabb/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ def parser_init():
"-e",
"--evaluations",
dest="evaluations",
type=list,
type=str,
nargs="+",
default=None,
help="Evaluation types to be run. Must be given as a list. "
'Options - ["WithinSession","CrossSession","CrossSubject"]'
help="Evaluation types to be run, space separated. "
'Options - "WithinSession", "CrossSession", "CrossSubject". '
"By default, all 3 types of evaluations will be done",
)
parser.add_argument(
Expand Down
15 changes: 15 additions & 0 deletions moabb/tests/test_run.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import pytest

from moabb.run import parser_init


@pytest.mark.parametrize(
"argv,expected",
[
(["-e", "WithinSession"], ["WithinSession"]),
(["-e", "WithinSession", "CrossSession"], ["WithinSession", "CrossSession"]),
([], None),
],
)
def test_parser_evaluations(argv, expected):
assert parser_init().parse_args(argv).evaluations == expected
Loading