]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: workaround jinja2 package loader issue
authorJohn Mulligan <jmulligan@redhat.com>
Thu, 5 Oct 2023 19:58:22 +0000 (15:58 -0400)
committerJohn Mulligan <jmulligan@redhat.com>
Fri, 3 Nov 2023 22:51:49 +0000 (18:51 -0400)
Signed-off-by: John Mulligan <jmulligan@redhat.com>
src/cephadm/tests/fixtures.py

index f84a2d7ba20517aed90ddafe608abd87aa19b508..86a8c6119ea8a4d27f70f1a2627873af4d3e556b 100644 (file)
@@ -78,6 +78,13 @@ def cephadm_fs(
     """
     from cephadmlib import constants
 
+    # the following is a workaround for the fakefs interfering with jinja2's
+    # package loader when run in the pytest suite when this fixture is used.
+    # it effectively maps what is `src/cephadm` as a real fs into the fake fs.`
+    # See: https://pytest-pyfakefs.readthedocs.io/en/stable/usage.html#access-to-files-in-the-real-file-system
+    srcdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
+    fs.add_real_directory(srcdir)
+
     uid = os.getuid()
     gid = os.getgid()