8000 ajustes circle-ci · engFelipeMonteiro/client_python@bc90ab4 · GitHub
[go: up one dir, main page]

Skip to content

Commit bc90ab4

Browse files
ajustes circle-ci
Signed-off-by: Felipe Monteiro Jácome <fmj1988@gmail.com>
1 parent 62b91f9 commit bc90ab4

File tree

5 files changed

+22
-18
lines changed

5 files changed

+22
-18
lines changed

prometheus_client/metrics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
from threading import Lock
22
import time
33
import types
4-
import pandas as pd
54
from typing import (
65
Any, Callable, Dict, Iterable, Optional, Sequence, Type, TypeVar, Union,
76
)
87

8+
import pandas as pd
99
from . import values # retain this import style for testability
1010
from .context_managers import ExceptionCounter, InprogressTracker, Timer
1111
from .metrics_core import (

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
},
2929
extras_require={
3030
'twisted': ['twisted'],
31+
'pandas': ['pandas'],
3132
},
3233
test_suite="tests",
3334
python_requires=">=3.6",

tests/test_exposition.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
import time
44
import unittest
55

6-
import pytest
76
import pandas as pd
7+
import pytest
88

99
from prometheus_client import (
1010
CollectorRegistry, CONTENT_TYPE_LATEST, core, Counter, delete_from_gateway,
@@ -204,9 +204,9 @@ def test_gauge_pandas(self):
204204
ou
205205
PandasGauge('report_pandas', 'metric description', df=df, columns=['columnn01', 'column02'], registry=self.registry)
206206
"""
207-
df = pd.DataFrame({'a': [1.1, 2.2, 3.3, 4.4], 'b':[5.1, 6.2, 7.3, 8.4], 'value': [1, 2, 3, 4]})
208-
df2 = pd.DataFrame({'c': [1.1, 2.2, 3.3, 4.4], 'd':[5.1, 6.2, 7.3, 8.4], 'value': [5, 6, 7, 8]})
209-
PandasGauge('report_pandas', 'metric description', df=df, columns= ['a', 'b', 'value'], registry=self.registry)
207+
df = pd.DataFrame({'a': [1.1, 2.2, 3.3, 4.4], 'b': [5.1, 6.2, 7.3, 8.4], 'value': [1, 2, 3, 4]})
208+
df2 = pd.DataFrame({'c': [1.1, 2.2, 3.3, 4.4], 'd': [5.1, 6.2, 7.3, 8.4], 'value': [5, 6, 7, 8]})
209+
PandasGauge('report_pandas', 'metric description', df=df, columns=['a', 'b', 'value'], registry=self.registry)
210210
g2 = PandasGauge('report_panda2s', 'metric description2', df=df2, registry=self.registry)
211211

212212
self.assertEqual(
@@ -253,10 +253,10 @@ def tes 10000 t_gauge_pandas_columns(self):
253253
ou
254254
PandasGauge('report_pandas', 'metric description', df=df, columns=['columnn01', 'column02'], registry=self.registry)
255255
"""
256-
df = pd.DataFrame({'a': [1.1, 2.2, 3.3, 4.4], 'b':[5.1, 6.2, 7.3, 8.4], 'value': [1, 2, 3, 4]})
257-
df2 = pd.DataFrame({'c': [1.1, 2.2, 3.3, 4.4], 'd':[5.1, 6.2, 7.3, 8.4], 'result': [5, 6, 7, 8]})
258-
PandasGauge('report_pandas', 'metric description', df=df, columns= ['a', 'value'], registry=self.registry)
259-
g2 = PandasGauge('report_panda2s', 'metric description2', df=df2, columns=['d', 'result'],value='result' ,registry=self.registry)
256+
df = pd.DataFrame({'a': [1.1, 2.2, 3.3, 4.4], 'b': [5.1, 6.2, 7.3, 8.4], 'value': [1, 2, 3, 4]})
257+
df2 = pd.DataFrame({'c': [1.1, 2.2, 3.3, 4.4], 'd': [5.1, 6.2, 7.3, 8.4], 'result': [5, 6, 7, 8]})
258+
PandasGauge('report_pandas', 'metric description', df=df, columns=['a', 'value'], registry=self.registry)
259+
g2 = PandasGauge('report_panda2s', 'metric description2', df=df2, columns=['d', 'result'],value='result' , registry=self.registry)
260260

261261
self.assertEqual(
262262
b'# HELP report_pandas metric description\n'
@@ -274,6 +274,7 @@ def test_gauge_pandas_columns(self):
274274
generate_latest(self.registry)
275275
)
276276

277+
277278
class TestPushGateway(unittest.TestCase):
278279
def setUp(self):
279280
redirect_flag = 'testFlag'

tests/test_registry.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1-
import pytest
21
import pandas as pd
2+
import pytest
3+
from prometheus_client.metrics import Gauge, PandasGauge
34
from prometheus_client.registry import CollectorRegistry
4-
from prometheus_client.metrics import Gauge, PandasGauge, PandasGauge
5+
56

67
def test_collector_registry_init():
78
registry = CollectorRegistry()
89
assert registry._collector_to_names == {}
910
assert registry._names_to_collectors == {}
10-
assert registry._auto_describe == False
11+
assert not registry._auto_describe
1112
assert str(type(registry._lock)) == "<class '_thread.lock'>"
12-
assert registry._target_info == None
13+
assert registry._target_info is None
1314

1415

1516
@pytest.mark.skip('wip')
@@ -23,14 +24,14 @@ def test_collector_registry_gauge():
2324
assert '_metrics' not in vars(registry._names_to_collectors['raid_status'])
2425

2526
G = Gauge('raid_status2', '1 if raid array is okay', ['label1'], registry=registry)
26-
#G.labels('a').set(10)
27-
#G.labels('b').set(11)
28-
#G.labels('c').set(12)
29-
#G.labels('c').set(13)
27+
# G.labels('a').set(10)
28+
# G.labels('b').set(11)
29+
# G.labels('c').set(12)
30+
# G.labels('c').set(13)
3031

3132
assert registry._names_to_collectors['raid_status2']._labelnames == ('label1',)
3233
'_metrics' in vars(registry._names_to_collectors['raid_status2'])
3334

3435
registry2 = CollectorRegistry()
3536
GP = PandasGauge('raid_status2', '1 if raid array is okay', ['label1'], registry=registry2)
36-
assert type(GP._metrics) == pd.core.frame.DataFrame
37+
assert type(GP._metrics) == pd.core.frame.DataFrame

tox.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ deps =
77
coverage
88
pytest
99
attrs
10+
pandas
1011

1112
[testenv]
1213
deps =

0 commit comments

Comments
 (0)
0