diff --git a/jupytext/contentsmanager.py b/jupytext/contentsmanager.py index d735c6c4c..f1015eb67 100644 --- a/jupytext/contentsmanager.py +++ b/jupytext/contentsmanager.py @@ -3,10 +3,11 @@ import os from datetime import timedelta import nbformat + try: - import mock -except ImportError: import unittest.mock as mock +except ImportError: + import mock from tornado.web import HTTPError from traitlets import Unicode, Float, Bool, Enum from traitlets.config import Configurable diff --git a/tests/conftest.py b/tests/conftest.py index fe2466a27..dcf92bfc5 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,8 +1,9 @@ import pytest + try: - import mock -except ImportError: import unittest.mock as mock +except ImportError: + import mock @pytest.fixture diff --git a/tests/test_cli.py b/tests/test_cli.py index ade142733..17a01d2a4 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -2,10 +2,11 @@ import sys import time import stat + try: - import mock -except ImportError: import unittest.mock as mock +except ImportError: + import mock import pytest import nbformat import itertools diff --git a/tests/test_read_simple_markdown.py b/tests/test_read_simple_markdown.py index cc64eaaba..95fdd5a41 100644 --- a/tests/test_read_simple_markdown.py +++ b/tests/test_read_simple_markdown.py @@ -1,7 +1,7 @@ try: - import mock -except ImportError: import unittest.mock as mock +except ImportError: + import mock from nbformat.v4.nbbase import new_code_cell, new_raw_cell, new_markdown_cell from jupytext.compare import compare import jupytext