Remove pytest-mocker

Turns out that it's not too useful.

BUG=None
TEST=main_test

Change-Id: I92e6f7d920ec85842478ebdafd9e36bf9f2c7b3c
diff --git a/Pipfile b/Pipfile
index ed9303b..0ea7951 100644
--- a/Pipfile
+++ b/Pipfile
@@ -12,7 +12,6 @@
 mox = "*"
 mysql-python = "~=1.2.4"
 pytest = "*"
-pytest-mock = "*"
 pyyaml = "~=3.12"
 
 
diff --git a/Pipfile.lock b/Pipfile.lock
index 633abbf..5b358a5 100644
--- a/Pipfile.lock
+++ b/Pipfile.lock
@@ -1,7 +1,7 @@
 {
     "_meta": {
         "hash": {
-            "sha256": "72d89e22c8de6dc6e2dc64319b83cc8bf5aa436292593a6ec899fc6ce45d9681"
+            "sha256": "6ac8f39f85746aa8823a0b98ccc538169403e00d8e81b289e7720b382b7f93da"
         },
         "host-environment-markers": {
             "implementation_name": "cpython",
@@ -514,13 +514,6 @@
             ],
             "version": "==3.5.0"
         },
-        "pytest-mock": {
-            "hashes": [
-                "sha256:40f4f7148a81c94656a4fe7cf067edd62e541599bb70a6d3af50ffac4c2312f2",
-                "sha256:173fd47c872d105368aeb22dca1415db9f269c0ee1c3832c3aebadd3e80f6133"
-            ],
-            "version": "==1.9.0"
-        },
         "pyyaml": {
             "hashes": [
                 "sha256:3262c96a1ca437e7e4763e2843746588a965426550f3797a79fca9c6199c431f",
diff --git a/main_test.py b/main_test.py
index 9ac6301..3dd6f68 100644
--- a/main_test.py
+++ b/main_test.py
@@ -16,7 +16,6 @@
 from chromite.lib import constants
 from chromite.lib import gerrit
 from google.cloud import datastore
-from pytest_mock import mocker
 import pytest
 import mock
 
@@ -59,12 +58,11 @@
   return helper
 
 
-def _CQCronTest(mocker, client, cidb_conn,
+def _CQCronTest(client, cidb_conn,
                 datastore_client, change_details_map):
   """Patches services with side-effects.
 
   Args:
-    mocker: A pytest-mocker fixture
     client: A Flask TestClient object
     cidb_conn: A fake chromite.lib.cidb.CIDBConnection
     datastore_client: A fake datastore.Client
@@ -74,40 +72,34 @@
   Returns:
     The JSON response from /cron/exonerate/cq
   """
-  mocker.patch.object(datastore, 'Client', return_value=datastore_client)
-  mocker.patch.object(cidb, 'CIDBConnection', return_value=cidb_conn)
-  mocker.patch.object(gerrit, 'GetGerritHelper',
-                      return_value=_GerritHelper(change_details_map))
-  _PatchDatetime(mocker)
-
-  response = client.get(
-      '/cron/exonerate/cq',
-      headers={main.APPENGINE_CRON_HEADER: 'true'})
+  with mock.patch.object(datastore, 'Client', return_value=datastore_client),\
+       mock.patch.object(cidb, 'CIDBConnection', return_value=cidb_conn),\
+       mock.patch.object(gerrit, 'GetGerritHelper',
+                   return_value=_GerritHelper(change_details_map)),\
+       _PatchDatetime():
+    response = client.get(
+        '/cron/exonerate/cq',
+        headers={main.APPENGINE_CRON_HEADER: 'true'})
   return json.loads(response.get_data(as_text=True))
 
 
-def _PatchDatetime(mocker):
-  """Mocks out datetime.datetime to make time-dependent code consistent.
-
-  Args:
-    mocker: A pytest-mocker fixture.
-  """
+def _PatchDatetime():
+  """Mocks out datetime.datetime to make time-dependent code consistent."""
   orig_datetime = datetime.datetime
   fake_datetime = mock.Mock(
       wraps=orig_datetime,
       now=mock.Mock(return_value=orig_datetime(year=2017, month=2, day=2)))
-  mocker.patch.object(datetime, 'datetime', fake_datetime)
+  return mock.patch.object(datetime, 'datetime', fake_datetime)
 
 
-def TestEmptyDatabase(mocker, client, cidb_conn, datastore_client):
+def TestEmptyDatabase(client, cidb_conn, datastore_client):
   change_details_map = {}
-  response = _CQCronTest(mocker, client, cidb_conn, datastore_client,
+  response = _CQCronTest(client, cidb_conn, datastore_client,
                          change_details_map)
   assert response['exonerated'] == []
 
 
-def TestBadCLNotExonerated(mocker, client, cidb_conn,
-                           datastore_client):
+def TestBadCLNotExonerated(client, cidb_conn, datastore_client):
   """Tests that a CL which was blamed as bad is not exonerated."""
   change_details = next(gerrit_cq_test.GlobChangeDetails(
       gerrit_cq_test.READY_CASES))
@@ -136,13 +128,12 @@
       'timestamp': '2017-01-01 00:00:00'
   })
 
-  response = _CQCronTest(mocker, client, cidb_conn, datastore_client,
+  response = _CQCronTest(client, cidb_conn, datastore_client,
                          change_details_map)
   assert response['exonerated'] == []
 
 
-def TestGoodCLExonerated(mocker, client, cidb_conn,
-                           datastore_client):
+def TestGoodCLExonerated(client, cidb_conn, datastore_client):
   """Tests that a CL which was not blamed is exonerated."""
   change_details = next(gerrit_cq_test.GlobChangeDetails(
       gerrit_cq_test.READY_CASES))
@@ -171,6 +162,6 @@
       'timestamp': '2017-01-01 00:00:00'
   })
 
-  response = _CQCronTest(mocker, client, cidb_conn, datastore_client,
+  response = _CQCronTest(client, cidb_conn, datastore_client,
                          change_details_map)
   assert response['exonerated'] == [[list(patch), build_id]]