Skip to content

Add class-level cursor patching for OOTestCaseWithCursor#184

Open
giscebot wants to merge 2 commits into
masterfrom
issue-183-patch-cursors
Open

Add class-level cursor patching for OOTestCaseWithCursor#184
giscebot wants to merge 2 commits into
masterfrom
issue-183-patch-cursors

Conversation

@giscebot

@giscebot giscebot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add _patch_cursors = False as a class-level option on OOTestCaseWithCursor.
  • When enabled by subclasses, setUp applies PatchNewCursors for every test method and tearDown restores it before closing the transaction.
  • Cover default and enabled behavior with focused unit tests.
  • Keep the new tests compatible with unittest discover on Python 2 and Python 3 by avoiding the external mock import and scoping test_openerp module fakes.

Tests

  • /home/openclaw/projects/gisce-developer/env/with-erp-destral-env /home/openclaw/.pyenv/versions/erp3/bin/python -m unittest discover tests
  • /home/openclaw/projects/gisce-developer/env/with-erp-destral-env /home/openclaw/.pyenv/versions/erp2/bin/python -m unittest discover tests

Closes #183

Co-authored-by: ecarreras <294235+ecarreras@users.noreply.github.com>
Avoid importing mock in the new OOTestCaseWithCursor tests and keep test_openerp module fakes scoped so unittest discovery works across Python 2 and 3.

Co-authored-by: ecarreras <294235+ecarreras@users.noreply.github.com>
@ecarreras ecarreras requested a review from polsala June 11, 2026 16:15
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.

Propietat de _patch_cursors al OOTestCaseWithCursor

1 participant