-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
split: test_weave_api into trace and legacy components
- Loading branch information
1 parent
d94e7b3
commit 8584e99
Showing
2 changed files
with
25 additions
and
27 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
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,24 @@ | ||
import weave | ||
import weave.trace.weave_init | ||
|
||
|
||
def test_weave_finish_unsets_client(client): | ||
@weave.op | ||
def foo(): | ||
return 1 | ||
|
||
weave.trace.client_context.weave_client.set_weave_client_global(None) | ||
weave.trace.weave_init._current_inited_client = ( | ||
weave.trace.weave_init.InitializedClient(client) | ||
) | ||
weave_client = weave.trace.weave_init._current_inited_client.client | ||
assert weave.trace.weave_init._current_inited_client is not None | ||
|
||
foo() | ||
assert len(list(weave_client.calls())) == 1 | ||
|
||
weave.finish() | ||
|
||
foo() | ||
assert len(list(weave_client.calls())) == 1 | ||
assert weave.trace.weave_init._current_inited_client is None |