You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
No prompt running memory profiler against pytest #355
Add from memory_profiler import profile to your test file, and @profile to your to-test function.
Then you can use this to test this one file and get output:
Can't share code because it's proprietary, but here's the output:
python -m memory_profiler pytest -sk test_my_code
BTW, mprof run pytest creates a .dat file, and mprof plot --output file.png actually generates a file you can view. You can also use .svg instead of .png
Activity
[-]No prompt running memory profiler agains pytest[/-][+]No prompt running memory profiler against pytest[/+]hackermandh commentedon Dec 12, 2024
OH, IT WORKS!
To test a single test:
Add
from memory_profiler import profileto your test file, and@profileto your to-test function.Then you can use this to test this one file and get output:
Can't share code because it's proprietary, but here's the output:
python -m memory_profiler pytest -sk test_my_codeBTW,
mprof run pytestcreates a.datfile, andmprof plot --output file.pngactually generates a file you can view. You can also use.svginstead of.png