MCPcopy Index your code
hub / github.com/dbcli/mycli / invoke_click_batch

Function invoke_click_batch

test/pytests/test_main_modes_batch.py:172–190  ·  view source on GitHub ↗
(
    runner: CliRunner,
    mycli_main,
    contents: str,
    args: list[str] | None = None,
)

Source from the content-addressed store, hash-verified

170
171
172def invoke_click_batch(
173 runner: CliRunner,
174 mycli_main,
175 contents: str,
176 args: list[str] | None = None,
177):
178 with NamedTemporaryFile(prefix=TEMPFILE_PREFIX, mode='w', delete=False) as batch_file:
179 batch_file.write(contents)
180 batch_file.flush()
181
182 try:
183 result = runner.invoke(
184 mycli_main.click_entrypoint,
185 args=['--batch', batch_file.name] + (args or []),
186 )
187 return result, batch_file.name
188 finally:
189 if os.path.exists(batch_file.name):
190 os.remove(batch_file.name)
191
192
193def write_batch_file(tmp_path: Path, contents: str) -> str:

Calls 2

flushMethod · 0.80
writeMethod · 0.45

Tested by

no test coverage detected