Merge branch 'fix-mock' into 'master'

Make flake8 use built-in mock from unittest, if available (Python 3.4+)

See merge request pycqa/flake8!356
This commit is contained in:
Kurt Mosiejczuk 2019-09-13 20:22:31 +00:00
commit 057224436a
21 changed files with 84 additions and 21 deletions

View file

@ -1,4 +1,7 @@
"""Integration tests for the checker submodule."""
try:
from unittest import mock
except (ImportError, AttributeError):
import mock
import pytest

View file

@ -2,6 +2,9 @@
import json
import os
try:
from unittest import mock
except (ImportError, AttributeError):
import mock
import pytest

View file

@ -2,6 +2,9 @@
import argparse
import sys
try:
from unittest import mock
except (ImportError, AttributeError):
import mock
import pytest

View file

@ -1,6 +1,9 @@
"""Tests for the BaseFormatter object."""
import argparse
try:
from unittest import mock
except (ImportError, AttributeError):
import mock
import pytest

View file

@ -1,6 +1,9 @@
"""Tests for the Manager object for FileCheckers."""
import errno
try:
from unittest import mock
except (ImportError, AttributeError):
import mock
import pytest

View file

@ -4,6 +4,9 @@ import configparser
import os
import sys
try:
from unittest import mock
except (ImportError, AttributeError):
import mock
import pytest

View file

@ -1,5 +1,8 @@
"""Tests for our debugging module."""
import entrypoints
try:
from unittest import mock
except (ImportError, AttributeError):
import mock
import pytest

View file

@ -1,4 +1,7 @@
"""Unit tests for the FileChecker class."""
try:
from unittest import mock
except (ImportError, AttributeError):
import mock
import pytest

View file

@ -2,6 +2,9 @@
import ast
import tokenize
try:
from unittest import mock
except (ImportError, AttributeError):
import mock
import pytest

View file

@ -1,4 +1,7 @@
"""Tests for get_local_plugins."""
try:
from unittest import mock
except (ImportError, AttributeError):
import mock
from flake8.options import config

View file

@ -1,4 +1,7 @@
"""Tests around functionality in the git integration."""
try:
from unittest import mock
except (ImportError, AttributeError):
import mock
import pytest

View file

@ -1,4 +1,7 @@
"""Tests for Flake8's legacy API."""
try:
from unittest import mock
except (ImportError, AttributeError):
import mock
import pytest

View file

@ -1,6 +1,9 @@
"""Unit tests for flake8.options.config.MergedConfigParser."""
import os
try:
from unittest import mock
except (ImportError, AttributeError):
import mock
import pytest

View file

@ -1,6 +1,9 @@
"""Unit tests for flake8.options.manager.Option."""
import functools
try:
from unittest import mock
except (ImportError, AttributeError):
import mock
import pytest

View file

@ -2,6 +2,9 @@
import argparse
import os
try:
from unittest import mock
except (ImportError, AttributeError):
import mock
import pytest

View file

@ -1,6 +1,9 @@
"""Tests for flake8.plugins.manager.Plugin."""
import argparse
try:
from unittest import mock
except (ImportError, AttributeError):
import mock
import pytest

View file

@ -1,4 +1,7 @@
"""Tests for flake8.plugins.manager.PluginManager."""
try:
from unittest import mock
except (ImportError, AttributeError):
import mock
from flake8.plugins import manager

View file

@ -1,4 +1,7 @@
"""Tests for flake8.plugins.manager.PluginTypeManager."""
try:
from unittest import mock
except (ImportError, AttributeError):
import mock
import pytest

View file

@ -1,6 +1,9 @@
"""Tests for the flake8.style_guide.StyleGuide class."""
import argparse
try:
from unittest import mock
except (ImportError, AttributeError):
import mock
import pytest

View file

@ -1,6 +1,9 @@
"""Tests for flake8's utils module."""
import os
try:
from unittest import mock
except (ImportError, AttributeError):
import mock
import pytest

View file

@ -1,4 +1,7 @@
"""Tests for the flake8.style_guide.Violation class."""
try:
from unittest import mock
except (ImportError, AttributeError):
import mock
import pytest