Skip to content

Commit

Permalink
add test for debug with file input
Browse files Browse the repository at this point in the history
  • Loading branch information
aktech committed Oct 17, 2023
1 parent 6affffb commit 4e2a333
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/test_cmdline.py
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,27 @@ def test_tidy_imports_symlinks_bad_argument():
assert symlink_output == input


def test_debug_filetype_with_py():
with tempfile.NamedTemporaryFile(suffix=".py", mode='w+') as f:
f.write(dedent("""
sys.argv
""").lstrip())
f.flush()
command = [BIN_DIR+"/py", "--debug", f.name]

output_result = b""
child = pexpect.spawn(' '.join(command), timeout=5)
child.expect('ipdb>')
output_result += child.before
child.sendline('c')
output_result += child.before
child.expect(pexpect.EOF)
output_result += child.before

expected = "Entering debugger. Use 'n' to step, 'c' to run, 'q' to stop."
assert expected in output_result.decode()


def test_tidy_imports_sorting():
with tempfile.NamedTemporaryFile(suffix=".py", mode='w+') as f:
f.write(dedent("""
Expand Down

0 comments on commit 4e2a333

Please sign in to comment.