CFMTech / pytest-monitor

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

fix(79): Ensure tests supposed to fail also fail, when monitoring is disabled (--no-monitor cmd flag) #81

Open lhpt2 opened 4 months ago

lhpt2 commented 4 months ago

Description

There was a bug that resulted in some tests not failing when the cmd flag --no-monitor is set. Raising a BaseException in the corresponding code that runs when monitoring is disabled (line 218 following) solves the issue.

Fixes #79

fix(79): Ensure test supposed to fail also fail, when monitoring is disabled (--no-monitor cmd flag)

changelog updated in this commit too

The issue was an exception not being raised when calling wrapped_function when monitoring is disabled in line 216. The raise is being handled now in the following lines 218ff.

Checklist:

sonarcloud[bot] commented 4 months ago

Quality Gate Failed Quality Gate failed

Failed conditions
30.6% Duplication on New Code (required ≤ 3%)

See analysis details on SonarCloud

lhpt2 commented 4 months ago

I'm not sure what SonarClouds wants to say with DuplicationOnNewCode or how I could resolve that.

lhpt2 commented 2 months ago

The newest commit is a bug fix introduced by the memory_profiler module, which doesn't catch all Exceptions (only checks for Exception not BaseException). Worked around this by returning the exception from the wrapped function. This is only a temporary workaround to make everything work, it should be considered to do it as in PR #82 and replace the whole memory profiler module in some way and fix the issues that way. The bug occurs on test runs and causes them to not finish but block execution from finishing.