Commit 3b630a0a authored by Jason Madden's avatar Jason Madden

Tests work without the backport of mock.

parent 3a4c73b4
...@@ -128,9 +128,20 @@ def gc_collect_if_needed(): ...@@ -128,9 +128,20 @@ def gc_collect_if_needed():
if PYPY: # pragma: no cover if PYPY: # pragma: no cover
gc.collect() gc.collect()
# Our usage of mock should be limited to '@mock.patch()'
# and other things that are easily...mocked...here on Python 2
# when mock is not installed.
try: try:
from unittest import mock from unittest import mock
except ImportError: # Python 2 except ImportError: # Python 2
import mock try:
import mock
except ImportError: # pragma: no cover
# Backport not installed
class mock(object):
@staticmethod
def patch(reason):
return unittest.skip(reason)
mock = mock mock = mock
...@@ -27,7 +27,7 @@ import unittest ...@@ -27,7 +27,7 @@ import unittest
try: try:
import objgraph import objgraph
except ImportError: except ImportError: # pragma: no cover
# Optional test dependency # Optional test dependency
objgraph = None objgraph = None
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment