| @@ 228-241 (lines=14) @@ | ||
| 225 | assert run.captured_out == '' |
|
| 226 | ||
| 227 | ||
| 228 | def test_stdout_capturing_sys(run, capsys): |
|
| 229 | def print_mock_progress(): |
|
| 230 | for i in range(10): |
|
| 231 | print(i, end="") |
|
| 232 | sys.stdout.flush() |
|
| 233 | ||
| 234 | run.main_function.side_effect = print_mock_progress |
|
| 235 | run.capture_mode = "sys" |
|
| 236 | with capsys.disabled(): |
|
| 237 | run() |
|
| 238 | assert run.captured_out == '0123456789' |
|
| 239 | ||
| 240 | ||
| 241 | @pytest.mark.skipif(sys.platform.startswith('win'), |
|
| 242 | reason="does not work on windows") |
|
| 243 | def test_stdout_capturing_fd(run, capsys): |
|
| 244 | def print_mock_progress(): |
|
| @@ 179-193 (lines=15) @@ | ||
| 176 | return a |
|
| 177 | ||
| 178 | assert ex.run().result == 1 |
|
| 179 | assert ex.run(named_configs=['ncfg']).result == 10 |
|
| 180 | ||
| 181 | ||
| 182 | def test_empty_dict_named_config(ex): |
|
| 183 | @ex.named_config |
|
| 184 | def ncfg(): |
|
| 185 | empty_dict = {} |
|
| 186 | nested_empty_dict = {'k1': {'k2': {}}} |
|
| 187 | ||
| 188 | @ex.automain |
|
| 189 | def main(empty_dict=1, nested_empty_dict=2): |
|
| 190 | return empty_dict, nested_empty_dict |
|
| 191 | ||
| 192 | assert ex.run().result == (1, 2) |
|
| 193 | assert ex.run(named_configs=['ncfg']).result == ({}, {'k1': {'k2': {}}}) |
|
| 194 | ||
| 195 | ||
| 196 | def test_named_config_and_ingredient(): |
|