Pycharm debugger not working in subprocess which calls behave

Answered

I have a pycharm module which calls the behave command via os.execvp.  When I set breakpoints in the behave files, they don't trigger.  However when I run behave through pycharm, the breakpoints hit.  I am aware of how specific this issue is, but I'm at a loss of what to try.  My coworker has the same setup as me, and executes it fine.

 

Thanks,

Adam

7 comments
Comment actions Permalink

Hi Adam,

Try starting PyCharm with default settings by renaming/removing configuration and plugins folders https://www.jetbrains.com/help/pycharm/directories-used-by-the-ide-to-store-settings-caches-plugins-and-logs.html

Has it helped?

0
Comment actions Permalink

If not, please clarify if you have files named server.py in your project?

0
Comment actions Permalink

I renamed my .PyCharm2019 directory, created a new project and venv from scratch, installed a new copy of behave in that venv, and still having same issue.  There are definitely more than a few modules named server.py in other PycharmProjects, but none in this project or venv.

0
Comment actions Permalink

Could you provide a code sample and steps for reproducing?

0
Comment actions Permalink
  1. Create new project named 'sample'
  2. Create new venv - python 2.7
  3. Install the 'behave' package in venv
  4. Create a directory in sample project named 'src' and mark as 'Source' directory.
  5. Create the the following directory structure under 'src' (* denotes a directory)
  6. Set a breakpoint in tutorial.py file
  7. Run the runIt module in Debug Mode as a regular python file (which calls behave via execvp).

PycharmProjects/sample/src/:
behave_practice*

PycharmProjects/sample/src/behave_practice:
features* __init__.py runIt.py

PycharmProjects/sample/src/behave_practice/features:
tutorial.feature

PycharmProjects/sample/src/behave_practice/features/steps:
tutorial.py

Attached to this are the tutorial.py, tutorial.feature, and runIt.py files to place in the above directories.  The __init__.py is blank

0
Comment actions Permalink

Looks like I can only upload images.  Here's the text contained in each file

-------------src/behave_practice/runIt.py-------------

import os

if __name__ == '__main__':
    os.execvp('PycharmProjects/sample/venv/bin/behave', ['PycharmProjects/sample/src/behave_practice/features/tutorial.feature', '--tags', 'tutor'])

 

-------------src/behave_practice/features/tutorial.feature-------------

Feature: showing off behave

    @tutor
    Scenario: run a simple test
        Given we have behave installed
        When we implement a test
        Then behave will test it for us!

 

-------------src/behave_practice/features/steps/tutorial.py-------------

from behave import given, when, then

@given('we have behave installed')
def step_impl(context):
    print "behave installed"

@when('we implement a test')
def step_impl(context):
    assert True is not False

@then('behave will test it for us!')
def step_impl(context):
    assert context.failed is False

0
Comment actions Permalink

Oh, I see now.

Thank you very much for providing the steps for reproducing! It helped a lot.

Here is a bug report in our tracker https://youtrack.jetbrains.com/issue/PY-37760, please vote for it and follow for updates.

0

Please sign in to leave a comment.