2222
2323"""
2424
25- import unittest
26- import mock
27- import requests
2825import os
26+ import unittest
2927import uuid
3028
29+ import mock
30+ import requests
3131from cloudant ._2to3 import UNICHR
32- from cloudant .result import Result , QueryResult
33- from cloudant .error import CloudantArgumentError , CloudantDatabaseException
34- from cloudant .document import Document
3532from cloudant .design_document import DesignDocument
36- from cloudant .security_document import SecurityDocument
37- from cloudant .index import Index , TextIndex , SpecialIndex
33+ from cloudant .document import Document
34+ from cloudant .error import CloudantArgumentError , CloudantDatabaseException
3835from cloudant .feed import Feed , InfiniteFeed
39- from tests .unit ._test_util import LONG_NUMBER
36+ from cloudant .index import Index , TextIndex , SpecialIndex
37+ from cloudant .result import Result , QueryResult
38+ from cloudant .security_document import SecurityDocument
39+ from nose .plugins .attrib import attr
4040
41+ from tests .unit ._test_util import LONG_NUMBER
4142from .unit_t_db_base import skip_if_not_cookie_auth , UnitTestDbBase , skip_if_iam
4243from .. import unicode_
4344
45+
4446class CloudantDatabaseExceptionTests (unittest .TestCase ):
4547 """
4648 Ensure CloudantDatabaseException functions as expected.
@@ -79,6 +81,7 @@ def test_raise_with_proper_code_and_args(self):
7981 raise CloudantDatabaseException (400 , 'foo' )
8082 self .assertEqual (cm .exception .status_code , 400 )
8183
84+ @attr (db = ['cloudant' ,'couch' ])
8285class DatabaseTests (UnitTestDbBase ):
8386 """
8487 CouchDatabase/CloudantDatabase unit tests
@@ -780,8 +783,7 @@ def test_get_set_revision_limit(self):
780783 self .assertNotEqual (new_limit , limit )
781784 self .assertEqual (new_limit , 1234 )
782785
783- @unittest .skipIf (os .environ .get ('RUN_CLOUDANT_TESTS' ),
784- 'Skipping since view cleanup is automatic in Cloudant.' )
786+ @attr (db = 'couch' )
785787 def test_view_clean_up (self ):
786788 """
787789 Test cleaning up old view files
@@ -968,10 +970,7 @@ def test_database_request_fails_after_client_disconnects(self):
968970 finally :
969971 self .client .connect ()
970972
971- @unittest .skipIf (not os .environ .get ('RUN_CLOUDANT_TESTS' ) or
972- (os .environ .get ('COUCHDB_VERSION' ) and
973- os .environ .get ('COUCHDB_VERSION' ).startswith ('1' )),
974- 'Skipping test_create_json_index test' )
973+ @attr (couchapi = 2 )
975974 def test_create_json_index (self ):
976975 """
977976 Ensure that a JSON index is created as expected.
@@ -995,10 +994,7 @@ def test_create_json_index(self):
995994 self .assertEquals (index ['options' ]['def' ]['fields' ], ['name' , 'age' ])
996995 self .assertEquals (index ['reduce' ], '_count' )
997996
998- @unittest .skipIf (not os .environ .get ('RUN_CLOUDANT_TESTS' ) or
999- (os .environ .get ('COUCHDB_VERSION' ) and
1000- os .environ .get ('COUCHDB_VERSION' ).startswith ('1' )),
1001- 'Skipping test_create_json_index test' )
997+ @attr (couchapi = 2 )
1002998 def test_delete_json_index (self ):
1003999 """
10041000 Ensure that a JSON index is deleted as expected.
@@ -1013,10 +1009,7 @@ def test_delete_json_index(self):
10131009 self .db .delete_query_index ('ddoc001' , 'json' , 'index001' )
10141010 self .assertFalse (ddoc .exists ())
10151011
1016- @unittest .skipUnless (
1017- os .environ .get ('RUN_CLOUDANT_TESTS' ) is not None ,
1018- 'Skipping Cloudant specific Database tests'
1019- )
1012+ @attr (db = 'cloudant' )
10201013class CloudantDatabaseTests (UnitTestDbBase ):
10211014 """
10221015 Cloudant specific Database unit tests
0 commit comments