From: John Mulligan Date: Wed, 12 Oct 2022 18:06:40 +0000 (-0400) Subject: cephadm: fix running test suite on python3.6 X-Git-Tag: v17.2.8~507^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a2a75264c5c64f589ee9dc85b46461805ff11a3e;p=ceph.git cephadm: fix running test suite on python3.6 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 (cherry picked from commit b5218528d63ae87ca77229bce1635c62411959e8) --- diff --git a/src/cephadm/tests/fixtures.py b/src/cephadm/tests/fixtures.py index fffab9085f1..1069b3823a7 100644 --- a/src/cephadm/tests/fixtures.py +++ b/src/cephadm/tests/fixtures.py @@ -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) diff --git a/src/cephadm/tox.ini b/src/cephadm/tox.ini index c1d9cf6faf8..75758c06811 100644 --- a/src/cephadm/tox.ini +++ b/src/cephadm/tox.ini @@ -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}