CFMTech / pytest-monitor

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

Avoid AttributeError for monitor_results on teardown #51

Closed altendky closed 2 years ago

altendky commented 2 years ago

Description

This is a naive resolution to https://github.com/CFMTech/pytest-monitor/issues/50. It may not really make sense but it does seem to avoid the exception by using getattr(request.node, "monitor_results", False) to both avoid the attribute error and to avoid running the rest of the code in this unexpected scenario.

This is primarily being shared as a reference point. If you see other things that should be done feel free let me know, replace this with another PR, or just push changes here.

Fixes #50

Type of change

Checklist:

js-dieu commented 2 years ago

Hello @altendky

I agree with your tactical change, but you need to update your branch so that previous changes are taken into account. Thanks!

sonarcloud[bot] commented 2 years ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

altendky commented 2 years ago

Catch up merge complete. Test added and confirmed to fail without the change.

js-dieu commented 2 years ago

Great job @altendky ! 👍🏻