PYTHON-6140 [Build Failure] TestBSON.test_encode_size_limit MemoryError on Windows - #3092
Conversation
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The focused test-only change matches the stated requirements, with no blocking issues identified; Windows CI verification remains pending.
Review effort: Balanced
Findings: None
What changed in this PR
Prevents low-memory hosts from failing the BSON size-limit test with MemoryError instead of the expected ValueError.
Changes:
- Detect total physical memory on Windows and other supported platforms.
- Skip the affected test below 6 GiB; retain execution when memory is unknown.
| File | Description |
|---|---|
| test/test_bson.py | Adds memory detection and a targeted test skip. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
NoahStapp
left a comment
There was a problem hiding this comment.
Honest question: what if we just stopped testing on any platforms that can't handle this test? Do we know how many users could even encounter this?
If we hard-code an OS, it would still fail in a container. We could try to nail down the conditions, but I think it would be more likely that we accidentally stop testing. What if we just unconditionally catch the |
|
I updated to only do the memory probe on linux. |
PYTHON-6140
Changes in this PR
Skip
TestBSON.test_encode_size_limiton hosts with less than 6GiB of total physical memory. The test needs ~4GiB of peak memory to encode a document that exceeds the BSON size limit, but on 4GBwindows-64-vsMulti-smallhosts the allocations fail withMemoryErrorbefore the expectedValueErroris raised.Test Plan
test_encode_size_limitnow skips on a 4GiB host.Checklist
Checklist for Author
Checklist for Reviewer