Py-test : quickly run just current test-file, or currently selected test function

I use Pytest for my testing. I set up some basic Run Configurations e.g. to run all tests in my tests folder.

However, I frequently want to just run a single test file (the one I have focus in the editor), or a single test function from a test file (the function whose name I have selected in the editor).

Is there a way to set a keyboard shortcut to simply run that test file (focus) or test function (selected) without all the trouble of setting up a Run Configuration for all the combinations?

Comment actions Permalink
As long as the default test runner is set to py.test under Settings | Python Integrated Tools, you can run the py.test test under cursor by pressing Ctrl-Shift-F10 or by invoking the corresponding run action from the context menu.
Comment actions Permalink
Great! Thank you!

Please sign in to leave a comment.