From efc0166793db58e08b57ba3839638f7571355b93 Mon Sep 17 00:00:00 2001 From: Davide Cavalca Date: Wed, 30 Dec 2020 10:35:50 -0800 Subject: [PATCH] tests: fix Popen mock --- tests/test_util.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/test_util.py b/tests/test_util.py index 13a1e43..b7748a5 100644 --- a/tests/test_util.py +++ b/tests/test_util.py @@ -86,7 +86,7 @@ def test_call_with_timeout_real_raises(self): def test_run_with_timeout_success(self): # type: () -> None ( - self.mock_callable(subprocess, "Popen") + self.mock_constructor(subprocess, "Popen") .for_call( ["/bin/true"], stdout=subprocess.PIPE, @@ -103,7 +103,7 @@ def test_run_with_timeout_timeout(self): # type: () -> None mock_popen = make_mock_popen(communicate_raise=True) ( - self.mock_callable(subprocess, "Popen") + self.mock_constructor(subprocess, "Popen") .for_call( ["/bin/true"], stdout=subprocess.PIPE, @@ -121,7 +121,7 @@ def test_run_with_timeout_terminates_on_timeout(self): # type: () -> None mock_popen = make_mock_popen(communicate_raise=True) ( - self.mock_callable(subprocess, "Popen") + self.mock_constructor(subprocess, "Popen") .for_call( ["/bin/true"], stdout=subprocess.PIPE, @@ -140,7 +140,7 @@ def test_run_with_timeout_kills_on_terminate_timeout(self): # type: () -> None mock_popen = make_mock_popen(communicate_raise=True, terminate_raise=True) ( - self.mock_callable(subprocess, "Popen") + self.mock_constructor(subprocess, "Popen") .for_call( ["/bin/true"], stdout=subprocess.PIPE, @@ -158,7 +158,7 @@ def test_run_with_timeout_kills_on_terminate_timeout(self): def test_run_with_timeout_raise_on_nonzero(self): # type: () -> None ( - self.mock_callable(subprocess, "Popen") + self.mock_constructor(subprocess, "Popen") .for_call( ["/bin/true"], stdout=subprocess.PIPE, @@ -174,7 +174,7 @@ def test_run_with_timeout_raise_on_nonzero(self): def test_run_with_timeout_no_raise_on_nonzero(self): # type: () -> None ( - self.mock_callable(subprocess, "Popen") + self.mock_constructor(subprocess, "Popen") .for_call( ["/bin/true"], stdout=subprocess.PIPE, @@ -191,7 +191,7 @@ def test_run_with_timeout_no_raise_on_timeout(self): # type: () -> None mock_popen = make_mock_popen(returncode=1, communicate_raise=True) ( - self.mock_callable(subprocess, "Popen") + self.mock_constructor(subprocess, "Popen") .for_call( ["/bin/true"], stdout=subprocess.PIPE,