def test_main(monkeypatch: pytest.MonkeyPatch) -> None: buf = io.StringIO() monkeypatch.setattr(sys, "stdout", buf) monkeypatch.setattr(update_config.UpdateConfig, "run", lambda self: mock_run()) assert update_config.main([]) == 0 assert "XYZ" in buf.getvalue()
def test_main(monkeypatch): buf = io.StringIO() monkeypatch.setattr(sys, "stdout", buf) monkeypatch.setattr(update_config.UpdateConfig, "run", lambda self: sys.stdout.write("XYZ\n")) assert update_config.main([]) == 0 assert "XYZ" in buf.getvalue()