From 15605d912cf8733a0f88e023bc1e998c4a9b9ba2 Mon Sep 17 00:00:00 2001 From: Marc Wouts Date: Tue, 9 Jul 2019 23:26:32 +0200 Subject: [PATCH] Import unittest.mock preferentially over mock # 279 --- jupytext/contentsmanager.py | 5 +++-- tests/conftest.py | 5 +++-- tests/test_cli.py | 5 +++-- tests/test_read_simple_markdown.py | 4 ++-- 4 files changed, 11 insertions(+), 8 deletions(-) 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