Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
C
coderai
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexlab
coderai
Commits
9537c9b8
Commit
9537c9b8
authored
May 06, 2026
by
Stefy Lanza (nextime / spora )
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: add wget-based managed sample downloads
parent
04342a42
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
68 additions
and
0 deletions
+68
-0
test_manual_multimodal_test_client.py
tests/test_manual_multimodal_test_client.py
+56
-0
manual_multimodal_test_client.py
tools/manual_multimodal_test_client.py
+12
-0
No files found.
tests/test_manual_multimodal_test_client.py
View file @
9537c9b8
from
pathlib
import
Path
import
subprocess
import
tools.manual_multimodal_test_client
as
manual_multimodal_test_client
from
tools.manual_multimodal_test_client
import
(
MODE_DEFAULTS
,
_download_artifact
,
build_request_spec
,
build_parser
,
download_default_sample
,
choose_mode_interactively
,
ensure_sample_file
,
execute_request
,
...
...
@@ -228,6 +232,58 @@ def test_ensure_sample_file_downloads_missing_managed_default_for_absolute_path(
assert
managed_path
.
read_bytes
()
==
b
"wav"
def
test_ensure_sample_file_rejects_missing_explicit_override
(
tmp_path
):
missing_path
=
tmp_path
/
"custom.wav"
with
pytest
.
raises
(
FileNotFoundError
,
match
=
rf
"File not found: {missing_path}
\
. Supply --audio-file
\
."
):
ensure_sample_file
(
str
(
missing_path
),
"--audio-file"
)
def
test_download_default_sample_runs_wget_and_returns_path
(
tmp_path
,
monkeypatch
):
sample_path
=
tmp_path
/
"samples"
/
"transcription.wav"
recorded
=
{}
def
fake_run
(
command
,
check
):
recorded
[
"command"
]
=
command
recorded
[
"check"
]
=
check
sample_path
.
parent
.
mkdir
(
parents
=
True
,
exist_ok
=
True
)
sample_path
.
write_bytes
(
b
"downloaded-wav"
)
monkeypatch
.
setattr
(
"tools.manual_multimodal_test_client.SAMPLE_URLS"
,
{
"samples/transcription.wav"
:
"https://example.invalid/transcription.wav"
},
)
monkeypatch
.
setattr
(
manual_multimodal_test_client
.
subprocess
,
"run"
,
fake_run
,
raising
=
False
)
result
=
download_default_sample
(
sample_path
)
assert
result
==
sample_path
assert
recorded
[
"command"
]
==
[
"wget"
,
"-O"
,
str
(
sample_path
),
"https://example.invalid/transcription.wav"
,
]
assert
recorded
[
"check"
]
is
True
assert
sample_path
.
read_bytes
()
==
b
"downloaded-wav"
def
test_download_default_sample_wraps_wget_failure
(
tmp_path
,
monkeypatch
):
sample_path
=
tmp_path
/
"samples"
/
"question-video.mp4"
def
fake_run
(
command
,
check
):
raise
subprocess
.
CalledProcessError
(
returncode
=
1
,
cmd
=
command
)
monkeypatch
.
setattr
(
"tools.manual_multimodal_test_client.SAMPLE_URLS"
,
{
"samples/question-video.mp4"
:
"https://example.invalid/question-video.mp4"
},
)
monkeypatch
.
setattr
(
manual_multimodal_test_client
.
subprocess
,
"run"
,
fake_run
,
raising
=
False
)
with
pytest
.
raises
(
FileNotFoundError
,
match
=
r"Unable to download required default file"
):
download_default_sample
(
sample_path
)
def
test_build_request_spec_for_llm_uses_chat_completions_payload
(
tmp_path
):
config
=
{
"mode"
:
"llm"
,
...
...
tools/manual_multimodal_test_client.py
View file @
9537c9b8
...
...
@@ -3,6 +3,7 @@ from __future__ import annotations
import
argparse
import
base64
import
json
import
subprocess
import
time
from
contextlib
import
ExitStack
from
pathlib
import
Path
...
...
@@ -103,6 +104,17 @@ def _require_file(path_value: str | None, flag_name: str) -> Path:
def
download_default_sample
(
path
:
Path
)
->
Path
:
key
=
_managed_sample_key
(
path
)
url
=
SAMPLE_URLS
.
get
(
key
)
if
url
is
None
:
raise
FileNotFoundError
(
f
"No managed sample source configured for {path}."
)
path
.
parent
.
mkdir
(
parents
=
True
,
exist_ok
=
True
)
try
:
subprocess
.
run
([
"wget"
,
"-O"
,
str
(
path
),
url
],
check
=
True
)
except
subprocess
.
CalledProcessError
as
exc
:
raise
FileNotFoundError
(
f
"Unable to download required default file: {path}"
)
from
exc
if
not
path
.
exists
():
raise
FileNotFoundError
(
f
"Unable to download required default file: {path}"
)
return
path
...
...
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