pytest-odoo icon indicating copy to clipboard operation
pytest-odoo copied to clipboard

Support Odoo 18

Open petrus-v opened this issue 1 year ago • 1 comments

Just open this issue as self remember from fist try

  • In odoo 18 there is a change (https://github.com/odoo/odoo/commit/ccf3c1ed3949f3307909678efe1245aa92ef752f) that expect unit test launcher
                if not result.wasSuccessful() and BaseCase._tests_run_count != 1:
                    _logger.runbot('Disabling auto-retry after a failed test')
                    BaseCase._tests_run_count = 1

wasSuccessful does not exists while launching test using pytest. commenting those lines seems to works as an ungly workaround.

  • Also we get an logging error because configuration seems to be changed a bit late which was introduce by this commit https://github.com/odoo/odoo/commit/1f3a15a7d1f527ab05937810b6a1fb60c22ff455#diff-80aef099e5fb41cc09e699d35b749152aca50caf5b0bc16c400081c29023fbecR95

  • Also a warning is shown while open registry: `` `/.venv/lib/python3.12/site-packages/pytest_odoo.py:167: DeprecationWarning: Use directly odoo.modules.registry.Registry odoo.registry(db_name)

I (we) needs to spend more time to investigate a bit more and properly fix that some how

petrus-v avatar Oct 15 '24 08:10 petrus-v

  • For the first part of the issue I'm trying make it merge a PR from odoo side to avoid technical debt in this project

    • https://github.com/odoo/odoo/pull/184409
    • https://github.com/OCA/OCB/pull/1262
  • for the 2 other parts #80 avoid logging error/warning

petrus-v avatar Oct 19 '24 13:10 petrus-v

FYI I've found a workaround for the odoo core issue: export ODOO_TEST_FAILURE_RETRIES=-1 -> bypasses the retry stuff.

simahawk avatar Mar 12 '25 08:03 simahawk

FYI I've found a workaround for the odoo core issue: export ODOO_TEST_FAILURE_RETRIES=-1 -> bypasses the retry stuff.

good to know, thanks.

As the PR was rejected I'll try to propose something to properly overwrite things to make it smooth !

@simahawk can I explore that in an other PR or you prefer I carry on this work on the exiting PR #80?

petrus-v avatar Mar 12 '25 14:03 petrus-v

As you prefer. You can create a new PR.

simahawk avatar Mar 12 '25 14:03 simahawk

@simahawk here a new PR https://github.com/camptocamp/pytest-odoo/pull/82 as proposition ready to review to avoid your suggested workaround !

petrus-v avatar Apr 25 '25 12:04 petrus-v

FYI I've found a workaround for the odoo core issue: export ODOO_TEST_FAILURE_RETRIES=-1 -> bypasses the retry stuff.

Doesn't work properly. With that, failing tests are marked as successful

jbaudoux avatar May 08 '25 07:05 jbaudoux

I'm closing this issue all works as been merge (I've probably an issue comming from #82 but I'll create a new issue

petrus-v avatar Jun 18 '25 12:06 petrus-v