ci: when running pytest, make sure that 'import yunohost' will load the code being tested, not the one from /usr/lib/python3/dist-packages ?

This commit is contained in:
Alexandre Aubin 2024-08-14 13:19:46 +02:00
parent fd040b864e
commit 0bbc14f54b

View file

@ -68,10 +68,13 @@ moulinette.core.Translator.translate = new_translate
def pytest_cmdline_main(config):
import sys
from pathlib import Path
# Tweak python path such that "import yunohost" imports "this" code and not the one from /usr/lib/python3/dist-packages
code_root = str(Path(__file__).parent.parent.parent)
sys.path.insert(0, code_root)
sys.path.insert(0, "/usr/lib/moulinette/")
import yunohost
yunohost.init()
class DummyInterface: