From: Alfonso Martínez Date: Wed, 28 Jul 2021 07:51:52 +0000 (+0200) Subject: mgr/dashboard: backend unit tests: decouple from build dir X-Git-Tag: v17.1.0~1258^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F42515%2Fhead;p=ceph.git mgr/dashboard: backend unit tests: decouple from build dir After https://github.com/ceph/ceph/pull/42255 some unit tests got coupled to the frontend folder of the build dir. Backend unit tests do not need a build folder: they only test our business logic. Signed-off-by: Alfonso Martínez --- diff --git a/src/pybind/mgr/dashboard/__init__.py b/src/pybind/mgr/dashboard/__init__.py index d51b9d1d04ac..4774893134dd 100644 --- a/src/pybind/mgr/dashboard/__init__.py +++ b/src/pybind/mgr/dashboard/__init__.py @@ -37,9 +37,6 @@ else: import logging logging.basicConfig(level=logging.DEBUG) logging.root.handlers[0].setLevel(logging.DEBUG) - build_dir = os.path.abspath('../../../../build') - os.environ['PATH'] = '{}:{}'.format(os.path.join(build_dir, 'bin'), - os.environ['PATH']) import sys # Used to allow the running of a tox-based yml doc generator from the dashboard directory @@ -49,10 +46,9 @@ else: from tests import mock # type: ignore mgr = mock.Mock() - mgr.get_frontend_path.side_effect = \ - lambda: os.path.join(build_dir, - 'src/pybind/mgr/dashboard', - 'frontend/dist') + mgr.get_frontend_path.return_value = os.path.abspath(os.path.join( + os.path.dirname(__file__), + 'frontend/dist')) # DO NOT REMOVE: required for ceph-mgr to load a module from .module import Module, StandbyModule # noqa: F401