summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Kocoloski <kocolosk@apache.org>2021-11-12 14:49:15 -0500
committerAdam Kocoloski <kocolosk@apache.org>2021-11-15 12:58:33 -0500
commit6c3f3ff166ea8ff1fdf9043e90b73f3cfeea2acf (patch)
tree0a70dc42772d99d38e4c8f2e3e5159900e27add4
parentb7b6d02be01a8fd2125e04c267d65f5e107757be (diff)
downloadcouchdb-6c3f3ff166ea8ff1fdf9043e90b73f3cfeea2acf.tar.gz
Fix Python formatting, restore python-black target
This also allows us to eliminate the `check-all-tests` target, since we've re-enabled all the test suites (and excluded specific tests as needed).
-rw-r--r--Makefile11
-rwxr-xr-xbuild-aux/logfile-uploader.py6
-rwxr-xr-xdev/run12
-rw-r--r--src/mango/test/01-index-crud-test.py12
-rw-r--r--src/mango/test/05-index-selection-test.py2
-rw-r--r--src/mango/test/12-use-correct-index-test.py20
-rw-r--r--src/mango/test/13-users-db-find-test.py1
-rw-r--r--src/mango/test/15-execution-stats-test.py4
-rw-r--r--src/mango/test/19-find-conflicts.py1
-rw-r--r--src/mango/test/22-build-wait-selected-index.py10
-rw-r--r--src/mango/test/user_docs.py7
11 files changed, 46 insertions, 40 deletions
diff --git a/Makefile b/Makefile
index df70cb302..fd7ea7709 100644
--- a/Makefile
+++ b/Makefile
@@ -142,15 +142,6 @@ fauxton: share/www
################################################################################
-# When we can run all the tests with FDB switch this back to be the default
-# "make check" command
-.PHONY: check-all-tests
-# target: check - Test everything
-check-all-tests: all python-black
- @$(MAKE) eunit
- @$(MAKE) mango-test
- @$(MAKE) elixir
-
ifdef apps
subdirs=$(shell echo $(apps) | sed 's/,/ /g')
else
@@ -158,7 +149,7 @@ subdirs=$(shell ls src)
endif
.PHONY: check
-check: all
+check: all python-black
@$(MAKE) erlfmt-check
@$(MAKE) eunit
@$(MAKE) elixir-suite
diff --git a/build-aux/logfile-uploader.py b/build-aux/logfile-uploader.py
index 3df9e6c81..f33915a83 100755
--- a/build-aux/logfile-uploader.py
+++ b/build-aux/logfile-uploader.py
@@ -34,7 +34,7 @@ def _tojson(req):
def collect_logfiles():
- """ Find and tarball all logfiles """
+ """Find and tarball all logfiles"""
tb = tarfile.open(name=TARFILE, mode="w:gz")
# Test results
for log in glob.glob("test-results.log"):
@@ -52,7 +52,7 @@ def collect_logfiles():
def build_ci_doc():
- """ Build a metadata document with relevant detail from CI env """
+ """Build a metadata document with relevant detail from CI env"""
doc = {}
if "TRAVIS" in os.environ:
doc["builder"] = "travis"
@@ -125,7 +125,7 @@ def upload_logs():
def main():
- """ Find latest logfile and upload to Couch logfile db. """
+ """Find latest logfile and upload to Couch logfile db."""
print("Uploading logfiles...")
collect_logfiles()
req = upload_logs()
diff --git a/dev/run b/dev/run
index 3fe1b33b6..ecc45c9de 100755
--- a/dev/run
+++ b/dev/run
@@ -287,8 +287,9 @@ def check_boot_script(ctx):
@log("Prepare configuration files")
def setup_configs(ctx):
for idx, node in enumerate(ctx["nodes"]):
- cluster_port, backend_port, prometheus_port = get_ports(ctx,
- idx + ctx["node_number"])
+ cluster_port, backend_port, prometheus_port = get_ports(
+ ctx, idx + ctx["node_number"]
+ )
env = {
"prefix": toposixpath(ctx["rootdir"]),
"package_author_name": "The Apache Software Foundation",
@@ -362,8 +363,11 @@ def apply_config_overrides(ctx, content):
def get_ports(ctx, idnode):
assert idnode
if idnode <= 5 and not ctx["auto_ports"]:
- return ((10000 * idnode) + 5984, (10000 * idnode) + 5986,
- (10000 * idnode) + 7986)
+ return (
+ (10000 * idnode) + 5984,
+ (10000 * idnode) + 5986,
+ (10000 * idnode) + 7986,
+ )
else:
return tuple(get_available_ports(2))
diff --git a/src/mango/test/01-index-crud-test.py b/src/mango/test/01-index-crud-test.py
index 13ae300dd..ea00e3eb2 100644
--- a/src/mango/test/01-index-crud-test.py
+++ b/src/mango/test/01-index-crud-test.py
@@ -117,14 +117,12 @@ class IndexCrudTests(mango.DbPerClass):
fields = ["baz", "foo"]
ret = self.db.create_index(fields, name="idx_02")
assert ret is True
- self.db.save_doc({
- "_id": "_design/ignore",
- "views": {
- "view1": {
- "map": "function (doc) { emit(doc._id, 1)}"
- }
+ self.db.save_doc(
+ {
+ "_id": "_design/ignore",
+ "views": {"view1": {"map": "function (doc) { emit(doc._id, 1)}"}},
}
- })
+ )
indexes = self.db.list_indexes()
self.assertEqual(len(indexes), 2)
diff --git a/src/mango/test/05-index-selection-test.py b/src/mango/test/05-index-selection-test.py
index bae3d58f1..8c683b276 100644
--- a/src/mango/test/05-index-selection-test.py
+++ b/src/mango/test/05-index-selection-test.py
@@ -207,7 +207,7 @@ class IndexSelectionTests:
self.db.save_doc(design_doc)
assert False, "Should not get here."
except requests.exceptions.HTTPError as e:
- self.assertEqual(e.response.json()['error'], 'invalid_design_doc')
+ self.assertEqual(e.response.json()["error"], "invalid_design_doc")
def test_explain_sort_reverse(self):
selector = {"manager": {"$gt": None}}
diff --git a/src/mango/test/12-use-correct-index-test.py b/src/mango/test/12-use-correct-index-test.py
index a7f07b5e8..47ed9df47 100644
--- a/src/mango/test/12-use-correct-index-test.py
+++ b/src/mango/test/12-use-correct-index-test.py
@@ -54,14 +54,18 @@ class ChooseCorrectIndexForDocs(mango.DbPerClass):
self.db.save_docs(copy.deepcopy(DOCS))
def test_choose_index_with_one_field_in_index(self):
- self.db.create_index(["name", "age", "user_id"], ddoc="aaa", wait_for_built_index=False)
+ self.db.create_index(
+ ["name", "age", "user_id"], ddoc="aaa", wait_for_built_index=False
+ )
self.db.create_index(["name"], ddoc="zzz", wait_for_built_index=False)
self.db.wait_for_built_indexes()
explain = self.db.find({"name": "Eddie"}, explain=True)
self.assertEqual(explain["index"]["ddoc"], "_design/zzz")
def test_choose_index_with_two(self):
- self.db.create_index(["name", "age", "user_id"], ddoc="aaa", wait_for_built_index=False)
+ self.db.create_index(
+ ["name", "age", "user_id"], ddoc="aaa", wait_for_built_index=False
+ )
self.db.create_index(["name", "age"], ddoc="bbb", wait_for_built_index=False)
self.db.create_index(["name"], ddoc="zzz", wait_for_built_index=False)
self.db.wait_for_built_indexes()
@@ -77,7 +81,9 @@ class ChooseCorrectIndexForDocs(mango.DbPerClass):
self.assertEqual(explain["index"]["ddoc"], "_design/aaa")
def test_choose_index_most_accurate(self):
- self.db.create_index(["name", "age", "user_id"], ddoc="aaa", wait_for_built_index=False)
+ self.db.create_index(
+ ["name", "age", "user_id"], ddoc="aaa", wait_for_built_index=False
+ )
self.db.create_index(["name", "age"], ddoc="bbb", wait_for_built_index=False)
self.db.create_index(["name"], ddoc="zzz", wait_for_built_index=False)
self.db.wait_for_built_indexes()
@@ -85,8 +91,12 @@ class ChooseCorrectIndexForDocs(mango.DbPerClass):
self.assertEqual(explain["index"]["ddoc"], "_design/bbb")
def test_choose_index_most_accurate_in_memory_selector(self):
- self.db.create_index(["name", "location", "user_id"], ddoc="aaa", wait_for_built_index=False)
- self.db.create_index(["name", "age", "user_id"], ddoc="bbb", wait_for_built_index=False)
+ self.db.create_index(
+ ["name", "location", "user_id"], ddoc="aaa", wait_for_built_index=False
+ )
+ self.db.create_index(
+ ["name", "age", "user_id"], ddoc="bbb", wait_for_built_index=False
+ )
self.db.create_index(["name"], ddoc="zzz", wait_for_built_index=False)
self.db.wait_for_built_indexes()
explain = self.db.find({"name": "Eddie", "number": {"$lte": 12}}, explain=True)
diff --git a/src/mango/test/13-users-db-find-test.py b/src/mango/test/13-users-db-find-test.py
index 9f9b53a81..11bca8a50 100644
--- a/src/mango/test/13-users-db-find-test.py
+++ b/src/mango/test/13-users-db-find-test.py
@@ -16,6 +16,7 @@ import mango, requests, unittest
# Re-enable once the _users db is implemented
+
class UsersDbFindTests(mango.UsersDbTests):
@classmethod
def setUpClass(klass):
diff --git a/src/mango/test/15-execution-stats-test.py b/src/mango/test/15-execution-stats-test.py
index 6ccc04b44..777fcffe0 100644
--- a/src/mango/test/15-execution-stats-test.py
+++ b/src/mango/test/15-execution-stats-test.py
@@ -33,9 +33,7 @@ class ExecutionStatsTests(mango.UserDocsTests):
assert "execution_stats" not in resp
def test_quorum_json_index(self):
- resp = self.db.find(
- {"age": {"$lt": 35}}, return_raw=True, executionStats=True
- )
+ resp = self.db.find({"age": {"$lt": 35}}, return_raw=True, executionStats=True)
self.assertEqual(len(resp["docs"]), 3)
self.assertEqual(resp["execution_stats"]["total_keys_examined"], 0)
self.assertEqual(resp["execution_stats"]["total_docs_examined"], 3)
diff --git a/src/mango/test/19-find-conflicts.py b/src/mango/test/19-find-conflicts.py
index 3bf3c0693..2f6829321 100644
--- a/src/mango/test/19-find-conflicts.py
+++ b/src/mango/test/19-find-conflicts.py
@@ -19,6 +19,7 @@ DOC = [{"_id": "doc", "a": 2}, {"_id": "doc1", "b": 2}]
CONFLICT = [{"_id": "doc", "_rev": "1-23202479633c2b380f79507a776743d5", "a": 1}]
CONFLICT2 = [{"_id": "doc1", "_rev": "1-23202479633c2b380f79507a776743d5", "b": 1}]
+
class ChooseCorrectIndexForDocs(mango.DbPerClass):
def setUp(self):
self.db.recreate()
diff --git a/src/mango/test/22-build-wait-selected-index.py b/src/mango/test/22-build-wait-selected-index.py
index fd856f4d6..76b60929e 100644
--- a/src/mango/test/22-build-wait-selected-index.py
+++ b/src/mango/test/22-build-wait-selected-index.py
@@ -28,23 +28,23 @@ class BuildAndWaitOnSelectedIndex(mango.DbPerClass):
def test_wait_for_query(self):
self.db.create_index(["val"], ddoc="my-ddoc", wait_for_built_index=False)
- explain = self.db.find({'val': {"$gt": 990}}, use_index="my-ddoc", explain=True)
+ explain = self.db.find({"val": {"$gt": 990}}, use_index="my-ddoc", explain=True)
self.assertEqual(explain["index"]["ddoc"], "_design/my-ddoc")
- docs = self.db.find({'val': {"$gte": 990}}, limit=10)
+ docs = self.db.find({"val": {"$gte": 990}}, limit=10)
self.assertEqual(len(docs), 10)
def test_dont_wait(self):
self.db.create_index(["val"], ddoc="my-ddoc", wait_for_built_index=False)
- explain = self.db.find({'val': {"$gt": 990}}, explain=True)
+ explain = self.db.find({"val": {"$gt": 990}}, explain=True)
self.assertEqual(explain["index"]["name"], "_all_docs")
- docs = self.db.find({'val': {"$gte": 990}})
+ docs = self.db.find({"val": {"$gte": 990}})
self.assertEqual(len(docs), 10)
def test_update_false(self):
self.db.create_index(["val"], ddoc="my-ddoc", wait_for_built_index=False)
- docs = self.db.find({'val': {"$gte": 990}}, update=False, use_index="my-ddoc")
+ docs = self.db.find({"val": {"$gte": 990}}, update=False, use_index="my-ddoc")
self.assertEqual(docs, [])
diff --git a/src/mango/test/user_docs.py b/src/mango/test/user_docs.py
index c30198347..12bc6f241 100644
--- a/src/mango/test/user_docs.py
+++ b/src/mango/test/user_docs.py
@@ -71,6 +71,7 @@ def setup(db, index_type="view", **kwargs):
add_text_indexes(db, kwargs)
db.save_docs(copy.deepcopy(DOCS))
+
def add_view_indexes(db, kwargs):
indexes = [
(["user_id"], "user_id"),
@@ -93,8 +94,10 @@ def add_view_indexes(db, kwargs):
(["ordered"], "ordered"),
]
for (idx, name) in indexes:
- assert db.create_index(idx, name=name, ddoc=name,
- wait_for_built_index=False) is True
+ assert (
+ db.create_index(idx, name=name, ddoc=name, wait_for_built_index=False)
+ is True
+ )
db.wait_for_built_indexes()