[ADD] core: checker for methods being set on models during tests#247151
Closed
xmo-odoo wants to merge 1 commit into
Closed
[ADD] core: checker for methods being set on models during tests#247151xmo-odoo wants to merge 1 commit into
xmo-odoo wants to merge 1 commit into
Conversation
Contributor
2bb1462 to
377e7d3
Compare
377e7d3 to
cb39f35
Compare
StefanRijnhart
added a commit
to StefanRijnhart/server-tools
that referenced
this pull request
Feb 19, 2026
StefanRijnhart
added a commit
to StefanRijnhart/server-tools
that referenced
this pull request
Feb 19, 2026
See odoo/odoo#247151 * Register with the patch checker to prevent exhaustive logging ``` odoo odoo.tests.common: /__w/server-tools/server-tools/auditlog/models/rule.py:232:_patch_method setting res.groups.unlink to <function AuditlogRule._make_unlink.<locals>.unlink_full at 0x7fa51ea90f70> ``` * Align model patching with how it's done in base_automation to fully remove patched methods. Fixes OCA#3439 * Dismantle own patch checker. * Ensure no patching takes place in setUpClass.
StefanRijnhart
added a commit
to StefanRijnhart/server-tools
that referenced
this pull request
Feb 19, 2026
StefanRijnhart
added a commit
to StefanRijnhart/server-tools
that referenced
this pull request
Feb 19, 2026
See odoo/odoo#247151 Fixes ``` AssertionError: Found unexpected attributes on res.partner: _default_batch_size ```
StefanRijnhart
added a commit
to StefanRijnhart/server-tools
that referenced
this pull request
Feb 19, 2026
StefanRijnhart
added a commit
to StefanRijnhart/server-tools
that referenced
this pull request
Feb 19, 2026
See odoo/odoo#247151 Fixes ``` AssertionError: Found unexpected attributes on res.partner.category: jsonify_custom ```
StefanRijnhart
added a commit
to StefanRijnhart/server-tools
that referenced
this pull request
Feb 19, 2026
Replace manual monkeypatching with unittest.mock.patch which is not signalled by Odoo's patch checker. See odoo/odoo#247151
StefanRijnhart
added a commit
to StefanRijnhart/server-tools
that referenced
this pull request
Feb 19, 2026
See odoo/odoo#247151 Fixes ``` AssertionError: Found unexpected attributes on res.partner: _default_batch_size ```
StefanRijnhart
added a commit
to StefanRijnhart/server-tools
that referenced
this pull request
Feb 19, 2026
StefanRijnhart
added a commit
to StefanRijnhart/server-tools
that referenced
this pull request
Feb 19, 2026
StefanRijnhart
added a commit
to StefanRijnhart/server-tools
that referenced
this pull request
Feb 19, 2026
See odoo/odoo#247151 Fixes ``` AssertionError: Found unexpected attributes on res.partner.category: jsonify_custom ```
StefanRijnhart
added a commit
to StefanRijnhart/server-tools
that referenced
this pull request
Feb 19, 2026
See odoo/odoo#247151 Fixes ``` AssertionError: Found unexpected attributes on res.partner: _default_batch_size ```
StefanRijnhart
added a commit
to StefanRijnhart/server-tools
that referenced
this pull request
Feb 19, 2026
This was referenced Feb 23, 2026
This was referenced Apr 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Setting methods on models during tests and not removing them afterwards can cause misbehaviour of other tests. Setting mock or test-specific methods is not an issue but it should be done via patchers.
https://runbot.odoo.com/odoo/error/237983