[Python] Getting error ImportMismatchError while running py.test

Discussão em 'Python' iniciado por Stack, Dezembro 7, 2024.

  1. Stack

    Stack Membro Participativo

    When I am running tests locally its working fine, but after creating the docker and running inside the container I am getting below error.

    /usr/local/lib/python3.5/site-packages/_pytest/config.py:325: in _getconftestmodules
    return self._path2confmods[path]
    E KeyError: local('/apis/db/tests')

    During handling of the above exception, another exception occurred:
    /usr/local/lib/python3.5/site-packages/_pytest/config.py:356: in _importconftest
    return self._conftestpath2mod[conftestpath]
    E KeyError: local('/apis/db/tests/conftest.py')

    During handling of the above exception, another exception occurred:
    /usr/local/lib/python3.5/site-packages/_pytest/config.py:362: in _importconftest
    mod = conftestpath.pyimport()
    /usr/local/lib/python3.5/site-packages/py/_path/local.py:680: in pyimport
    raise self.ImportMismatchError(modname, modfile, self)

    _pytest.config.ConftestImportFailure: ImportMismatchError('conftest', '/projects/my_project/db/tests/conftest.py', local('/apis/db/tests/conftest.py'))


    /apis - its the WORKDIR in Dockerfile.

    Continue reading...

Compartilhe esta Página