Skip to content

Ignore deprecation warning from traverse function #6641

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

Merged
merged 5 commits into from
Sep 27, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions test/test_prototype_datasets_builtin.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@


def extract_datapipes(dp):
return get_all_graph_pipes(traverse(dp, only_datapipe=True))
return get_all_graph_pipes(traverse(dp))


@pytest.fixture(autouse=True)
Expand All @@ -42,6 +42,12 @@ def test_coverage():
)


# FIXME: This decorator only applies to `test_data_loader`, but we can't put it there because the class-wide fail on
# warnings would take higher priority.
# Although we are not using `traverse(..., only_datapipe=...)` in `test_data_loader` directly, the `DataLoader` does.
# This will emit the warning, which in turn will fail the test if we don't ignore it. There is a push to fix this in
# https://github.com/pytorch/pytorch/pull/85667.
@pytest.mark.filterwarnings("ignore:`only_datapipe` is deprecated:FutureWarning")
@pytest.mark.filterwarnings("error")
class TestCommon:
@pytest.mark.parametrize("name", datasets.list_datasets())
Expand Down Expand Up @@ -101,12 +107,11 @@ def test_transformable(self, dataset_mock, config):

next(iter(dataset.map(transforms.Identity())))

@pytest.mark.parametrize("only_datapipe", [False, True])
@parametrize_dataset_mocks(DATASET_MOCKS)
def test_traversable(self, dataset_mock, config, only_datapipe):
def test_traversable(self, dataset_mock, config):
dataset, _ = dataset_mock.load(config)

traverse(dataset, only_datapipe=only_datapipe)
traverse(dataset)

@parametrize_dataset_mocks(DATASET_MOCKS)
def test_serializable(self, dataset_mock, config):
Expand Down