summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.appveyor.yml2
-rw-r--r--CHANGELOG.md3
-rw-r--r--cmd2/cmd2.py22
-rw-r--r--cmd2/utils.py16
-rw-r--r--tox.ini12
5 files changed, 15 insertions, 40 deletions
diff --git a/.appveyor.yml b/.appveyor.yml
index ad884315..91f45824 100644
--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -4,4 +4,4 @@ install:
build: off
test_script:
- - python -m tox -e py35-win,py36-win
+ - python -m tox -e py35-win,py36-win,py37-win
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 764d0061..7d30d117 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,9 @@
* Bug Fixes
* Fixed bug when StatementParser ``__init__()`` was called with ``terminators`` equal to ``None``
* Fixed bug when ``Cmd.onecmd()`` was called with a raw ``str``
+* Deletions
+ * The ``CmdResult`` helper class which was *deprecated* in the previous release has now been deleted
+ * It has been replaced by the improved ``CommandResult`` class
## 0.9.2 (June 28, 2018)
* Bug Fixes
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py
index c6914b95..06295dfd 100644
--- a/cmd2/cmd2.py
+++ b/cmd2/cmd2.py
@@ -3257,25 +3257,3 @@ class Statekeeper(object):
if self.obj:
for attrib in self.attribs:
setattr(self.obj, attrib, getattr(self, attrib))
-
-
-class CmdResult(utils.namedtuple_with_two_defaults('CmdResult', ['out', 'err', 'war'])):
- """DEPRECATED: Derive a class to store results from a named tuple so we can tweak dunder methods for convenience.
-
- This is provided as a convenience and an example for one possible way for end users to store results in
- the self._last_result attribute of cmd2.Cmd class instances. See the "python_scripting.py" example for how it can
- be used to enable conditional control flow.
-
- Named tuple attributes
- ----------------------
- out - this is intended to store normal output data from the command and can be of any type that makes sense
- err: str - (optional) this is intended to store an error message and it being non-empty indicates there was an error
- Defaults to an empty string
- war: str - (optional) this is intended to store a warning message which isn't quite an error, but of note
- Defaults to an empty string.
-
- NOTE: Named tuples are immutable. So the contents are there for access, not for modification.
- """
- def __bool__(self) -> bool:
- """If err is an empty string, treat the result as a success; otherwise treat it as a failure."""
- return not self.err
diff --git a/cmd2/utils.py b/cmd2/utils.py
index ff8e034e..d03e7f6f 100644
--- a/cmd2/utils.py
+++ b/cmd2/utils.py
@@ -61,22 +61,6 @@ def namedtuple_with_defaults(typename: str, field_names: Union[str, List[str]],
return T
-def namedtuple_with_two_defaults(typename: str, field_names: Union[str, List[str]],
- default_values: collections.Iterable=('', '')):
- """Wrapper around namedtuple which lets you treat the last value as optional.
-
- :param typename: str - type name for the Named tuple
- :param field_names: List[str] or space-separated string of field names
- :param default_values: (optional) 2-element tuple containing the default values for last 2 parameters in named tuple
- Defaults to an empty string for both of them
- :return: namedtuple type
- """
- T = collections.namedtuple(typename, field_names)
- # noinspection PyUnresolvedReferences
- T.__new__.__defaults__ = default_values
- return T
-
-
def cast(current: Any, new: str) -> Any:
"""Tries to force a new value into the same type as the current when trying to set the value for a parameter.
diff --git a/tox.ini b/tox.ini
index c7ccdeac..a5e91d46 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,5 +1,5 @@
[tox]
-envlist = py34,py35,py36,py37,py35-win,py36-win
+envlist = py34,py35,py36,py37,py35-win,py36-win,py37-win
[pytest]
testpaths = tests
@@ -73,3 +73,13 @@ deps =
wcwidth
commands = py.test -v
+[testenv:py37-win]
+deps =
+ codecov
+ pyperclip
+ pyreadline
+ pytest
+ pytest-cov
+commands =
+ py.test {posargs} --cov
+ codecov