Skip to content

Commit

Permalink
🐛 Keep a reference to app in client
Browse files Browse the repository at this point in the history
  • Loading branch information
perdy committed Sep 20, 2023
1 parent 880e6b2 commit 3e12f31
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions flama/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ def __init__(
self.models = {m[0]: m[1] for m in models or {}}

self.lifespan = LifespanContextManager(app) if app else None
self.app = app

kwargs["app"] = app
kwargs.setdefault("base_url", "http://localapp")
Expand Down
1 change: 1 addition & 0 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ def test_init_models(self, app):
):
client = _BaseClient(models=[("foo", "/foo/", "model_foo.flm"), ("bar", "/bar/", "model_bar.flm")])

assert client.app == app
assert client.lifespan
assert client.lifespan.app == app
assert client.models == {"foo": "/foo/", "bar": "/bar/"}
Expand Down

0 comments on commit 3e12f31

Please sign in to comment.