]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: fix running test suite on python3.6
authorJohn Mulligan <jmulligan@redhat.com>
Wed, 12 Oct 2022 18:06:40 +0000 (14:06 -0400)
committerAfreen <afreen23.git@gmail.com>
Tue, 27 Feb 2024 08:50:49 +0000 (14:20 +0530)
While a new version of pyfakefs is available, version 5 is not available
for python 3.6. In order to run the test suite on centos 8 we will
continue to work with pyfakefs version 4.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
(cherry picked from commit b5218528d63ae87ca77229bce1635c62411959e8)

src/cephadm/tests/fixtures.py
src/cephadm/tox.ini

index fffab9085f18c0190527c0cfe43d146c8eabe20d..1069b3823a7aeef66f7537ca05d9eccc7647d486 100644 (file)
@@ -69,8 +69,11 @@ def cephadm_fs(
          mock.patch('platform.processor', return_value='x86_64'), \
          mock.patch('cephadm.extract_uid_gid', return_value=(uid, gid)):
 
-        if not fake_filesystem.is_root():
-            fake_filesystem.set_uid(0)
+        try:
+            if not fake_filesystem.is_root():
+                fake_filesystem.set_uid(0)
+        except AttributeError:
+            pass
 
         fs.create_dir(cd.DATA_DIR)
         fs.create_dir(cd.LOG_DIR)
index c1d9cf6faf8f143b32ea73ac3c559a7007642a16..75758c068118db338b40d8233d1f38960fc68f49 100644 (file)
@@ -33,7 +33,8 @@ addopts =
 [testenv]
 skip_install=true
 deps =
-  pyfakefs == 5.0
+  pyfakefs == 4.5.6 ; python_version < "3.7"
+  pyfakefs >= 5, < 6 ; python_version >= "3.7"
   mock
   pytest
 commands=pytest {posargs}