pycharm-pytest-imp
pycharm-pytest-imp copied to clipboard
Support pytest node-ids in "search everywhere"
I've no idea if it's even possible to hook into search everywhere, but one of my annoyances with pycharm support of pytest is if you run tests from the CLI (because reasons) and a test fails there's no easy way to go from a nodeid (path/to/file.py::TestClass::test_func) to its ide location.
You can either go to the test failure and get the path/to/file.py:line or use search everywhere and look for the test_func (hopefully you don't reuse function names in different test modules) or converted TestClass.test_func, but you can't just use what pytest literally gives you in the test summary.
As far as I can tell, pytest-imp doesn't support it either, but it would be really cool.
Oooo, that is a very neat idea. I also usually run my tests in a terminal outside PyCharm, because PyCharm is a monstrous beast capable of many, many wonderful things... but timely display and responsive UI are not among them. This would, indeed, be very handy, and I know I've tried copying nodeids into the search – in fact, I know I've tried so many times that I've burned into habit the translation to TestClass.test_func.
This should be possible with a SearchEverywhereContributor
@xmo-odoo When you say run the test via CLI, are you talking about the native PyCharm test runner?
If so, double clicking the test function name on the left will navigate you to the function in the IDE.
When you say run the test via CLI, are you talking about the native PyCharm test runner?
No, when I say "run the test via CLI" I mean "run the test via the CLI (command line interface)" aka via pytest in a terminal. That's why the outcome is nodeids (by default pytest will print the nodeids of the failed tests in its final report), and going from there to the correct symbol inside pycharm is where there's a hitch.