Commits

Georg Brandl  committed ac337b2

Skip tests accordingly if sqlalchemy is not present.

  • Participants
  • Parent commits 6aa428b

Comments (0)

Files changed (1)

File tests/test_websupport.py

 from sphinx.websupport import WebSupport
 from sphinx.websupport.errors import *
 from sphinx.websupport.storage.differ import CombinedHtmlDiff
-from sphinx.websupport.storage.sqlalchemystorage import Session, \
-    SQLAlchemyStorage, Comment, CommentVote
-from sphinx.websupport.storage.sqlalchemy_db import Node
+try:
+    from sphinx.websupport.storage.sqlalchemystorage import Session, \
+         SQLAlchemyStorage, Comment, CommentVote
+    from sphinx.websupport.storage.sqlalchemy_db import Node
+    sqlalchemy_missing = False
+except ImportError:
+    sqlalchemy_missing = True
 
 from util import *
 
         and contents['sidebar'] and contents['relbar']
 
 
+@skip_if(sqlalchemy_missing, 'needs sqlalchemy')
 @with_support()
 def test_comments(support):
     session = Session()
     assert children[0]['text'] == 'Child test comment'
 
 
+@skip_if(sqlalchemy_missing, 'needs sqlalchemy')
 @with_support()
 def test_voting(support):
     session = Session()
     assert comment['vote'] == 1, '%s != 1' % comment['vote']
 
 
+@skip_if(sqlalchemy_missing, 'needs sqlalchemy')
 @with_support()
 def test_proposals(support):
     session = Session()
                                   proposal=proposal)
 
 
+@skip_if(sqlalchemy_missing, 'needs sqlalchemy')
 @with_support()
 def test_user_delete_comments(support):
     def get_comment():
     assert comment['text'] == '[deleted]'
 
 
+@skip_if(sqlalchemy_missing, 'needs sqlalchemy')
 @with_support()
 def test_moderator_delete_comments(support):
     def get_comment():
     assert comment['text'] == '[deleted]'
 
 
+@skip_if(sqlalchemy_missing, 'needs sqlalchemy')
 @with_support()
 def test_update_username(support):
     support.update_username('user_two', 'new_user_two')
     called = True
 
 
+@skip_if(sqlalchemy_missing, 'needs sqlalchemy')
 @with_support(moderation_callback=moderation_callback)
 def test_moderation(support):
     session = Session()