Skip to content

Commit

Permalink
Use mock from the standard library
Browse files Browse the repository at this point in the history
Since Python 3.3, mock is part of unittest in the standard library.

Provide compatibility for older versions, since httplib2 seems to still
support Python2.
  • Loading branch information
pcahyna committed Mar 3, 2021
1 parent 81e80d0 commit f88fe0a
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion requirements-test.txt
@@ -1,6 +1,6 @@
flake8==3.4.1
future==0.16.0
mock==2.0.0
mock==2.0.0;python_version<"3.3"
pytest-cov==2.5.1
pytest-forked==0.2
pytest-randomly==1.2.1
Expand Down
5 changes: 4 additions & 1 deletion tests/test_cacerts_from_env.py
@@ -1,6 +1,9 @@
import os
import sys
import mock
try:
from unittest import mock
except ImportError:
import mock
import pytest
import tempfile
import httplib2
Expand Down
5 changes: 4 additions & 1 deletion tests/test_http.py
Expand Up @@ -5,7 +5,10 @@
import email.utils
import errno
import httplib2
import mock
try:
from unittest import mock
except ImportError:
import mock
import os
import pytest
from six.moves import http_client, urllib
Expand Down
5 changes: 4 additions & 1 deletion tests/test_other.py
@@ -1,5 +1,8 @@
import httplib2
import mock
try:
from unittest import mock
except ImportError:
import mock
import os
import pickle
import pytest
Expand Down
5 changes: 4 additions & 1 deletion tests/test_proxy.py
Expand Up @@ -9,7 +9,10 @@
from __future__ import print_function

import httplib2
import mock
try:
from unittest import mock
except ImportError:
import mock
import os
import pytest
import socket
Expand Down

0 comments on commit f88fe0a

Please sign in to comment.