tests: _FakeRoutes mock covers put/patch so the full suite can collect
The fake routes object installed into sys.modules as `server` only defined get/post/delete; server.py also registers put (models) and patch (media), so importing the real server.py during collection (e.g. test_server.py) raised AttributeError and aborted the whole run. Add put/patch to the mock. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
fa3a884528
commit
e4e2f90484
@@ -7,15 +7,23 @@ sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
|
||||
|
||||
|
||||
class _FakeRoutes:
|
||||
# Mirror every verb server.py registers (this fake is installed into sys.modules
|
||||
# as `server`, so a real server.py import elsewhere registers against it).
|
||||
def get(self, _p):
|
||||
return lambda f: f
|
||||
|
||||
def post(self, _p):
|
||||
return lambda f: f
|
||||
|
||||
def put(self, _p):
|
||||
return lambda f: f
|
||||
|
||||
def delete(self, _p):
|
||||
return lambda f: f
|
||||
|
||||
def patch(self, _p):
|
||||
return lambda f: f
|
||||
|
||||
|
||||
sys.modules.setdefault("folder_paths", types.SimpleNamespace(models_dir="", get_user_directory=lambda: ""))
|
||||
sys.modules.setdefault(
|
||||
|
||||
Reference in New Issue
Block a user