-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Breakpoints with nosetests and pdb/ipdb #5907
Comments
Ideally, it'd be great if one line would work for both cases. For instance, if there's a variable which can be checked if nosetests are running, then we could use an if-else based breakpoint line. Not sure if it is possible (i.e., is there a variable which tells whether running under nose or not?). |
I don't have a nose project to test this but probably adding the So please try adding |
@cpaulik Yep, that fixes it. And actually, probably things work by default. I have explicitly disabled Also, now I'm studying how I could get ipdb to work. Similar problems but doesn't work yet. It should be better than pdb. |
This is weird. If I use
breakpoints, the debugger window doesn't show outputs. I can write commands and they seem to "work" although nothing shows up. That is, I can use EDIT: ipdb works when ran with nosetests from the terminal without Emacs. EDIT: Probably an issue in GUD: http://stackoverflow.com/a/31232014 EDIT: Might work with realgud: realgud/realgud#71 |
My guess would be that the issue is with nose or nose.el since ipdb breakpoints work with py.test. |
@cpaulik Are you using the default gud or realgud or something else as the debugger front-end? I understood that gud doesn't support ipdb so I'd be surprised to hear if ipdb worked with gud if using py.test. But that'd be good to know. |
I'm using out of the box spacemacs. No special debugger backend. Just to make sure that I don't miss any features. By working I mean the following:
|
@cpaulik Btw, are you using ipdb debugger? Do you know, how I could enable it for Spacemacs? I installed ipdb python package but it seems that Spacemacs still uses pdb with pytest. |
@jluttine Do you mean that pytest uses But it should work when you set a breakpoint manually using |
Ok, thanks for the info! |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid! |
In Python mode, one can run nosetests with pdb by using
nosetests-pdb-*
(SPC t
). This works nicely. The default way of setting breakpoints is withpython-toggle-breakpoint
(SPC d b
). However, these breakpoints don't work with nosetests. The default breakpoint is:(See https://github.com/syl20bnr/spacemacs/blob/develop/layers/+lang/python/funcs.el#L24). Having these in the code just freezes nose. With nose, one needs to use:
I'm not an expert here, so probably someone who knows better should comment. But I suppose the first breakpoint style works when executing code normally. The second style works when running unit tests with nose. If this is the case, perhaps we'd need to add a separate breakpoint toggle for (nose)tests? Something like
python-toggle-nose-breakpoint
underSPC d
orSPC t
?Or should this whole matter be discussed in https://github.com/syl20bnr/nose.el?
If we'd add a toggle for the latter breakpoint, perhaps the command should be modified a bit so it wouldn't conflict with possible other
nose
named variables/methods? For instance,import nose.tools as nosepdb; nosepdb.set_trace()
(which would match the current breakpoint highlighting regexp).Any comments? I can try to make a pull request, but I'd like to hear some comments and ideas.
The text was updated successfully, but these errors were encountered: