Solve pytest ImportMismatchError
ImportMismatchError or ImportPathMismatchError
Usually looks like:
_pytest.config.ConftestImportFailure: ImportMismatchError('conftest', '/my_project/tests/conftest.py', local('/apis/tests/conftest.py'))
It can be fixed by deleting Python’s cached/compiled files:
find . | grep -E "(__pycache__|\.pyc|\.pyo$)" | xargs rm -rf
To avoid this in the first place, delete those files before including it in a docker container.