Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(weave): Cleanup conftest #2580

Merged
merged 8 commits into from
Oct 3, 2024
Merged

chore(weave): Cleanup conftest #2580

merged 8 commits into from
Oct 3, 2024

Conversation

andrewtruong
Copy link
Collaborator

@andrewtruong andrewtruong commented Oct 2, 2024

Removes unnecessary tests, fixtures, etc. and consolidates conftest.

Notably:

  1. Consolidates trace_server_clickhouse_conftest.py and wandb_system_tests_conftest.py into just the one conftest.py file
  2. Deletes a few extraneous tests
  3. Removes the strict_op_saving contextvar and fixture (I believe this is not required anymore)
  4. Adds stricter linting (remove unused deps) for tests

@circle-job-mirror
Copy link

circle-job-mirror bot commented Oct 2, 2024

Comment on lines -1564 to -1580
# Note: this test only works with the `trace_init_client` fixture
@pytest.mark.skip(reason="TODO: Skipping since it seems to rely on the testcontainer")
def test_ref_get_no_client(trace_init_client):
trace_client = trace_init_client.client
data = weave.publish(42)
data_got = weave.ref(data.uri()).get()
assert data_got == 42

# clear the graph client effectively "de-initializing it"
with _no_graph_client():
# This patching is required just to make the test path work
with _patched_default_initializer(trace_client):
# Now we will try to get the data again
data_got = weave.ref(data.uri()).get()
assert data_got == 42


Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this still needed?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how long has this been skipped?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has only been skipped since the refactor, but it uses this trace_init_client that I don't see in other tests

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it can be rewritten with the normal client fixture

@andrewtruong andrewtruong marked this pull request as ready for review October 2, 2024 22:24
@andrewtruong andrewtruong requested a review from a team as a code owner October 2, 2024 22:24
@andrewtruong andrewtruong changed the title chore(weave): Cleanup fixtures chore(weave): Cleanup conftest Oct 3, 2024
Comment on lines -647 to -672
@pytest.mark.skip("too slow")
def test_trace_call_query_filter_wb_run_ids(client, user_by_api_key_in_env):
call_spec = simple_line_call_bootstrap(init_wandb=True)

res = get_all_calls_asserting_finished(client, call_spec)

wb_run_ids = list(set([call.wb_run_id for call in res.calls]) - set([None]))

for wb_run_ids, exp_count in [
# Test the None case
(None, call_spec.total_calls),
# Test the empty list case
([], call_spec.total_calls),
# Test List (of 1)
(wb_run_ids, call_spec.run_calls),
]:
inner_res = get_client_trace_server(client).calls_query(
tsi.CallsQueryReq(
project_id=get_client_project_id(client),
filter=tsi.CallsFilter(wb_run_ids=wb_run_ids),
)
)

assert len(inner_res.calls) == exp_count


Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need this?

Copy link
Member

@gtarpenning gtarpenning left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yo theres a lot of stuff moving around here, mind writing a more detailed description in the pr notes?

def pytest_sessionfinish(session, exitstatus):
if exitstatus == pytest.ExitCode.NO_TESTS_COLLECTED:
session.exitstatus = 0
def pytest_addoption(parser):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice, does this bring back the --weave-server=clickhouse in pytest.ini?

@@ -233,7 +513,7 @@ def create_client(request) -> weave_init.InitializedClient:


@pytest.fixture()
def client(request) -> Generator[weave_client.WeaveClient, None, None]:
def client(request):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why get rid of the typing?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's helpful in this context

Comment on lines -1564 to -1580
# Note: this test only works with the `trace_init_client` fixture
@pytest.mark.skip(reason="TODO: Skipping since it seems to rely on the testcontainer")
def test_ref_get_no_client(trace_init_client):
trace_client = trace_init_client.client
data = weave.publish(42)
data_got = weave.ref(data.uri()).get()
assert data_got == 42

# clear the graph client effectively "de-initializing it"
with _no_graph_client():
# This patching is required just to make the test path work
with _patched_default_initializer(trace_client):
# Now we will try to get the data again
data_got = weave.ref(data.uri()).get()
assert data_got == 42


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how long has this been skipped?

@@ -119,46 +118,6 @@ def op_with_unknown_param() -> int:
assert op_with_unknown_param() == 12


@pytest.mark.skip("artifact file download doesn't work here?")
def test_saveloop_idempotent_with_refs(user_by_api_key_in_env):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i feel like having these skipped tests aren't that bad, unless they are using old fixtures or otherwise dead code

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This uses the old weave.type() stuff which is no longer supported



@contextlib.contextmanager
def strict_op_saving(enabled: bool) -> typing.Generator[bool, None, None]:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is gone?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

afaik you don't need this anymore

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope

@@ -1,406 +0,0 @@
import contextlib
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we no longer need this? Any chance we add this back in?

@andrewtruong
Copy link
Collaborator Author

added some more notes

@andrewtruong andrewtruong merged commit 1690d3e into master Oct 3, 2024
81 checks passed
@andrewtruong andrewtruong deleted the andrew/fixtures branch October 3, 2024 19:15
@github-actions github-actions bot locked and limited conversation to collaborators Oct 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants