(monkeypatch)
| 1985 | |
| 1986 | |
| 1987 | def 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 |
nothing calls this directly
no test coverage detected