File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -157,7 +157,7 @@ def collect(self):
157157def mark_process_dead (pid , path = None ):
158158 """Do bookkeeping for when one process dies in a multi-process setup."""
159159 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' ) )
161161 for f in glob .glob (os .path .join (path , 'gauge_livesum_{0}.db' .format (pid ))):
162162 os .remove (f )
163163 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):
3030 self .tempdir = tempfile .mkdtemp ()
3131
3232 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 )
3535 values .ValueClass = MutexValue
3636 shutil .rmtree (self .tempdir )
3737
@@ -48,6 +48,12 @@ def test_deprecation_warning(self):
4848 assert issubclass (w [- 1 ].category , DeprecationWarning )
4949 assert "PROMETHEUS_MULTIPROC_DIR" in str (w [- 1 ].message )
5050
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+
5157
5258class TestMultiProcess (unittest .TestCase ):
5359 def setUp (self ):
You can’t perform that action at this time.
0 commit comments