Properly mock cpu_affinity on all unit tests

Two unit tests (test_cont_run_args_validation_true and
test_cont_run_args_validation_false) relied on the machine running
the tests having 8 CPUs. This is not always the case, so let's mock
it, just like we do on tests expecting 4 CPUs.

Change-Id: I98d930d9c7a1a2d54863749d08b97fc9e8867a0e
This commit is contained in:
Javier Pena 2019-10-02 10:02:41 +02:00
parent 54fc78cf31
commit 2af0996fa1
1 changed files with 6 additions and 2 deletions

View File

@ -73,8 +73,10 @@ class TestPodmanBuilder(base.TestBaseBuilder):
cmd
)
@mock.patch("psutil.Process.cpu_affinity",
return_value=[0, 1, 2, 3, 4, 5, 6, 7])
@mock.patch('paunch.runner.PodmanRunner', autospec=True)
def test_cont_run_args_validation_true(self, runner):
def test_cont_run_args_validation_true(self, runner, mock_cpu):
config = {
'one': {
'image': 'foo',
@ -93,8 +95,10 @@ class TestPodmanBuilder(base.TestBaseBuilder):
cmd
)
@mock.patch("psutil.Process.cpu_affinity",
return_value=[0, 1, 2, 3, 4, 5, 6, 7])
@mock.patch('paunch.runner.PodmanRunner', autospec=True)
def test_cont_run_args_validation_false(self, runner):
def test_cont_run_args_validation_false(self, runner, mock_cpu):
config = {
'one': {
'image': 'foo',