summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Doane <jaydoane@apache.org>2020-02-21 22:46:50 -0800
committerJay Doane <jaydoane@apache.org>2020-02-21 22:46:50 -0800
commit3d559eb14fd709662d3eb5cda8afe9a45687c3b1 (patch)
treee84330c839b1c09133e86139e083c6de8abc6277
parente05e3cdc8d16d88e7c7af8fbcc4b671b81ac2693 (diff)
downloadcouchdb-clean-up-after-mango-tests.tar.gz
Clean up mango test user docsclean-up-after-mango-tests
Tests based on class `UsersDbTests` don't clean up the user docs it puts in the `_users` db. This uses the classmethod `tearDownClass` to delete those docs.
-rw-r--r--src/mango/test/mango.py4
-rw-r--r--src/mango/test/user_docs.py4
2 files changed, 8 insertions, 0 deletions
diff --git a/src/mango/test/mango.py b/src/mango/test/mango.py
index b87189446..7a404e253 100644
--- a/src/mango/test/mango.py
+++ b/src/mango/test/mango.py
@@ -314,6 +314,10 @@ class UsersDbTests(unittest.TestCase):
klass.db = Database("_users")
user_docs.setup_users(klass.db)
+ @classmethod
+ def tearDownClass(klass):
+ user_docs.teardown_users(klass.db)
+
def setUp(self):
self.db = self.__class__.db
diff --git a/src/mango/test/user_docs.py b/src/mango/test/user_docs.py
index 679360171..40e9cf931 100644
--- a/src/mango/test/user_docs.py
+++ b/src/mango/test/user_docs.py
@@ -59,6 +59,10 @@ def setup_users(db, **kwargs):
db.save_docs(copy.deepcopy(USERS_DOCS))
+def teardown_users(db):
+ [db.delete_doc(doc['_id']) for doc in USERS_DOCS]
+
+
def setup(db, index_type="view", **kwargs):
db.recreate()
if index_type == "view":