smarie / python-pytest-harvest

Store data created during your `pytest` tests execution, and retrieve it at the end of the session, e.g. for applicative benchmarking purposes.
https://smarie.github.io/python-pytest-harvest/
BSD 3-Clause "New" or "Revised" License
61 stars 8 forks source link

How to debug? #29

Closed humbienri closed 4 years ago

humbienri commented 4 years ago

Hello,

Thank you for the time and effort you've invested into this project. It's appreciated!

Seems like a silly question but I really am struggling on how to debug usage of your plugin? I am using PyCharm and have a very small with 3 or 4 tests. Mind you they are all variations of the same test since I am very much in "figuring it out" mode. So I just mark 3 of those 4 tests with the "skip" decorator, appended your test_synthesis code to the end of my 1 module where I have the 1 test and 1 fixture function that gets used by the test to get a list of values/names from an SQL db call. Pretty basic to me but I can't seem to figure out how to get my debugging session to run the parametrized test, with the sql call fixture function, and then run/snag/debug on the test_synthesis method so that I can inspect the get_session_synthesis_dct object.

Any hints or thoughts?

humbienri commented 4 years ago

Disregard. Feeling dumb now.

I was using the wrong Configuration in PyCharm. Of course it worked a few minutes after I posted this...yet after spending hours frustrated with this.

Again, thank you for this handy little plugin! I can't believe this is not easier from w/i pytest itself.

smarie commented 4 years ago

Thanks @humbienri for the feedback ! I totally understand, this looks like the classic developper's curse :)

I can't believe this is not easier from w/i pytest itself.

Well, pytest unfortunately has to stop at some point, and they decided to rather leave this kind of feature outside of their scope. Fortunately, they provide everything that I needed to do this (public api + plugin api) so that was relatively easy. The hardest part was to support all versions of pytest since pytest 2, as their api changed quite a bit.