tests: Ignore http tests if cherrypy is missing

This commit is contained in:
Stein Magnus Jodal 2012-12-01 10:48:54 +01:00
parent 5422d85f5b
commit ec66cae784

View File

@ -1,14 +1,22 @@
import json
import cherrypy
try:
import cherrypy
except ImportError:
cherrypy = False
import mock
from mopidy.frontends.http import HttpFrontend
from mopidy.exceptions import OptionalDependencyError
try:
from mopidy.frontends.http import HttpFrontend
except OptionalDependencyError:
pass
from tests import unittest
@mock.patch.object(cherrypy.engine, 'publish')
@unittest.skipUnless(cherrypy, 'cherrypy not found')
@mock.patch('cherrypy.engine.publish')
class HttpEventsTest(unittest.TestCase):
def setUp(self):
self.http = HttpFrontend(core=mock.Mock())