MCPcopy Index your code
hub / github.com/dbcli/pgcli / test_logfile_works

Function test_logfile_works

tests/test_main.py:373–383  ·  view source on GitHub ↗
(executor)

Source from the content-addressed store, hash-verified

371
372@dbtest
373def test_logfile_works(executor):
374 with tempfile.TemporaryDirectory() as tmpdir:
375 log_file = f"{tmpdir}/tempfile.log"
376 cli = PGCli(pgexecute=executor, log_file=log_file)
377 statement = r"\qecho hello!"
378 cli.execute_command(statement)
379 with open(log_file, "r") as f:
380 log_contents = f.readlines()
381 assert datetime.datetime.fromisoformat(log_contents[0].strip())
382 assert log_contents[1].strip() == r"\qecho hello!"
383 assert log_contents[2].strip() == "hello!"
384
385
386@dbtest

Callers

nothing calls this directly

Calls 2

execute_commandMethod · 0.95
PGCliClass · 0.90

Tested by

no test coverage detected