(executor)
| 371 | |
| 372 | @dbtest |
| 373 | def 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 |
nothing calls this directly
no test coverage detected