8000 Eliminate dependency on parameterized · prometheus/client_python@f62c7ce · GitHub
[go: up one dir, main page]

Skip to content

Commit f62c7ce

Browse files
committed
Eliminate dependency on parameterized
Signed-off-by: Emil Madsen <sovende@gmail.com>
1 parent d796bd5 commit f62c7ce

File tree

3 files changed

+26
-18
lines changed

3 files changed

+26
-18
lines changed

tests/test_asgi.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import sys
44
from unittest import TestCase
5-
from parameterized import parameterized
65

76
from prometheus_client import CollectorRegistry, Counter, generate_latest
87
from prometheus_client.exposition import CONTENT_TYPE_LATEST
@@ -81,13 +80,7 @@ def get_all_output(self):
8180
break
8281
return outputs
8382

84-
@parameterized.expand([
85-
["counter", "A counter", 2],
86-
["counter", "Another counter", 3],
87-
["requests", "Number of requests", 5],
88-
["failed_requests", "Number of failed requests", 7],
89-
])
90-
def test_reports_metrics(self, metric_name, help_text, increments):
83+
def validate_metrics(self, metric_name, help_text, increments):
9184
"""
9285
ASGI app serves the metrics from the provided registry.
9386
"""
@@ -116,3 +109,15 @@ def test_reports_metrics(self, metric_name, help_text, increments):
116109
self.assertIn("# HELP " + metric_name + "_total " + help_text + "\n", output)
117110
self.assertIn("# TYPE " + metric_name + "_total counter\n", output)
118111
self.assertIn(metric_name + "_total " + str(increments) + ".0\n", output)
112+
113+
def test_report_metrics_1(self):
114+
self.validate_metrics("counter", "A counter", 2)
115+
116+
def test_report_metrics_2(self):
117+
self.validate_metrics("counter", "Another counter", 3)
118+
119+
def test_report_metrics_3(self):
120+
self.validate_metrics("requests", "Number of requests", 5)
121+
122+
def test_report_metrics_4(self):
123+
self.validate_metrics("failed_requests", "Number of failed requests", 7)

tests/test_wsgi.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import sys
44
from unittest import TestCase
5-
from parameterized import parameterized
65
from wsgiref.util import setup_testing_defaults
76
from prometheus_client import make_wsgi_app
87

@@ -34,13 +33,7 @@ def assertIn(self, item, iterable):
3433
)
3534
)
3635

37-
@parameterized.expand([
38-
["counter", "A counter", 2],
39-
["counter", "Another counter", 3],
40-
["requests", "Number of requests", 5],
41-
["failed_requests", "Number of failed requests", 7],
42-
])
43-
def test_reports_metrics(self, metric_name, help_text, increments):
36+
def validate_metrics(self, metric_name, help_text, increments):
4437
"""
4538
WSGI app serves the metrics from the provided registry.
4639
"""
@@ -62,3 +55,15 @@ def test_reports_metrics(self, metric_name, help_text, increments):
6255
self.assertIn("# HELP " + metric_name + "_total " + help_text + "\n", output)
6356
self.assertIn("# TYPE " + metric_name + "_total counter\n", output)
6457
self.assertIn(metric_name + "_total " + str(increments) + ".0\n", output)
58+
59+
def test_report_metrics_1(self):
60+
self.validate_metrics("counter", "A counter", 2)
61+
62+
def test_report_metrics_2(self):
63+
self.validate_metrics("counter", "Another counter", 3)
64+
65+
def test_report_metrics_3(self):
66+
self.validate_metrics("requests", "Number of requests", 5)
67+
68+
def test_report_metrics_4(self):
69+
self.validate_metrics("failed_requests", "Number of failed requests", 7)

tox.ini

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ envlist = coverage-clean,py26,py27,py34,py35,py36,py37,py38,pypy,pypy3,{py27,py3
66
deps =
77
coverage
88
pytest
9-
parameterized
109

1110
[testenv:py26]
1211
; Last pytest and py version supported on py26 .
@@ -16,7 +15,6 @@ deps =
1615
pytest==2.9.2
1716
coverage
1817
futures
19-
parameterized
2018

2119
[testenv:py27]
2220
deps =

0 commit comments

Comments
 (0)
0