- Notifications
You must be signed in to change notification settings - Fork11.2k
Add comprehensive tests for MemoryUsage extension#7009
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:master
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
codecovbot commentedAug 16, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@## master #7009 +/- ##==========================================+ Coverage 90.68% 90.94% +0.26%========================================== Files 164 164 Lines 12673 12673 Branches 1647 1647 ==========================================+ Hits 11492 11526 +34+ Misses 894 861 -33+ Partials 287 286 -1 |
wRAR commentedAug 16, 2025
Please use pre-commit as documented in the contribution docs. Please don't test internals and private methods, I understand that AI agents generate this when asked for comprehensive tests but we don't need any of this,#7004 (comment) applies here as well. |
wRAR commentedNov 21, 2025
Hello! Can you please tell us if you are still planning to work on this? Thank you! |
Uh oh!
There was an error while loading.Please reload this page.
Summary
This PR introduces a new comprehensive test suite for theMemoryUsage extension in
tests/test_memusage.py,Fixes#7002.Coverage
Extension Initialization
MEMUSAGE_ENABLED = TrueNotConfiguredwhenresourcemodule is unavailableMemory Size Calculation
get_virtual_size()behavior on macOS (bytes) and Linux (KB)resource.getrusage()Signal Handlers
engine_started()with and without memory limitsengine_stopped()ensures tasks are properly stoppedMemory Monitoring
update()correctly updates stats_check_limit()for exceeded/non-exceeded casesNotifications
_send_report()includes engine status and memory infoEdge Cases
Test Quality
unittest.mockfor external deps (resource, email sending, crawler components)pytest.mark.parametrizeResults
Notes
This suite ensures MemoryUsage extension is fully validated, improves confidence in its stability, and aligns with Scrapy’s test patterns.