Skip to content

Commit dec95ec

Browse files
committed
Update test
1 parent d8a747b commit dec95ec

File tree

1 file changed

+39
-6
lines changed

1 file changed

+39
-6
lines changed

test/test_bashplot.py

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from pathlib import Path
44
from unittest import mock
55

6+
import pytest
67
import sample_generator
78

89
from bashplot import bashplot
@@ -11,8 +12,8 @@
1112

1213
print()
1314

14-
test_txt = Path.cwd().glob("test*.txt")
15-
test_dat = Path.cwd().glob("test*.dat")
15+
test_txt = list(Path.cwd().glob("test*.txt"))
16+
test_dat = list(Path.cwd().glob("test*.dat"))
1617

1718
args_1 = {
1819
"infile": test_txt,
@@ -103,24 +104,56 @@ def test_usecols():
103104

104105

105106
@mock.patch("bashplot.bashplot.bashplot")
106-
def test_default_run(bashplot):
107+
def test_default_run_mock(bashplot):
107108
bashplot.bashplot(fnames=test_txt, args=args_1)
108109
assert bashplot.bashplot.is_called
109110

110111

112+
def test_default_run():
113+
bashplot.bashplot(fnames=test_txt, args=args_1)
114+
assert True
115+
116+
111117
@mock.patch("bashplot.bashplot.bashplot")
112-
def test_customize_run_1(bashplot):
118+
def test_customize_run_mock_1(bashplot):
113119
bashplot.bashplot(fnames=test_txt, args=args_2)
114120
assert bashplot.bashplot.is_called
115121

116122

123+
def test_customize_run_1():
124+
bashplot.bashplot(fnames=test_txt, args=args_2)
125+
assert True
126+
127+
117128
@mock.patch("bashplot.bashplot.bashplot")
118-
def test_customize_run_2(bashplot):
129+
def test_customize_run_mock_2(bashplot):
119130
bashplot.bashplot(fnames=test_dat, args=args_3)
120131
assert bashplot.bashplot.is_called
121132

122133

134+
def test_customize_run_2():
135+
bashplot.bashplot(fnames=test_dat, args=args_3)
136+
assert True
137+
138+
123139
@mock.patch("bashplot.bashplot.command_line_runner")
124-
def test_command_line(command_line_runner):
140+
def test_command_line_mock(command_line_runner):
125141
bashplot.command_line_runner()
126142
assert bashplot.command_line_runner.is_called
143+
144+
145+
def test_command_line_1():
146+
bashplot.command_line_runner()
147+
assert True
148+
149+
150+
def test_log(capfd):
151+
bashplot.log("msg")
152+
out, _ = capfd.readouterr()
153+
assert out == "msg\n"
154+
155+
156+
def test_log_error(capfd):
157+
bashplot.log("msg", mode=True)
158+
out, _ = capfd.readouterr()
159+
assert out == "[ERROR] msg\n"

0 commit comments

Comments
 (0)