Skip to content

[18.0][FIX] auditlog: Ensure unit tests unpatch methods. - #3389

Closed
amh-mw wants to merge 1 commit into
OCA:18.0from
amh-mw:18.0-test-contamination
Closed

amh-mw wants to merge 1 commit into
OCA:18.0from
amh-mw:18.0-test-contamination

Conversation

@amh-mw

@amh-mw amh-mw commented Sep 24, 2025

Copy link
Copy Markdown
Member

Though TransactionCase rolls back database changes, it does not call unlink on auditlog.rule records, meaning that unsubscribe is never called to unpatch model methods. This causes subsequent tests in other modules to unexpectedly execute patched methods.

This commit adds the AuditLogRuleCommon test class in an attempt to identify and prevent patched methods from contaminating the test environment.

Forward port of 16.0 #3364

Comment thread auditlog/tests/test_auditlog.py Outdated
Comment thread auditlog/tests/test_auditlog.py Outdated
Comment thread auditlog/tests/test_auditlog.py Outdated
@StefanRijnhart

Copy link
Copy Markdown
Member

BTW your review on #3371 would be much appreciated.

Though TransactionCase rolls back database changes, it does not
call `unlink` on `auditlog.rule` records, meaning that `unsubscribe`
is never called to unpatch model methods. This causes subsequent
tests in other modules to unexpectedly execute patched methods.

This commit adds the `AuditLogRuleCommon` test class in an
attempt to identify and prevent patched methods from contaminating
the test environment.
@amh-mw
amh-mw force-pushed the 18.0-test-contamination branch from 8a9caf7 to 675ffa7 Compare September 24, 2025 21:10

@StefanRijnhart StefanRijnhart left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@StefanRijnhart

Copy link
Copy Markdown
Member

Merged with #3374.

@amh-mw
amh-mw deleted the 18.0-test-contamination branch October 1, 2025 12:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants