theY4Kman / pycharm-pytest-imp

PyCharm pytest improvements plugin
https://plugins.jetbrains.com/plugin/14202-pytest-imp/
17 stars 2 forks source link

Support for pyproject.toml #5

Closed radeklat closed 3 years ago

radeklat commented 3 years ago

pytest support configuration from pyproject.toml file instead of pytest.ini file since version 6.0. Would you please consider adding support for this file format?

Many tools around Python now allow using pyproject.toml because there is then just one configuration file in the repository. So I think this trend will only continue and it will be more common in the future. Thank you.

theY4Kman commented 3 years ago

That's a great idea! I just added support for reading the tools.pytest.ini_options of a pyproject.toml file. Just configure the path to the pyproject.toml in the settings, and you're good to go :)

image

I published it to the marketplace as version 0.4. It should be available in a day or two, pending JetBrains approval.

Thanks again for the suggestion!

theY4Kman commented 3 years ago

Holy crap, they approved it in record time – only 3 hours after submitting it! It should now be available within the Plugins section.

Oh, also, I forgot to mention: in the new build, I added support for the 2021.1 EAP

umutseven92 commented 3 years ago

@theY4Kman Thank you for the quick response, this is awesome!

radeklat commented 3 years ago

@theY4Kman amazing! Thank you for implementing is so quickly :heart:

radeklat commented 3 years ago

@theY4Kman, @umutseven92 and I both tried the new feature and it doesn't recognize test function names when we use the pyproject.toml file. The file contains:

[tool.pytest.ini_options]
testpaths = "tests/unit tests/integration"
python_functions = "should_*"

but test functions starting with should_ are no longer runnable. It does work with the pytest.ini file though.

theY4Kman commented 3 years ago

Oof, you're quite right; that's embarrassing. The functionality worked perfectly during testing, when launching the plugin from gradle... but it definitely does not work when used from the stable channel :(

pycharm-imp-works-in-ide

pycharm-imp-no-worky-from-stable-channel

Honestly, I had no idea one could put pytest config into pyproject.toml until y'all opened this ticket. Since I use poetry for all my personal projects (which uses pyproject.toml), I'd love to kill an extra config file. So I want this feature just as well :P Lemme figure out what the hell is going on.

theY4Kman commented 3 years ago

Oh my god, I'm an idiot. Of course it doesn't work. I typoed the name of the pyproject.toml section: https://github.com/theY4Kman/pycharm-pytest-imp/blob/3a8159ab3fd8919f8a21b0a643d9ae354d09eb64/src/main/java/com/y4kstudios/pytestimp/PyTestImpService.kt#L164

I wrote

tools.pytest.ini_options

Instead of the correct

tool.pytest.ini_options

Oy gevalt.

theY4Kman commented 3 years ago

Man, double embarrassing.

image

I'll push out a fix in 0.4.1 here shortly

theY4Kman commented 3 years ago

Okay, it's been submitted image

umutseven92 commented 3 years ago

@theY4Kman Awesome, thank you for the quick response- can't wait!

theY4Kman commented 3 years ago

Yes, my quick response of 9 days ;)

FYI: I published the plugin .zip to the 0.4.1 GitHub Release, which you can download and install manually to the IDE, if you wish to try it out sooner: https://github.com/theY4Kman/pycharm-pytest-imp/releases/download/0.4.1/pytest.imp-0.4.1.zip

umutseven92 commented 3 years ago

In open source world, that is lightning fast :)

radeklat commented 3 years ago

@theY4Kman Thanks for the fix. I agree with @umutseven92, I also consider it very fast :D I just checked and it works correctly now :) Typos happen. If I had to count the number of times I was even looking at a diff and could not spot it :roll_eyes: