|
3 | 3 | from pathlib import Path |
4 | 4 | from unittest import mock |
5 | 5 |
|
| 6 | +import pytest |
6 | 7 | import sample_generator |
7 | 8 |
|
8 | 9 | from bashplot import bashplot |
|
11 | 12 |
|
12 | 13 | print() |
13 | 14 |
|
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")) |
16 | 17 |
|
17 | 18 | args_1 = { |
18 | 19 | "infile": test_txt, |
@@ -103,24 +104,56 @@ def test_usecols(): |
103 | 104 |
|
104 | 105 |
|
105 | 106 | @mock.patch("bashplot.bashplot.bashplot") |
106 | | -def test_default_run(bashplot): |
| 107 | +def test_default_run_mock(bashplot): |
107 | 108 | bashplot.bashplot(fnames=test_txt, args=args_1) |
108 | 109 | assert bashplot.bashplot.is_called |
109 | 110 |
|
110 | 111 |
|
| 112 | +def test_default_run(): |
| 113 | + bashplot.bashplot(fnames=test_txt, args=args_1) |
| 114 | + assert True |
| 115 | + |
| 116 | + |
111 | 117 | @mock.patch("bashplot.bashplot.bashplot") |
112 | | -def test_customize_run_1(bashplot): |
| 118 | +def test_customize_run_mock_1(bashplot): |
113 | 119 | bashplot.bashplot(fnames=test_txt, args=args_2) |
114 | 120 | assert bashplot.bashplot.is_called |
115 | 121 |
|
116 | 122 |
|
| 123 | +def test_customize_run_1(): |
| 124 | + bashplot.bashplot(fnames=test_txt, args=args_2) |
| 125 | + assert True |
| 126 | + |
| 127 | + |
117 | 128 | @mock.patch("bashplot.bashplot.bashplot") |
118 | | -def test_customize_run_2(bashplot): |
| 129 | +def test_customize_run_mock_2(bashplot): |
119 | 130 | bashplot.bashplot(fnames=test_dat, args=args_3) |
120 | 131 | assert bashplot.bashplot.is_called |
121 | 132 |
|
122 | 133 |
|
| 134 | +def test_customize_run_2(): |
| 135 | + bashplot.bashplot(fnames=test_dat, args=args_3) |
| 136 | + assert True |
| 137 | + |
| 138 | + |
123 | 139 | @mock.patch("bashplot.bashplot.command_line_runner") |
124 | | -def test_command_line(command_line_runner): |
| 140 | +def test_command_line_mock(command_line_runner): |
125 | 141 | bashplot.command_line_runner() |
126 | 142 | 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