Skip to content

refactor(clip_manager): move videomama loader inside a safer loop #181

@Mogi83

Description

@Mogi83

Bringing up this issue that was discovered while I was writing tests, here is the comment:

All checks pass now, however I wanted to explain the fix I put in place:

Previously test_videomama_cleanup_on_failure was failing on 3.10 because of dynamic local import of a module that isn't on the global sys.path until the function executes. Standard patch() attempts to resolve this path during test setup, which fails in 3.10’s stricter import environment.

The test now uses pytest.raises because load_videomama_model currently sits outside the main try/except safety net in clip_manager.py. While the test is now green, moving this loader inside the error-handling loop is highly recommended to improve stability.

I left a comment for the next maintainer and will consider a PR to fix that issue.

Originally posted by @Mogi83 in #111 (comment)

Fixing the issue:

A suggested fix would be to encapsulate the loader itself.Move the load_videomama_model call inside the clips_to_process loop or into its own guarded initialization block.

Testing awareness:

The current test_videomama_cleanup_on_failure relies on pytest.raises. If the loader is moved inside the internal try/except block, this test will need to be updated to assert against caplog instead of expecting a raised exception.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions