Skip to content

Commit

Permalink
Working
Browse files Browse the repository at this point in the history
  • Loading branch information
euri10 committed Jun 22, 2023
1 parent 5f8ad75 commit 9434736
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion mock_dependency_litestar/main.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
from litestar import Litestar, get
from litestar.di import Provide

from mock_dependency_litestar.dependencies import some_dependency


@get()
def handler(dep: str) -> str:
return dep


def create_app() -> Litestar:
from mock_dependency_litestar.dependencies import some_dependency
return Litestar([handler], dependencies={"dep": Provide(some_dependency)})
3 changes: 2 additions & 1 deletion tests/test_deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ def new_dependency():

@pytest.fixture(autouse=True)
def mock_db():
return mock.patch("dependencies.some_dependency", new=new_dependency)
with mock.patch("mock_dependency_litestar.dependencies.some_dependency", new=new_dependency):
yield


@pytest.fixture
Expand Down

0 comments on commit 9434736

Please sign in to comment.