Skip to content

Commit

Permalink
Merge pull request #123 from gregoil/fix_output_fallback
Browse files Browse the repository at this point in the history
Change cli output option fallback
  • Loading branch information
gregoil committed Dec 20, 2018
2 parents 2dd8cf3 + ddccd4d commit cbac067
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ psutil==5.4.8
ptyprocess==0.6.0
py==1.7.0
pycodestyle==2.4.0
pyfakefs==3.5.3
pyfakefs==3.5.4
pyflakes==2.0.0
Pygments==2.3.1
pylint==1.9.3
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from setuptools import setup, find_packages


__version__ = "5.4.0"
__version__ = "5.4.1"

result_handlers = [
"db = rotest.core.result.handlers.db_handler:DBHandler",
Expand Down
8 changes: 4 additions & 4 deletions src/rotest/cli/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ def parse_outputs_option(outputs):
non_existing_handlers = set(requested_handlers) - set(available_handlers)

if non_existing_handlers:
raise ValueError("The following output handlers are not "
"existing: {}.\nAvailable options: {}.".format(
", ".join(non_existing_handlers),
", ".join(available_handlers)))
raise argparse.ArgumentTypeError(
"Illegal output handlers: {}.\n"
"Available options: {}.".format(", ".join(non_existing_handlers),
", ".join(available_handlers)))

return requested_handlers

Expand Down
9 changes: 5 additions & 4 deletions tests/cli/test_client.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import absolute_import

import sys
import argparse

import mock
import pytest
Expand All @@ -24,10 +25,10 @@ def test_parsing_output_handlers():


def test_bad_option_in_output_parser():
with pytest.raises(ValueError,
match="The following output handlers are not existing: "
"asd.\nAvailable options:.*pretty"):
parse_outputs_option("pretty,asd")
with pytest.raises(argparse.ArgumentTypeError,
match="Illegal output handlers: asd.\n"
"Available options:.*tree"):
parse_outputs_option("tree,asd")


@mock.patch("rotest.cli.client.run_tests")
Expand Down

0 comments on commit cbac067

Please sign in to comment.