File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change 11import asyncio
22import logging
3- import os
43import platform
54import random
65import re
7- import signal
86import subprocess
97import time
108import uuid
@@ -148,8 +146,14 @@ def inject_fixtures(self, caplog):
148146 @staticmethod
149147 def kill_chrome ():
150148 for proc in psutil .process_iter (["pid" , "name" ]):
151- if proc .info ["name" ].lower () in ("chrome" , "chromium" ):
152- os .kill (proc .info ["pid" ], signal .SIGKILL )
149+ started_time = proc .create_time () # seconds since since January 1, 1970 UTC
150+ # only consider processes started in the last 10 seconds
151+ if not started_time >= time .time () - 10 :
152+ continue
153+ name = proc .info ["name" ].lower ()
154+ if "chrome" in name or "chromium" in name :
155+ proc .kill ()
156+ print ("Killed process:" , proc )
153157
154158 @allow_windows
155159 async def test_browser_closed_restart (self ):
You can’t perform that action at this time.
0 commit comments