Commits

Ronny Pfannschmidt  committed b09321c

add missing imports

  • Participants
  • Parent commits edcd0ca

Comments (0)

Files changed (3)

File pytest_couchdbkit/utils.py

+import pytest
 
 def server_from_config(config):
     from couchdbkit import Server
 def dbname_from_config(config, fmt):
     suffix = config.getini('couchdbkit_suffix')
     if not suffix:
-        pytest.fail('no couchdbkit_suffix set in ini')
+        pytest.xfail('no couchdbkit_suffix set in ini')
     return fmt % (suffix,)
 
 

File testing/test_hooks.py

 from pytest_couchdbkit.utils import maybe_destroy_and_create
 import couchdbkit
 import mock
-import json
+
 settings = {'couchdbkit_suffix': 'test', 'couchdbkit_backend': 'thread'}
 
-
 def funcargs(name, request):
     if name == 'couchdb_server':
         return couchdbkit.Server()
 def test_database_dumping(request, tmpdir):
     db = pytest_couchdbkit.pytest_funcarg__couchdb(request)
     print db.info()
-    db.save_doc({'_id': 'test'})
+    db.save_doc({'_id': 'test'}, force_update=True)
     finalizer = request.addfinalizer.call_args[0][0]
     assert not tmpdir.join('couchdb.dump').check()
     finalizer()

File testing/test_utils.py

 
 
 from mock import Mock
-from pytest_couchdbkit.utils import *
+import pytest
+from pytest_couchdbkit.utils import dbname_from_config
 
 def config(**data):
     mock = Mock()
 
     name = dbname_from_config(conf, '%s')
     assert name == 'fun'
+
+def test_skip_on_missing_suffix():
+    conf = config()
+    with pytest.raises(pytest.xfail.Exception):
+        dbname_from_config(conf, '%s')