]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: backend unit tests: decouple from build dir 42515/head
authorAlfonso Martínez <almartin@redhat.com>
Wed, 28 Jul 2021 07:51:52 +0000 (09:51 +0200)
committerAlfonso Martínez <almartin@redhat.com>
Wed, 28 Jul 2021 07:51:52 +0000 (09:51 +0200)
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 <almartin@redhat.com>
src/pybind/mgr/dashboard/__init__.py

index d51b9d1d04ac09bea96a3bf6b1eab71ce8952e03..4774893134dd80b240057625f356a654816cfaa7 100644 (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