Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
dynamo
Commits
45bc1b79
Unverified
Commit
45bc1b79
authored
Feb 11, 2026
by
MatejKosec
Committed by
GitHub
Feb 11, 2026
Browse files
fix: use tempfile.TemporaryDirectory in load generator test (#6196)
Signed-off-by:
Matej Kosec
<
mkosec@nvidia.com
>
parent
4220771f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
10 deletions
+12
-10
tests/planner/test_load_generator.py
tests/planner/test_load_generator.py
+12
-10
No files found.
tests/planner/test_load_generator.py
View file @
45bc1b79
...
@@ -10,6 +10,7 @@ preventing orphaned child processes from holding pipe FDs and causing hangs.
...
@@ -10,6 +10,7 @@ preventing orphaned child processes from holding pipe FDs and causing hangs.
import
asyncio
import
asyncio
import
signal
import
signal
import
tempfile
from
unittest.mock
import
AsyncMock
,
MagicMock
,
patch
from
unittest.mock
import
AsyncMock
,
MagicMock
,
patch
import
pytest
import
pytest
...
@@ -23,7 +24,7 @@ pytestmark = [
...
@@ -23,7 +24,7 @@ pytestmark = [
]
]
def
test_timeout_kills_process_group
(
tmp_path
):
def
test_timeout_kills_process_group
():
"""On timeout, the entire process group must be killed via os.killpg."""
"""On timeout, the entire process group must be killed via os.killpg."""
target_pid
=
99999
target_pid
=
99999
generator
=
LoadGenerator
()
generator
=
LoadGenerator
()
...
@@ -42,13 +43,14 @@ def test_timeout_kills_process_group(tmp_path):
...
@@ -42,13 +43,14 @@ def test_timeout_kills_process_group(tmp_path):
raise
asyncio
.
TimeoutError
()
raise
asyncio
.
TimeoutError
()
async
def
_run
():
async
def
_run
():
with
tempfile
.
TemporaryDirectory
()
as
tmp_dir
:
with
(
with
(
patch
(
"asyncio.create_subprocess_exec"
,
side_effect
=
fake_exec
),
patch
(
"asyncio.create_subprocess_exec"
,
side_effect
=
fake_exec
),
patch
(
"asyncio.wait_for"
,
side_effect
=
fake_wait_for
),
patch
(
"asyncio.wait_for"
,
side_effect
=
fake_wait_for
),
patch
(
"os.killpg"
)
as
mock_killpg
,
patch
(
"os.killpg"
)
as
mock_killpg
,
):
):
with
pytest
.
raises
(
RuntimeError
,
match
=
"timed out"
):
with
pytest
.
raises
(
RuntimeError
,
match
=
"timed out"
):
await
generator
.
generate_load
(
1.0
,
1
,
str
(
tmp_path
)
)
await
generator
.
generate_load
(
1.0
,
1
,
tmp_dir
)
mock_killpg
.
assert_called_once_with
(
target_pid
,
signal
.
SIGKILL
)
mock_killpg
.
assert_called_once_with
(
target_pid
,
signal
.
SIGKILL
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment