MCPcopy Create free account
hub / github.com/dbcli/mycli / test_execute_arg_supersedes_batch_file

Function test_execute_arg_supersedes_batch_file

test/pytests/test_main.py:1987–2005  ·  view source on GitHub ↗
(monkeypatch)

Source from the content-addressed store, hash-verified

1985
1986
1987def test_execute_arg_supersedes_batch_file(monkeypatch):
1988 mycli_main, mycli_main_batch, MockMyCli = noninteractive_mock_mycli(monkeypatch)
1989 runner = CliRunner()
1990
1991 with NamedTemporaryFile(prefix=TEMPFILE_PREFIX, mode='w', delete=False) as batch_file:
1992 batch_file.write('select 2;\n')
1993 batch_file.flush()
1994
1995 try:
1996 result = runner.invoke(
1997 mycli_main.click_entrypoint,
1998 args=['--execute', 'select 1;', '--batch', batch_file.name],
1999 )
2000 # this exit_code is as written currently, but a debatable choice,
2001 # since there was a warning
2002 assert result.exit_code == 0
2003 assert MockMyCli.ran_queries == ['select 1;']
2004 finally:
2005 os.remove(batch_file.name)
2006
2007
2008@dbtest

Callers

nothing calls this directly

Calls 3

flushMethod · 0.80
writeMethod · 0.45

Tested by

no test coverage detected