1
1
from __future__ import unicode_literals
2
2
3
3
from concurrent .futures import ThreadPoolExecutor
4
- import inspect
5
4
import time
6
5
7
6
import pytest
12
11
HistogramMetricFamily , Info , InfoMetricFamily , Metric , Sample ,
13
12
StateSetMetricFamily , Summary , SummaryMetricFamily , UntypedMetricFamily ,
14
13
)
14
+ from prometheus_client .decorator import getargspec
15
15
16
16
try :
17
17
import unittest2 as unittest
@@ -46,7 +46,7 @@ def f(r):
46
46
else :
47
47
raise TypeError
48
48
49
- self .assertEqual ((["r" ], None , None , None ), inspect . getargspec (f ))
49
+ self .assertEqual ((["r" ], None , None , None ), getargspec (f ))
50
50
51
51
try :
52
52
f (False )
@@ -107,7 +107,7 @@ def test_inprogress_function_decorator(self):
107
107
def f ():
108
108
self .assertEqual (1 , self .registry .get_sample_value ('g' ))
109
109
110
- self .assertEqual (([], None , None , None ), inspect . getargspec (f ))
110
+ self .assertEqual (([], None , None , None ), getargspec (f ))
111
111
112
112
f ()
113
113
self .assertEqual (0 , self .registry .get_sample_value ('g' ))
@@ -134,7 +134,7 @@ def test_time_function_decorator(self):
134
134
def f ():
135
135
time .sleep (.001 )
136
136
137
- self .assertEqual (([], None , None , None ), inspect . getargspec (f ))
137
+ self .assertEqual (([], None , None , None ), getargspec (f ))
138
138
139
139
f ()
140
140
self .assertNotEqual (0 , self .registry .get_sample_value ('g' ))
@@ -204,7 +204,7 @@ def test_function_decorator(self):
204
204
def f ():
205
205
pass
206
206
207
- self .assertEqual (([], None , None , None ), inspect . getargspec (f ))
207
+ self .assertEqual (([], None , None , None ), getargspec (f ))
208
208
209
209
f ()
210
210
self .assertEqual (1 , self .registry .get_sample_value ('s_count' ))
@@ -345,7 +345,7 @@ def test_function_decorator(self):
345
345
def f ():
346
346
pass
347
347
348
- self .assertEqual (([], None , None , None ), inspect . getargspec (f ))
348
+ self .assertEqual (([], None , None , None ), getargspec (f ))
349
349
350
350
f ()
351
351
self .assertEqual (1 , self .registry .get_sample_value ('h_count' ))
@@ -753,7 +753,7 @@ def test_restricted_registry(self):
753
753
754
754
m = Metric ('s' , 'help' , 'summary' )
755
755
m .samples = [Sample ('s_sum' , {}, 7 )]
756
- self .assertEquals ([m ], registry .restricted_registry (['s_sum' ]).collect ())
756
+ self .assertEqual ([m ], registry .restricted_registry (['s_sum' ]).collect ())
757
757
758
758
def test_target_info_injected (self ):
759
759
registry = CollectorRegistry (target_info = {'foo' : 'bar' })
@@ -777,11 +777,11 @@ def test_target_info_restricted_registry(self):
777
777
778
778
m = Metric ('s' , 'help' , 'summary' )
779
779
m .samples = [Sample ('s_sum' , {}, 7 )]
780
- self .assertEquals ([m ], registry .restricted_registry (['s_sum' ]).collect ())
780
+ self .assertEqual ([m ], registry .restricted_registry (['s_sum' ]).collect ())
781
781
782
782
m = Metric ('target' , 'Target metadata' , 'info' )
783
783
m .samples = [Sample ('target_info' , {'foo' : 'bar' }, 1 )]
784
- self .assertEquals ([m ], registry .restricted_registry (['target_info' ]).collect ())
784
+ self .assertEqual ([m ], registry .restricted_registry (['target_info' ]).collect ())
785
785
786
786
787
787
if __name__ == '__main__' :
0 commit comments