File tree 2 files changed +9
-3
lines changed
2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -157,7 +157,7 @@ def collect(self):
157
157
def mark_process_dead (pid , path = None ):
158
158
"""Do bookkeeping for when one process dies in a multi-process setup."""
159
159
if path is None :
160
- path = os .environ .get ('PROMETHEUS_MULTIPROC_DIR' )
160
+ path = os .environ .get ('PROMETHEUS_MULTIPROC_DIR' , os . environ . get ( 'prometheus_multiproc_dir' ) )
161
161
for f in glob .glob (os .path .join (path , 'gauge_livesum_{0}.db' .format (pid ))):
162
162
os .remove (f )
163
163
for f in glob .glob (os .path .join (path , 'gauge_liveall_{0}.db' .format (pid ))):
Original file line number Diff line number Diff line change @@ -30,8 +30,8 @@ def setUp(self):
30
30
self .tempdir = tempfile .mkdtemp ()
31
31
32
32
def tearDown (self ):
33
- del os .environ [ 'prometheus_multiproc_dir' ]
34
- del os .environ [ 'PROMETHEUS_MULTIPROC_DIR' ]
33
+ os .environ . pop ( 'prometheus_multiproc_dir' , None )
34
+ os .environ . pop ( 'PROMETHEUS_MULTIPROC_DIR' , None )
35
35
values .ValueClass = MutexValue
36
36
shutil .rmtree (self .tempdir )
37
37
@@ -48,6 +48,12 @@ def test_deprecation_warning(self):
48
48
assert issubclass (w [- 1 ].category , DeprecationWarning )
49
49
assert "PROMETHEUS_MULTIPROC_DIR" in str (w [- 1 ].message )
50
50
51
+ def test_mark_process_dead_respects_lowercase (self ):
52
+ os .environ ['prometheus_multiproc_dir' ] = self .tempdir
53
+ # Just test that this does not raise with a lowercase env var. The
54
+ # logic is tested elsewhere.
55
+ mark_process_dead (123 )
56
+
51
57
52
58
class TestMultiProcess (unittest .TestCase ):
53
59
def setUp (self ):
You can’t perform that action at this time.
0 commit comments