Skip to content

Commit 107b1ac

Browse files
committed
test getting logs from inside the command
1 parent 0dc3fa4 commit 107b1ac

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

paths_cli/cli.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,6 @@ def main(log):
145145

146146
logger = logging.getLogger(__name__)
147147
logger.debug("About to run command") # TODO: maybe log invocation?
148-
pass
149148

150149
if __name__ == '__main__': # no-cov
151150
cli()

paths_cli/tests/null_command.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
import logging
12
import click
23
@click.command(
34
'null-command',
45
short_help="Do nothing (testing)"
56
)
67
def null_command():
7-
print("Running null command")
8+
logger = logging.getLogger(__name__)
9+
logger.info("Running null command")
810

911
CLI = null_command
1012
SECTION = "Workflow"

paths_cli/tests/test_cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def test_main_log(with_log):
4646
}[with_log]
4747
expected = {
4848
True: logged_stdout + cmd_stdout,
49-
False: cmd_stdout
49+
False: ""
5050
}[with_log]
5151
with runner.isolated_filesystem():
5252
with open("logging.conf", mode='w') as log_conf:

0 commit comments

Comments
 (0)