File tree Expand file tree Collapse file tree 2 files changed +16
-16
lines changed
Expand file tree Collapse file tree 2 files changed +16
-16
lines changed Original file line number Diff line number Diff line change @@ -444,16 +444,16 @@ async def test_metadata(self, simple_client):
444444 options = client .options
445445 assert len (bson .encode (options .pool_options .metadata )) <= _MAX_METADATA_SIZE
446446
447- @mock .patch .dict ("os.environ" , {ENV_VAR_K8S : "1" })
448447 async def test_container_metadata (self , simple_client ):
449- metadata = copy .deepcopy (_METADATA )
450- metadata ["driver" ]["name" ] = "PyMongo|async"
451- metadata ["env" ] = {}
452- metadata ["env" ]["container" ] = {"orchestrator" : "kubernetes" }
448+ with mock .patch ("os.environ" , {ENV_VAR_K8S : "1" }):
449+ metadata = copy .deepcopy (_METADATA )
450+ metadata ["driver" ]["name" ] = "PyMongo|async"
451+ metadata ["env" ] = {}
452+ metadata ["env" ]["container" ] = {"orchestrator" : "kubernetes" }
453453
454- client = await simple_client ("mongodb://foo:27017/?appname=foobar&connect=false" )
455- options = client .options
456- assert options .pool_options .metadata ["env" ] == metadata ["env" ]
454+ client = await simple_client ("mongodb://foo:27017/?appname=foobar&connect=false" )
455+ options = client .options
456+ assert options .pool_options .metadata ["env" ] == metadata ["env" ]
457457
458458 async def test_kwargs_codec_options (self , simple_client ):
459459 class MyFloatType :
Original file line number Diff line number Diff line change @@ -426,16 +426,16 @@ def test_metadata(self, simple_client):
426426 options = client .options
427427 assert len (bson .encode (options .pool_options .metadata )) <= _MAX_METADATA_SIZE
428428
429- @mock .patch .dict ("os.environ" , {ENV_VAR_K8S : "1" })
430429 def test_container_metadata (self , simple_client ):
431- metadata = copy .deepcopy (_METADATA )
432- metadata ["driver" ]["name" ] = "PyMongo"
433- metadata ["env" ] = {}
434- metadata ["env" ]["container" ] = {"orchestrator" : "kubernetes" }
430+ with mock .patch ("os.environ" , {ENV_VAR_K8S : "1" }):
431+ metadata = copy .deepcopy (_METADATA )
432+ metadata ["driver" ]["name" ] = "PyMongo"
433+ metadata ["env" ] = {}
434+ metadata ["env" ]["container" ] = {"orchestrator" : "kubernetes" }
435435
436- client = simple_client ("mongodb://foo:27017/?appname=foobar&connect=false" )
437- options = client .options
438- assert options .pool_options .metadata ["env" ] == metadata ["env" ]
436+ client = simple_client ("mongodb://foo:27017/?appname=foobar&connect=false" )
437+ options = client .options
438+ assert options .pool_options .metadata ["env" ] == metadata ["env" ]
439439
440440 def test_kwargs_codec_options (self , simple_client ):
441441 class MyFloatType :
You can’t perform that action at this time.
0 commit comments