How to test `Panel.draw()` implementation?

I am trying to create automated tests for my addon and calculate coverage.
As tests are meant to be automated I run Blender in headless mode (with --background option). Everything seems to work as I expect, however I can’t find a way to invoke draw() method in headless mode.

Currently I would just like to get 100% line coverage (mostly to make sure I don’t have stupid typos in my functions).
A nice extra would be if I could get a “screenshot” of panel saved somewhere.

What would be a proper way to run my draw() without mocking context and self?

Note: this is a clone of my question on blender.stackexchange

It’s not currently possible as far as I know, you’d have to mock that part or not have it covered.