Conditions | 2 |
Total Lines | 13 |
Lines | 0 |
Ratio | 0 % |
1 | from contextlib import contextmanager |
||
9 | def execute_coala(func, binary, *args): |
||
10 | """ |
||
11 | Executes the main function with the given argument string from given module. |
||
12 | |||
13 | :param function: A main function from coala_json, coala_ci module etc. |
||
14 | :param binary: A binary to execute coala test |
||
15 | :return: A tuple holding a return value first and |
||
16 | a stdout output as second element. |
||
17 | """ |
||
18 | sys.argv = [binary] + list(args) |
||
|
|||
19 | with retrieve_stdout() as stdout: |
||
20 | retval = func() |
||
21 | return retval, stdout.getvalue() |
||
22 | |||
49 |