From ade1d530a6a70b86b49574fcb666d19cec07d8e1 Mon Sep 17 00:00:00 2001 From: Jan Fajerski Date: Fri, 22 Nov 2019 11:09:22 +0100 Subject: [PATCH] ceph-volume: fix test test_selinuxenabled_doesnt_exist Popen does not open a shell by default, so A FileNotFoundError is raised instead of returning a 127 return code. Signed-off-by: Jan Fajerski (cherry picked from commit af30c7f956380beb3bc4021d60b9229a82bda4e2) --- src/ceph-volume/ceph_volume/tests/util/test_system.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ceph-volume/ceph_volume/tests/util/test_system.py b/src/ceph-volume/ceph_volume/tests/util/test_system.py index 808048a6a9c05..ab4431295791e 100644 --- a/src/ceph-volume/ceph_volume/tests/util/test_system.py +++ b/src/ceph-volume/ceph_volume/tests/util/test_system.py @@ -4,6 +4,7 @@ import getpass import pytest from textwrap import dedent from ceph_volume.util import system +from mock.mock import patch class TestMkdirP(object): @@ -260,8 +261,9 @@ class TestSetContext(object): system.set_context('/tmp/foo') assert len(fake_run.calls) - def test_selinuxenabled_doesnt_exist(self, stub_call, fake_run): - stub_call(('', 'command not found: selinuxenabled', 127)) + @patch('ceph_volume.process.call') + def test_selinuxenabled_doesnt_exist(self, mocked_call, fake_run): + mocked_call.side_effect = FileNotFoundError() system.set_context('/tmp/foo') assert fake_run.calls == [] -- 2.39.5