Wiki

Clone wiki

pytest-pydev / Home

pytest-pydev

This is a py.test plugin to connect to a remote debug server with PyDev or PyCharm.

With this plugin you can start a Python debug server on your local machine (say on port 8042) and your unittests on another.

Howto

We will assume that your local machine (where your IDE is running) has IP address 10.0.0.1.

Got to Run > Edit Configurations..., click on the big green plus (+) button and select Python Remote Debug. In the subsequent dialogue, you would fill in the following values:

Python remote debug configuration

It's also useful to setup path mappings to tell PyCharm were a file from the remote system can be found locally. This is very useful if you want to set a breakpoint.

path mappings

Got to your remote server and run your tests.

$ py.test --pydevd=10.0.0.1:8042

If it says

Starting debug server at port 8042
Waiting for connection...
Connected to pydev debugger (build 111.107)

in your IDE debug console, you're done.

If it complains about a wrong debugger version, you copy the file pycharm-debugger.egg from PyCharm's root directory to your server, e.g in folder /home/jasper. Then use

$ py.test --pydevd=10.0.0.1:8042 --pydev-lib=/home/jasper/pycharm-debug.egg

Download and Installation

You can install the plugin by running

$ pip install pytest-pydev

License and Credits

This plugin is released under the MIT license. You can find the full text of the license in the LICENSE file.

Copyright (C) 2012 Sebastian Rahlf <basti at redtoad dot de>

Updated