From 890f42fafa874023e323b406573ab07ca4a0eeaf Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alfonso=20Mart=C3=ADnez?= Date: Wed, 28 Jul 2021 09:51:52 +0200 Subject: [PATCH] mgr/dashboard: backend unit tests: decouple from build dir MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- src/pybind/mgr/dashboard/__init__.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) 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 -- 2.47.3