Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for unittests (via pytest) #39

Open
stas00 opened this issue May 3, 2021 · 9 comments
Open

add support for unittests (via pytest) #39

stas00 opened this issue May 3, 2021 · 9 comments
Assignees
Labels
documentation Improvements or additions to documentation enhancement New feature or request help wanted Extra attention is needed

Comments

@stas00
Copy link
Contributor

stas00 commented May 3, 2021

As discussed here #38 pytest almost fully supports unittest, but currently pytest-monitor skips all unittest-based tests.

I originally proposed to document this, but it was suggested that perhaps this can be fixed and pytest-monitor could support unittest-based tests too, which would be awesome.

So as suggested opening this Issue to track the feasibility/progress on this front.

@js-dieu
Copy link
Collaborator

js-dieu commented May 3, 2021

Thanks for the suggestion.

As stated in the PR #38 I need to understand both sequence and objects that lies beneath. I'll put details about that here for clarity's sake.

@js-dieu js-dieu self-assigned this May 3, 2021
@js-dieu js-dieu added documentation Improvements or additions to documentation enhancement New feature or request labels May 3, 2021
@dremdem
Copy link

dremdem commented May 12, 2021

As discussed here #38 pytest almost fully supports unittest, but currently pytest-monitor skips all unittest-based tests.

I originally proposed to document this, but it was suggested that perhaps this can be fixed and pytest-monitor could support unittest-based tests too, which would be awesome.

So as suggested opening this Issue to track the feasibility/progress on this front.

Will be waiting for unittest support ;)

@js-dieu
Copy link
Collaborator

js-dieu commented May 12, 2021

Hello

I've been more busy than expected but I have been able to made some progress.
It does not seem feasible to "inject" the probing system of pytest-monitor for unittest function/classes (The probe relies on Generic Test item with standard testing protocol).

However, I've found an interesting way of injection that seems promising. I'll try to dig in the next days.

@js-dieu
Copy link
Collaborator

js-dieu commented May 25, 2021

Hello @dremdem @stas00

I managed to intercept the test function for each unittest. I can obtain measures which seems fine.
I am actually a bit stuck for reporting these measures since I have no access to the session. I tried to use hook reports, but I am unsuccessful so far.
I have other ideas to manage my way through the unittest protocol but it seems hacky.

Keep you posted.

@js-dieu js-dieu added the help wanted Extra attention is needed label Aug 8, 2021
@ChaoticRoman
Copy link

Dear @js-dieu,

thank you for the great plugin! Would you mind to share your progress in a branch? This feature would help me a lot and maybe I can help with the progress.

Regards

Roman

@ChaoticRoman
Copy link

Follow up: It is working here outside of the pytest-monitor:

https://github.com/ChaoticRoman/pytest-monitor-example/blob/custom_memory_profiler/unittestit.py

@js-dieu
Copy link
Collaborator

js-dieu commented Apr 24, 2022

Hello @ChaoticRoman

I unfortunately lost the development after entering an erroneous command. That being said, I might be able to recode what I did, though your snippet is neat for starting it again. Keep you posted!

@ChaoticRoman
Copy link

Bloomberg guys just released this: https://github.com/bloomberg/memray

Will check it out and let you know.

@ChaoticRoman
Copy link

Memray and pytest-memray looks cool but have this exactly same issue, reported: bloomberg/pytest-memray#6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants