mirror of
https://github.com/calibrain/shelfmark.git
synced 2026-09-24 21:00:31 +01:00
I've added a plugin using the same architecture as the prowlarr plugin to enable Newznab as a source. I've tested locally with nzbhydra2 and it all seems to work as intended. I've added some unit tests for this feature, and found that a couple of other unit tests weren't behaving so fixed those up while I was at it. I also ran all of the linters in the makefile against it and fixed those up, too, so hopefully this should be as clean and as compatible as it can be.
25 lines
721 B
Python
25 lines
721 B
Python
"""
|
|
Newznab test configuration.
|
|
|
|
Stubs out optional heavy dependencies (flask_socketio) that are not available
|
|
in lightweight dev/CI environments. These are only needed by the IRC source,
|
|
which is unrelated to the newznab plugin under test.
|
|
"""
|
|
|
|
import sys
|
|
import types
|
|
|
|
|
|
def _stub_module(name: str) -> None:
|
|
"""Insert a minimal stub module into sys.modules if not already present."""
|
|
if name not in sys.modules:
|
|
stub = types.ModuleType(name)
|
|
# Provide no-op stand-ins for the symbols IRC source imports.
|
|
stub.SocketIO = object
|
|
stub.join_room = lambda *a, **kw: None
|
|
stub.leave_room = lambda *a, **kw: None
|
|
sys.modules[name] = stub
|
|
|
|
|
|
_stub_module("flask_socketio")
|