Skip to content

Commit d0ccfc2

Browse files
committed
mypy: Make it work, part 3
1 parent 847a8ff commit d0ccfc2

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

docs/source/crate_operator_ext.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def run_apidoc(_):
4747

4848
def missing_reference(
4949
app: Sphinx, env: BuildEnvironment, node: pending_xref, contnode: Element
50-
) -> Element:
50+
) -> None:
5151
"""
5252
Remove or resolve references to third party packages.
5353
@@ -70,7 +70,6 @@ def missing_reference(
7070
node.attributes["reftarget"] = "aiopg." + reftarget[17:]
7171
elif reftarget.startswith("aiopg.cursor."):
7272
node.attributes["reftarget"] = "aiopg." + reftarget[13:]
73-
return node
7473

7574

7675
def setup(app):

tests/test_metrics.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,14 @@
1919
# with Crate these terms will supersede the license and you may use the
2020
# software solely pursuant to the terms of the relevant commercial agreement.
2121

22-
# mypy: disable-error-code="union-attr"
22+
# mypy: disable-error-code="attr-defined, arg-type, union-attr"
2323

2424
import logging
2525
import time
2626

2727
from prometheus_client import REGISTRY
2828

29-
from crate.operator.prometheus import ( # type: ignore[attr-defined]
30-
PrometheusClusterStatus,
31-
report_cluster_status,
32-
)
29+
from crate.operator.prometheus import PrometheusClusterStatus, report_cluster_status
3330

3431
logger = logging.getLogger(__name__)
3532

@@ -52,15 +49,15 @@ def test_will_report_metrics_for_clusters():
5249
)
5350
cloud_clusters_last_seen = next(
5451
filter(
55-
lambda s: s.labels["cluster_id"] == "id", cloud_clusters_last_seen.samples # type: ignore[arg-type] # noqa: E501
52+
lambda s: s.labels["cluster_id"] == "id", cloud_clusters_last_seen.samples
5653
),
5754
None,
5855
)
59-
assert cloud_clusters_health_sample.value == 0 # type: ignore[attr-defined] # noqa: E501
60-
assert cloud_clusters_last_seen.value == last_reported # type: ignore[attr-defined] # noqa: E501
61-
assert cloud_clusters_health_sample.labels["exported_namespace"] == "ns1" # type: ignore[attr-defined] # noqa: E501
62-
assert cloud_clusters_last_seen.labels["exported_namespace"] == "ns1" # type: ignore[attr-defined] # noqa: E501
63-
assert cloud_clusters_last_seen.labels["cluster_name"] == "cluster-name" # type: ignore[attr-defined] # noqa: E501
56+
assert cloud_clusters_health_sample.value == 0
57+
assert cloud_clusters_last_seen.value == last_reported
58+
assert cloud_clusters_health_sample.labels["exported_namespace"] == "ns1"
59+
assert cloud_clusters_last_seen.labels["exported_namespace"] == "ns1"
60+
assert cloud_clusters_last_seen.labels["cluster_name"] == "cluster-name"
6461

6562

6663
def test_will_expire_clusters_that_have_not_reported_for_a_while():

0 commit comments

Comments
 (0)