Repository: nteract/papermill (language: python)

Issue:
use unittest.mock instead of mock
## 🐛 Bug

<!-- A clear and concise description of what the bug is. -->
Could you please consider unittest.mock instead of mock everywhere consistently or at least use unittest.mock as a fallback when mock is not installed?


Discussion / hints:

Fix patch:
diff --git a/docs/requirements.txt b/docs/requirements.txt
index 2e8afa1e..cb450c5e 100644
--- a/docs/requirements.txt
+++ b/docs/requirements.txt
@@ -4,6 +4,5 @@
 Sphinx==3.5.4
 furo==2021.4.11b34
 myst-parser==0.13.7
-mock==4.0.3
 moto==2.0.5
 sphinx-copybutton==0.3.1
diff --git a/requirements/dev.txt b/requirements/dev.txt
index 253a0a69..dca04012 100644
--- a/requirements/dev.txt
+++ b/requirements/dev.txt
@@ -6,7 +6,6 @@ google_compute_engine # Need this because boto has issues with dynamic package l
 ipython>=5.0
 ipywidgets
 notebook
-mock
 moto
 pytest>=4.1
 pytest-cov>=2.6.1


Test patch:
diff --git a/papermill/tests/test_autosave.py b/papermill/tests/test_autosave.py
index d6d17f93..459f4953 100644
--- a/papermill/tests/test_autosave.py
+++ b/papermill/tests/test_autosave.py
@@ -3,8 +3,7 @@
 import tempfile
 import time
 import unittest
-
-from mock import patch
+from unittest.mock import patch
 
 from . import get_notebook_path
 
diff --git a/papermill/tests/test_cli.py b/papermill/tests/test_cli.py
index 6ab8c620..5980ef46 100755
--- a/papermill/tests/test_cli.py
+++ b/papermill/tests/test_cli.py
@@ -13,12 +13,11 @@
 import nbformat
 from jupyter_client import kernelspec
 import unittest
+from unittest.mock import patch
 
 import pytest
 from click.testing import CliRunner
 
-from mock import patch
-
 from . import get_notebook_path, kernel_name
 from .. import cli
 from ..cli import papermill, _is_int, _is_float, _resolve_type
diff --git a/papermill/tests/test_clientwrap.py b/papermill/tests/test_clientwrap.py
index 9268c461..a8bfff27 100644
--- a/papermill/tests/test_clientwrap.py
+++ b/papermill/tests/test_clientwrap.py
@@ -1,7 +1,7 @@
 import nbformat
 import unittest
 
-from mock import call, patch
+from unittest.mock import call, patch
 
 from . import get_notebook_path
 
diff --git a/papermill/tests/test_engines.py b/papermill/tests/test_engines.py
index 27a2f34a..af95878d 100644
--- a/papermill/tests/test_engines.py
+++ b/papermill/tests/test_engines.py
@@ -3,7 +3,7 @@
 import unittest
 
 from abc import ABCMeta
-from mock import Mock, patch, call
+from unittest.mock import Mock, patch, call
 from nbformat.notebooknode import NotebookNode
 
 from . import get_notebook_path
diff --git a/papermill/tests/test_execute.py b/papermill/tests/test_execute.py
index e1ac4ad8..8e263e6d 100644
--- a/papermill/tests/test_execute.py
+++ b/papermill/tests/test_execute.py
@@ -3,17 +3,13 @@
 import shutil
 import tempfile
 import unittest
+from unittest.mock import patch
 
 from functools import partial
 from pathlib import Path
 
 from nbformat import validate
 
-try:
-    from unittest.mock import patch
-except ImportError:
-    from mock import patch
-
 from .. import engines
 from ..log import logger
 from ..iorw import load_notebook_node
diff --git a/papermill/tests/test_gcs.py b/papermill/tests/test_gcs.py
index bbee89c4..d9990599 100644
--- a/papermill/tests/test_gcs.py
+++ b/papermill/tests/test_gcs.py
@@ -1,5 +1,4 @@
 import unittest
-
 from unittest.mock import patch
 
 from ..exceptions import PapermillRateLimitException