Я пытаюсь вызвать модуль на несколько уровней выше каталога запуска Pytest. Как мне импортировать этот модуль?
Я пробовал:
sys.path.insert(0, 'path/to/module')
import modulename
Вот структура каталогов:
tools
common
modulename.py (contains class A)
functional_test (this is where I'm running pytest; tools/functional_test)
conftest.py
pytest.ini
tests
typea (this is tools/funtional_tests/tests/typea)
tests_typea1.py
Under tests_typea1.py, I want to import class A from modulename.py under tools/common.
Получение следующих ошибок:
ImportError
ModuleNotFoundError: No module named 'modulename'