Skip to content

Commit 68d11c3

Browse files
committedMar 13, 2023
update cmd2func version
1 parent 4ac75e1 commit 68d11c3

File tree

3 files changed

+10
-13
lines changed

3 files changed

+10
-13
lines changed
 

‎oneface/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from .core import one
22
from funcdesc import Val
33

4-
__version__ = '0.2.1'
4+
__version__ = '0.2.2'
55

66
__all__ = [one, Val]

‎setup.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ def get_long_description():
3737

3838
def get_install_requires():
3939
requirements = [
40-
"funcdesc>=0.1.1",
41-
"cmd2func>=0.1.2",
40+
"funcdesc>=0.1.2",
41+
"cmd2func>=0.1.4",
4242
"rich",
4343
"fire",
4444
"qtpy",

‎tests/test_wrap_cli.py

+7-10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import contextlib
22
from io import StringIO
33
import os.path as osp
4+
import sys
45

56
from oneface.wrap_cli.wrap import wrap_cli, load_config
67

@@ -32,22 +33,18 @@ def test_stdout():
3233
conf = load_config(example_yaml)
3334
wrap = wrap_cli(conf, print_cmd=False)
3435
console_buffer = StringIO()
35-
with contextlib.redirect_stdout(console_buffer):
36-
wrap(40, 2)
37-
console_buffer.seek(0)
38-
content = console_buffer.read()
39-
assert content.strip() == "42"
36+
wrap.out_stream = console_buffer
37+
wrap(40, 2)
38+
assert console_buffer.getvalue().strip() == "42"
4039

4140

4241
def test_stderr():
4342
conf = load_config(example_yaml)
4443
wrap = wrap_cli(conf)
4544
console_buffer = StringIO()
46-
with contextlib.redirect_stderr(console_buffer):
47-
wrap(40, "aaa")
48-
console_buffer.seek(0)
49-
content = console_buffer.read()
50-
assert "NameError" in content
45+
wrap.err_stream = console_buffer
46+
wrap(40, "aaa")
47+
assert "NameError" in console_buffer.getvalue()
5148

5249

5350
def test_replace():

0 commit comments

Comments
 (0)
Please sign in to comment.