Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 14 additions & 11 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import atexit
import base64
import datetime
import io
Expand Down Expand Up @@ -1362,9 +1363,10 @@ def delete_by_path(config_dict: dict, path: str) -> None:
continue

# Delete specified paths in this stage
for path in delete_paths:
if path: # Skip empty paths
delete_by_path(target_stage, path)
# Avoid shadowing the original YAML Path used for the output filename below.
for delete_path in delete_paths:
if delete_path: # Skip empty paths
delete_by_path(target_stage, delete_path)
elif "." in key:
# Delete using dot-separated path
delete_by_path(config, key)
Expand Down Expand Up @@ -1394,15 +1396,15 @@ def delete_by_path(config_dict: dict, path: str) -> None:
raise KeyError(f"Stage ID {stage_id} not found, available: {available_ids}")

# Apply updates to this stage
for path, val in stage_updates.items():
for update_path, val in stage_updates.items():
# Check if this is a simple key (not dot-separated)
# Example: 'engine_input_source' vs 'engine_args.max_model_len'
if "." not in path:
if "." not in update_path:
# Direct key assignment (e.g., updating a list value)
target_stage[path] = val
target_stage[update_path] = val
else:
# Dot-separated path (e.g., nested dict access)
apply_update(target_stage, path, val)
apply_update(target_stage, update_path, val)
elif "." in key:
# Apply using dot-separated path
apply_update(config, key, value)
Expand All @@ -1414,13 +1416,14 @@ def delete_by_path(config_dict: dict, path: str) -> None:
# within the same second (e.g. test_qwen3_omni_expansion imports both
# get_chunk_config and get_batch_token_config). int(time.time()) would collide
# and the later write would overwrite the earlier YAML on disk.
base_name = yaml_path.rsplit(".", 1)[0] if "." in yaml_path else yaml_path
output_path = f"{base_name}_{time.time_ns()}.yaml"
# Keep generated configs outside the repo and delete them when pytest exits.
output_fd, output_path = tempfile.mkstemp(prefix=f"{path.stem}_", suffix=".yaml")
atexit.register(Path(output_path).unlink, missing_ok=True)

with open(output_path, "w", encoding="utf-8") as f:
with os.fdopen(output_fd, "w", encoding="utf-8") as f:
yaml.dump(config, f, default_flow_style=None, sort_keys=False, allow_unicode=True, indent=2)

return output_path
return str(output_path)


class OmniServer:
Expand Down
Loading