pytest-odoo
pytest-odoo copied to clipboard
AttributeError with python 3.8.6 - Wrong import way?
When run pytest with odoo12 and python 3.8.6 i get the following error:
@pytest.fixture(scope='session', autouse=True)
def load_registry():
# Initialize the registry before running tests.
# If we don't do that, the modules will be loaded *inside* of the first
# test we run, which would trigger the launch of the postinstall tests
# (because we force 'test_enable' to True and the at end of the loading of
# the registry, the postinstall tests are run when test_enable is enabled).
# And also give wrong timing indications.
# Finally we enable `testing` flag on current thread
# since Odoo sets it when loading test suites.
threading.currentThread().testing = True
odoo.registry(odoo.tests.common.get_db_name())
E AttributeError: module 'odoo' has no attribute 'tests'
env/lib/python3.8/site-packages/pytest_odoo.py:88: AttributeError
Simple fix is to use import odoo.tests instead import odoo
noone have the same error? :/
Is not possible to find module common without explicit import odoo.test as odoo and test are two packages
@samsagaz doesn't ring a bell, but we usually stick to the supported python version of Odoo. For Odoo 12.0 we use Python 3.5 https://github.com/camptocamp/docker-odoo-project/blob/master/12.0/Dockerfile#L19
Nevertheless we use Python 3.7 for Odoo 14.0 https://github.com/camptocamp/docker-odoo-project/blob/master/14.0/Dockerfile#L19
I'll try to find some time this week to have a look at your PR.
@samsagaz doesn't ring a bell, but we usually stick to the supported python version of Odoo. For Odoo 12.0 we use Python 3.5 https://github.com/camptocamp/docker-odoo-project/blob/master/12.0/Dockerfile#L19
Nevertheless we use Python 3.7 for Odoo 14.0 https://github.com/camptocamp/docker-odoo-project/blob/master/14.0/Dockerfile#L19
I'll try to find some time this week to have a look at your PR.
Ok, no problem!