Skip to content

Commit

Permalink
Replace recreate() with super().setUp(db_per_test=True)
Browse files Browse the repository at this point in the history
  • Loading branch information
jiahuili430 committed Nov 26, 2024
1 parent 2f6117e commit 0bef663
Show file tree
Hide file tree
Showing 11 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/mango/test/01-index-crud-test.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

class IndexCrudTests(mango.DbPerClass):
def setUp(self):
self.db.recreate()
super().setUp(db_per_test=True)

def test_bad_fields(self):
bad_fields = [
Expand Down Expand Up @@ -352,7 +352,7 @@ def test_out_of_sync(self):
@unittest.skipUnless(mango.has_text_service(), "requires text service")
class IndexCrudTextTests(mango.DbPerClass):
def setUp(self):
self.db.recreate()
super().setUp(db_per_test=True)

def test_create_text_idx(self):
fields = [
Expand Down
2 changes: 1 addition & 1 deletion src/mango/test/12-use-correct-index-test.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@

class ChooseCorrectIndexForDocs(mango.DbPerClass):
def setUp(self):
self.db.recreate()
super().setUp(db_per_test=True)
self.db.save_docs(copy.deepcopy(DOCS))

def test_choose_index_with_one_field_in_index(self):
Expand Down
2 changes: 1 addition & 1 deletion src/mango/test/13-stable-update-test.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

class SupportStableAndUpdate(mango.DbPerClass):
def setUp(self):
self.db.recreate()
super().setUp(db_per_test=True)
# Hack to prevent auto-indexer from foiling update=False test
# https://github.com/apache/couchdb/issues/2313
self.db.save_doc(
Expand Down
2 changes: 1 addition & 1 deletion src/mango/test/14-json-pagination-test.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

class PaginateJsonDocs(mango.DbPerClass):
def setUp(self):
self.db.recreate()
super().setUp(db_per_test=True)
self.db.save_docs(copy.deepcopy(DOCS))

def test_all_docs_paginate_to_end(self):
Expand Down
4 changes: 2 additions & 2 deletions src/mango/test/16-index-selectors-test.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@

class IndexSelectorJson(mango.DbPerClass):
def setUp(self):
self.db.recreate()
super().setUp(db_per_test=True)
self.db.save_docs(copy.deepcopy(DOCS))

def test_saves_partial_filter_selector_in_index(self):
Expand Down Expand Up @@ -189,7 +189,7 @@ def test_uses_partial_index_with_non_indexable_selector(self):
@unittest.skipUnless(mango.has_text_service(), "requires text service")
class IndexSelectorText(mango.DbPerClass):
def setUp(self):
self.db.recreate()
super().setUp(db_per_test=True)
self.db.save_docs(copy.deepcopy(DOCS))

def test_saves_partialfilterselector_in_index(self):
Expand Down
4 changes: 2 additions & 2 deletions src/mango/test/17-multi-type-value-test.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def test_can_query_with_age_and_name_range(self):

class MultiValueFieldJSONTests(mango.DbPerClass, MultiValueFieldTests):
def setUp(self):
self.db.recreate()
super().setUp(db_per_test=True)
self.db.save_docs(copy.deepcopy(DOCS))
self.db.create_index(["name"])
self.db.create_index(["age", "name"])
Expand All @@ -65,5 +65,5 @@ def setUp(self):

class MultiValueFieldAllDocsTests(mango.DbPerClass, MultiValueFieldTests):
def setUp(self):
self.db.recreate()
super().setUp(db_per_test=True)
self.db.save_docs(copy.deepcopy(DOCS))
2 changes: 1 addition & 1 deletion src/mango/test/18-json-sort.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

class JSONIndexSortOptimisations(mango.DbPerClass):
def setUp(self):
self.db.recreate()
super().setUp(db_per_test=True)
self.db.save_docs(copy.deepcopy(DOCS))

def test_works_for_basic_case(self):
Expand Down
2 changes: 1 addition & 1 deletion src/mango/test/19-find-conflicts.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

class ChooseCorrectIndexForDocs(mango.DbPerClass):
def setUp(self):
self.db.recreate()
super().setUp(db_per_test=True)
self.db.save_docs(copy.deepcopy(DOC))
self.db.save_docs_with_conflicts(copy.deepcopy(CONFLICT))

Expand Down
2 changes: 1 addition & 1 deletion src/mango/test/20-no-timeout-test.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

class LongRunningMangoTest(mango.DbPerClass):
def setUp(self):
self.db.recreate()
super().setUp(db_per_test=True)
docs = []
for i in range(100000):
docs.append({"_id": str(i), "another": "field"})
Expand Down
2 changes: 1 addition & 1 deletion src/mango/test/24-text-paginated-test.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class PaginatedResultsTest(mango.DbPerClass):
UPDATES = 25

def setUp(self):
self.db.recreate()
super().setUp(db_per_test=True)
self.db.create_text_index(
analyzer="keyword",
default_field={},
Expand Down
2 changes: 1 addition & 1 deletion src/mango/test/25-beginswith-test.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def to_utf8_bytes(list):

class BeginsWithOperator(mango.DbPerClass):
def setUp(self):
self.db.recreate()
super().setUp(db_per_test=True)
self.db.save_docs(copy.deepcopy(DOCS))
self.db.create_index(["location"])
self.db.create_index(["name", "location"])
Expand Down

0 comments on commit 0bef663

Please sign in to comment.