Skip to content

Commit

Permalink
Set __abstractmethods in sub class
Browse files Browse the repository at this point in the history
  • Loading branch information
zhongchun committed Feb 24, 2022
1 parent c27c29c commit 96c2b97
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 15 deletions.
5 changes: 0 additions & 5 deletions mars/metric/backends/console/tests/pytest.ini

This file was deleted.

31 changes: 21 additions & 10 deletions mars/metric/backends/tests/test_metric.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,10 @@


def test_dummy_metric():
Metric.__abstractmethods__ = set()

class DummyMetric(Metric):
pass

DummyMetric.__abstractmethods__ = set()
m = DummyMetric("dummy_metric", "A test metric", ("service", "tenant"))
assert isinstance(m, Metric)
assert m.name == "dummy_metric"
Expand All @@ -33,8 +32,11 @@ class DummyMetric(Metric):


def test_counter():
Counter.__abstractmethods__ = set()
c = Counter("test_counter", "A test counter", ("service", "tenant"))
class DummyCounter(Counter):
pass

DummyCounter.__abstractmethods__ = set()
c = DummyCounter("test_counter", "A test counter", ("service", "tenant"))
assert c.name == "test_counter"
assert c.description == "A test counter"
assert c.tag_keys == ("service", "tenant")
Expand All @@ -43,8 +45,11 @@ def test_counter():


def test_gauge():
Gauge.__abstractmethods__ = set()
g = Gauge("test_gauge", "A test gauge")
class DummyGauge(Gauge):
pass

DummyGauge.__abstractmethods__ = set()
g = DummyGauge("test_gauge", "A test gauge")
assert g.name == "test_gauge"
assert g.description == "A test gauge"
assert g.tag_keys == ()
Expand All @@ -53,8 +58,11 @@ def test_gauge():


def test_meter():
Meter.__abstractmethods__ = set()
m = Meter("test_meter")
class DummyMeter(Meter):
pass

DummyMeter.__abstractmethods__ = set()
m = DummyMeter("test_meter")
assert m.name == "test_meter"
assert m.description == ""
assert m.tag_keys == ()
Expand All @@ -63,8 +71,11 @@ def test_meter():


def test_histogram():
Histogram.__abstractmethods__ = set()
h = Histogram("test_histogram")
class DummyHistogram(Histogram):
pass

DummyHistogram.__abstractmethods__ = set()
h = DummyHistogram("test_histogram")
assert h.name == "test_histogram"
assert h.description == ""
assert h.tag_keys == ()
Expand Down

0 comments on commit 96c2b97

Please sign in to comment.