Skip to content

Commit

Permalink
Print working directory with --debug
Browse files Browse the repository at this point in the history
  • Loading branch information
retr0h committed Nov 17, 2016
1 parent 15917c3 commit eb4ad0c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion gilt/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,10 @@ def run_command(cmd, debug=False):
:param debug: An optional bool to toggle debug output.
:return: None
"""
msg = ' COMMAND: {}'.format(cmd)
if debug:
msg = ' PWD: {}'.format(os.getcwd())
print_warn(msg)
msg = ' COMMAND: {}'.format(cmd)
print_warn(msg)
cmd()

Expand Down
4 changes: 3 additions & 1 deletion test/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,15 @@ def test_run_command(capsys):
assert '' == result


def test_run_command_with_debug(capsys):
def test_run_command_with_debug(temp_dir, capsys):
cmd = sh.git.bake(version=True)
util.run_command(cmd, debug=True)

result, _ = capsys.readouterr()
x = 'COMMAND: {} --version'.format(sh.git)
assert x in result
x = 'PWD: {}'.format(temp_dir)
assert x in result


def test_saved_cwd_contextmanager(temp_dir):
Expand Down

0 comments on commit eb4ad0c

Please sign in to comment.