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: v18.1.0~955^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F48557%2Fhead;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 --- diff --git a/src/cephadm/tests/fixtures.py b/src/cephadm/tests/fixtures.py index d0f068876c84..b3926f9a9de8 100644 --- a/src/cephadm/tests/fixtures.py +++ b/src/cephadm/tests/fixtures.py @@ -77,8 +77,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(_cephadm.DATA_DIR) fs.create_dir(_cephadm.LOG_DIR) diff --git a/src/cephadm/tox.ini b/src/cephadm/tox.ini index b2a3bf0b924d..80449320ee9c 100644 --- a/src/cephadm/tox.ini +++ b/src/cephadm/tox.ini @@ -34,7 +34,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}