Skip to content

Instantly share code, notes, and snippets.

@oivvio
Last active April 23, 2018 08:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oivvio/d4fa79dc6bf34bf6ab7197d34a309ed2 to your computer and use it in GitHub Desktop.
Save oivvio/d4fa79dc6bf34bf6ab7197d34a309ed2 to your computer and use it in GitHub Desktop.
Backspace does not work in nosetests/pdb when run with invoke

Backspace does not work in nosetests/pdb when run with invoke

I'm using python 3.6.5 on Ubuntu 18.04

I've created a virtualenviroment with the packages in requirements.txt.

I have a function to unittest in lib.py that drops into pdb.

When I start my unittest from the cli directly with nosetests --nocapture the pdb session works as expected.

When I start my unittest with invoke test I get dropped into the pdb session as expected but then I can't use the backspace/delete key, which makes for a rather poor pdb experience.

def myadd(a, b):
print("Now when we drop into pdb, backspace will not work")
import pdb
pdb.set_trace()
return a + b
invoke==0.22.1
nose==1.3.7
from invoke import task
@task
def test(ctx, pty=True):
""" Run a unit test """
cmd = "nosetests --nocapture"
print(cmd)
ctx.run(cmd)
from lib import myadd
def test_myadd():
assert myadd(1,1) == 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment