Blame efc0166793db58e08b57ba3839638f7571355b93.patch

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