Skip to content

Commit

Permalink
update cmd2func version
Browse files Browse the repository at this point in the history
  • Loading branch information
Nanguage committed Mar 13, 2023
1 parent 4ac75e1 commit 68d11c3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
2 changes: 1 addition & 1 deletion oneface/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from .core import one
from funcdesc import Val

__version__ = '0.2.1'
__version__ = '0.2.2'

__all__ = [one, Val]
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ def get_long_description():

def get_install_requires():
requirements = [
"funcdesc>=0.1.1",
"cmd2func>=0.1.2",
"funcdesc>=0.1.2",
"cmd2func>=0.1.4",
"rich",
"fire",
"qtpy",
Expand Down
17 changes: 7 additions & 10 deletions tests/test_wrap_cli.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import contextlib
from io import StringIO
import os.path as osp
import sys

from oneface.wrap_cli.wrap import wrap_cli, load_config

Expand Down Expand Up @@ -32,22 +33,18 @@ def test_stdout():
conf = load_config(example_yaml)
wrap = wrap_cli(conf, print_cmd=False)
console_buffer = StringIO()
with contextlib.redirect_stdout(console_buffer):
wrap(40, 2)
console_buffer.seek(0)
content = console_buffer.read()
assert content.strip() == "42"
wrap.out_stream = console_buffer
wrap(40, 2)
assert console_buffer.getvalue().strip() == "42"


def test_stderr():
conf = load_config(example_yaml)
wrap = wrap_cli(conf)
console_buffer = StringIO()
with contextlib.redirect_stderr(console_buffer):
wrap(40, "aaa")
console_buffer.seek(0)
content = console_buffer.read()
assert "NameError" in content
wrap.err_stream = console_buffer
wrap(40, "aaa")
assert "NameError" in console_buffer.getvalue()


def test_replace():
Expand Down

0 comments on commit 68d11c3

Please sign in to comment.