-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: allow multiple uses of injector module in a single python process
- Loading branch information
1 parent
367955f
commit 305bcde
Showing
4 changed files
with
35 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ cls | |
composable | ||
configurationerror | ||
iterable | ||
lineno | ||
mypy | ||
pragma | ||
py | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
""" | ||
Tests for :class:`banshee.extra.injector.BansheeModule` | ||
""" | ||
|
||
import injector | ||
|
||
import banshee | ||
import banshee.extra.injector | ||
|
||
def test_it_should_build_bus_instance() -> None: | ||
""" | ||
it should build bus instance. | ||
""" | ||
registry = banshee.Registry() | ||
container = injector.Injector(banshee.extra.injector.BansheeModule(registry)) | ||
bus = container.get(banshee.Bus) # type: ignore | ||
|
||
assert isinstance(bus, banshee.Bus) | ||
|
||
|
||
def test_it_should_allow_multiple_uses() -> None: | ||
""" | ||
it should allow multiple uses. | ||
""" | ||
registry = banshee.Registry() | ||
container = injector.Injector(banshee.extra.injector.BansheeModule(registry)) | ||
bus1 = container.get(banshee.Bus) # type: ignore | ||
|
||
container = injector.Injector(banshee.extra.injector.BansheeModule(registry)) | ||
bus2 = container.get(banshee.Bus) # type: ignore | ||
|
||
assert bus1 is not bus2 |