Skip to content

test(tools): fix mocking for faster_whisper, Python 3.14 stat, and sy… - #6375

Closed
CharlieKerfoot wants to merge 1 commit into
NousResearch:mainfrom
CharlieKerfoot:fix/test-mocking-issues
Closed

test(tools): fix mocking for faster_whisper, Python 3.14 stat, and sy…#6375
CharlieKerfoot wants to merge 1 commit into
NousResearch:mainfrom
CharlieKerfoot:fix/test-mocking-issues

Conversation

@CharlieKerfoot

Copy link
Copy Markdown
Contributor

Problem

  • Transcription tests fail on import when faster_whisper is not installed
  • test_stat_oserror fails on Python 3.14 because Path.exists()/Path.is_file() no longer delegate to Path.stat()
  • test_update_gateway_restart fails on non-Linux platforms because is_linux() isn't mocked

Fix

  • Inject a sys.modules stub for faster_whisper in both transcription test files
  • Simplify test_stat_oserror to patch Path.stat directly and assert the validation function returns an error (no call_count threshold)
  • Mock is_linux → True in the gateway restart test

Testing

  • All three test files pass on macOS with Python 3.14

@teknium1

Copy link
Copy Markdown
Contributor

Thank you for the cross-platform test stabilization work. This is now superseded by current main.

  • Current main has a stronger faster_whisper test stub, including a ModuleSpec to keep find_spec() safe during collection: tests/tools/test_transcription_tools.py:18-26 (d682f320b).
  • The stat-error case is already version-independent by mocking Path.exists, Path.is_file, and the explicit Path.stat() call: tests/tools/test_transcription_tools.py:794-805 (d682f320b).
  • The gateway restart test file this PR modifies has since been removed from current main.

Automated hermes-sweeper review.

@teknium1 teknium1 closed this Jul 12, 2026
@teknium1 teknium1 added the sweeper:implemented-on-main Sweeper: behavior already present on current main label Jul 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low — cosmetic, nice to have sweeper:implemented-on-main Sweeper: behavior already present on current main tool/tts Text-to-speech and transcription type/test Test coverage or test infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants