CFMTech / pytest-monitor

Pytest plugin for analyzing resource usage during test sessions
MIT License
173 stars 16 forks source link

Feature #65: track metrics of failed tests #82

Open lhpt2 opened 2 months ago

lhpt2 commented 2 months ago

Description

Fixes issue #65 .

DEPENDS ON: #79 (#80), https://github.com/CFMTech/pytest-monitor/pull/78

Several people asked for support of pytest-monitor also monitoring failing tests. This PR includes the necessary changes for this feature.

Changes made in overview:

The memory profiler change

In order to get the memory usage of failing functions, the memory_profiler module had to be changed. The first approach was to make a PR on the memory_profiler project, this was marked as unmaintained though.

My options were to 1) use another profiler instead or 2) just simplify the profiler logic and include it in the pytest-monitor plugin itself.

I went with the second option in order to avoid big dependencies like Xray which furthermore would have needed socket based communication. This is why I introduced a new module profiler.py into the codebase being responsible for memory profiling (by making use of Process class and psutils).

Type of change

Checklist:

@js-dieu I decided to propose my changes independent on what the original plans were, maybe it is of help, maybe not. However, this is my take on the issue.