@@ -106,10 +106,11 @@ def handle_aws_lambda() -> None:
106106 env ["TEST_LAMBDA_DIRECTORY" ] = str (target_dir )
107107 env .setdefault ("AWS_REGION" , "us-east-1" )
108108 dirs = ["pymongo" , "gridfs" , "bson" ]
109- # Store the original .so files.
110- before_sos = []
109+ # Remove the original .so files.
111110 for dname in dirs :
112- before_sos .extend (f"{ f .parent .name } /{ f .name } " for f in (ROOT / dname ).glob ("*.so" ))
111+ so_paths = [f"{ f .parent .name } /{ f .name } " for f in (ROOT / dname ).glob ("*.so" )]
112+ for so_path in list (so_paths ):
113+ Path (so_path ).unlink ()
113114 # Build the c extensions.
114115 docker = which ("docker" ) or which ("podman" )
115116 if not docker :
@@ -122,17 +123,11 @@ def handle_aws_lambda() -> None:
122123 target = ROOT / "test/lambda/mongodb" / dname
123124 shutil .rmtree (target , ignore_errors = True )
124125 shutil .copytree (ROOT / dname , target )
125- print ("******" , target , os .listdir (target ))
126- # Remove the original so files from the lambda directory.
127- for so_path in before_sos :
128- print ("removing file" , so_path )
129- (ROOT / "test/lambda/mongodb" / so_path ).unlink ()
130126 # Remove the new so files from the ROOT directory.
131127 for dname in dirs :
132128 so_paths = [f"{ f .parent .name } /{ f .name } " for f in (ROOT / dname ).glob ("*.so" )]
133129 for so_path in list (so_paths ):
134- if so_path not in before_sos :
135- Path (so_path ).unlink ()
130+ Path (so_path ).unlink ()
136131
137132 script_name = "run-deployed-lambda-aws-tests.sh"
138133 run_command (f"bash { DRIVERS_TOOLS } /.evergreen/aws_lambda/{ script_name } " , env = env )
0 commit comments