Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with pytest version 8 #64

Open
xavier-bouquiaux opened this issue May 2, 2024 · 1 comment
Open

Problem with pytest version 8 #64

xavier-bouquiaux opened this issue May 2, 2024 · 1 comment

Comments

@xavier-bouquiaux
Copy link

xavier-bouquiaux commented May 2, 2024

Here is the stack-trace i get when trying to run a test with pytest version 8

`

pytest --odoo-database ------ odoo/addons/xxx_mrp_machine_cycle/tests
===================================================================================================================================================================== test session starts ======================================================================================================================================================================
platform linux -- Python 3.11.2, pytest-8.2.0, pluggy-1.5.0
rootdir: ------
configfile: pyproject.toml
plugins: anyio-4.3.0, odoo-1.0.0, cov-4.1.0
collected 0 items / 1 error                                                                                                                                                                                                                                                                                                                                    

============================================================================================================================================================================ ERRORS ============================================================================================================================================================================
______________________________________________________________________________________________________________________________________ ERROR collecting odoo/addons/xxx_mrp_machine_cycle/tests/test_mrp_machine_cycle.py ______________________________________________________________________________________________________________________________________
../../.pyenv/versions/3.11.2/lib/python3.11/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1206: in _gcd_import
    ???
<frozen importlib._bootstrap>:1178: in _find_and_load
    ???
<frozen importlib._bootstrap>:1128: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:241: in _call_with_frames_removed
    ???
<frozen importlib._bootstrap>:1206: in _gcd_import
    ???
<frozen importlib._bootstrap>:1178: in _find_and_load
    ???
<frozen importlib._bootstrap>:1128: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:241: in _call_with_frames_removed
    ???
<frozen importlib._bootstrap>:1206: in _gcd_import
    ???
<frozen importlib._bootstrap>:1178: in _find_and_load
    ???
<frozen importlib._bootstrap>:1149: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:690: in _load_unlocked
    ???
<frozen importlib._bootstrap_external>:940: in exec_module
    ???
<frozen importlib._bootstrap>:241: in _call_with_frames_removed
    ???
odoo/addons/xxx_mrp_machine_cycle/__init__.py:1: in <module>
    from . import models
odoo/addons/xxx_mrp_machine_cycle/models/__init__.py:1: in <module>
    from . import mrp_machine_cycle
odoo/addons/xxx_mrp_machine_cycle/models/mrp_machine_cycle.py:10: in <module>
    class MrpMachineCycle(models.Model):
../../.virtualenvs/odoo----/lib/python3.11/site-packages/odoo/models.py:152: in __new__
    assert module.startswith('odoo.addons.'), \
E   AssertionError: Invalid import of xxx_mrp_machine_cycle.models.mrp_machine_cycle.MrpMachineCycle, it should start with 'odoo.addons'.
=================================================================================================================================================================== short test summary info ====================================================================================================================================================================
ERROR odoo/addons/xxx_mrp_machine_cycle/tests/test_mrp_machine_cycle.py - AssertionError: Invalid import of xxx_mrp_machine_cycle.models.mrp_machine_cycle.MrpMachineCycle, it should start with 'odoo.addons'.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
======================================================================================================================================================================= 1 error in 0.33s =======================================================================================================================================================================

`

when downgrading to pytest version 7 -> it works

@sbidoul

@micdahl
Copy link

micdahl commented May 3, 2024

Hi @xavier-bouquiaux. I have just uploaded a pull request with pytest 8 support: #66. Feel free to try.

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

No branches or pull requests

2 participants