mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-03 16:52:34 +01:00
Make dependency on python-mock optional.
This commit is contained in:
parent
6f19088724
commit
0a9d6469f0
@ -5,3 +5,4 @@ python-gnupg
|
||||
feedparser
|
||||
sqlalchemy
|
||||
SocksiPy-branch
|
||||
mock
|
||||
|
4
setup.py
4
setup.py
@ -281,10 +281,6 @@ setup(
|
||||
'python-dateutil <2.0,>=1.3',
|
||||
'feedparser',
|
||||
],
|
||||
|
||||
tests_require=[
|
||||
'mock',
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
|
@ -27,10 +27,20 @@
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
###
|
||||
|
||||
import sys
|
||||
import unittest
|
||||
from supybot import questions
|
||||
from supybot.test import SupyTestCase
|
||||
|
||||
if sys.version_info >= (2, 7, 0):
|
||||
skipif = unittest.skipIf
|
||||
else:
|
||||
skipif = lambda x, y: None
|
||||
|
||||
try:
|
||||
import mock
|
||||
except ImportError:
|
||||
mock=None
|
||||
|
||||
# so complicated construction because I want to
|
||||
# gain the string 'y' instead of the character 'y'
|
||||
@ -39,6 +49,7 @@ import mock
|
||||
# better solution is usage of '==' operator ;)
|
||||
_yes_answer = ''.join(['', 'y'])
|
||||
|
||||
@skipif(mock is None, 'python-mock is not installed.')
|
||||
class TestYn(SupyTestCase):
|
||||
def test_default_yes_selected(self):
|
||||
questions.expect = mock.Mock(return_value=_yes_answer)
|
||||
|
Loading…
Reference in New Issue
Block a user