Skip to content

Commit

Permalink
Skip django/flask tests if not installed
Browse files Browse the repository at this point in the history
- Django and Flask are not firm requirements set out in the setup.py so makes
  sense to not mark the tests as failed if they aren't installed.
  • Loading branch information
durden committed Aug 4, 2016
1 parent f35f16b commit ddcc862
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
9 changes: 7 additions & 2 deletions jsonrpc/tests/test_backend_django/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@
from __future__ import absolute_import
import os

from django.core.urlresolvers import RegexURLPattern
from django.test import TestCase
try:
from django.core.urlresolvers import RegexURLPattern
from django.test import TestCase
except ImportError:
import unittest
raise unittest.SkipTest('Django not found for testing')

from ...backend.django import JSONRPCAPI, api
import json

Expand Down
8 changes: 6 additions & 2 deletions jsonrpc/tests/test_backend_flask/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@
else:
import unittest

# Flask is supported only for python2 and pyton3.3+
# Flask is supported only for python2 and python3.3+
if sys.version_info < (3, 0) or sys.version_info >= (3, 3):
from flask import Flask
try:
from flask import Flask
except ImportError:
raise unittest.SkipTest('Flask not found for testing')

from ...backend.flask import JSONRPCAPI, api

@api.dispatcher.add_method
Expand Down

0 comments on commit ddcc862

Please sign in to comment.