Skip to content

Commit

Permalink
refac t
Browse files Browse the repository at this point in the history
  • Loading branch information
giampaolo committed Jan 13, 2024
1 parent d4ae6a0 commit 86f171a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions psutil/tests/__init__.py
Expand Up @@ -352,7 +352,7 @@ def wrapper(*args, **kwargs):

@_reap_children_on_err
def spawn_testproc(cmd=None, **kwds):
"""Creates a python subprocess which does nothing for 60 secs and
"""Create a python subprocess which does nothing for some secs and
return it as a subprocess.Popen instance.
If "cmd" is specified that is used instead of python.
By default stdin and stdout are redirected to /dev/null.
Expand All @@ -371,13 +371,13 @@ def spawn_testproc(cmd=None, **kwds):
CREATE_NO_WINDOW = 0x8000000
kwds.setdefault("creationflags", CREATE_NO_WINDOW)
if cmd is None:
testfn = get_testfn()
testfn = get_testfn(dir=os.getcwd())
try:
safe_rmpath(testfn)
pyline = (
"from time import sleep;"
"import time;"
+ "open(r'%s', 'w').close();" % testfn
+ "[sleep(0.1) for x in range(100)];" # 10 secs
+ "[time.sleep(0.1) for x in range(100)];" # 10 secs
)
cmd = [PYTHON_EXE, "-c", pyline]
sproc = subprocess.Popen(cmd, **kwds)
Expand Down

0 comments on commit 86f171a

Please sign in to comment.