| 1 | from pytest import MonkeyPatch |
| 2 | |
| 3 | from cyclopts import App, run |
| 4 | |
| 5 | |
| 6 | def test_run(monkeypatch: MonkeyPatch): |
| 7 | def main(input: int) -> int: |
| 8 | return input * 2 |
| 9 | |
| 10 | class TestApp(App): |
| 11 | def __call__(self, tokens=None, **kwargs): |
| 12 | return super().__call__("2", **kwargs) |
| 13 | |
| 14 | monkeypatch.setitem(run.__globals__, "App", TestApp) |
| 15 | |
| 16 | assert run(main, result_action="return_value") == 4 |