Merge pull request #42515 from rhcs-dashboard/decouple-unit-tests-from-build-dir

mgr/dashboard: backend unit tests: decouple from build dir

Reviewed-by: Waad Alkhoury <walkhour@redhat.com>
Reviewed-by: Alfonso Martínez <almartin@redhat.com>
Reviewed-by: Avan Thakkar <athakkar@redhat.com>
This commit is contained in:
Ernesto Puerta 2021-07-29 14:47:24 +02:00 committed by GitHub
commit 321bf26628
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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