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

AttributeError with python 3.8.6 - Wrong import way? #35

Open
samsagaz opened this issue Dec 3, 2020 · 4 comments
Open

AttributeError with python 3.8.6 - Wrong import way? #35

samsagaz opened this issue Dec 3, 2020 · 4 comments

Comments

@samsagaz
Copy link
Contributor

samsagaz commented Dec 3, 2020

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

@samsagaz
Copy link
Contributor Author

samsagaz commented Dec 3, 2020

Simple fix is to use import odoo.tests instead import odoo

@samsagaz samsagaz changed the title AttributeError with python 3.8.6 AttributeError with python 3.8.6 - Wrong import way? Dec 3, 2020
@samsagaz
Copy link
Contributor Author

samsagaz commented Dec 11, 2020

noone have the same error? :/

Is not possible to find module common without explicit import odoo.test as odoo and test are two packages

@yvaucher
Copy link
Member

@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
Copy link
Contributor Author

@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!

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