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

Fix unittest warning handling with pytest 8.0 #1489

Merged
merged 2 commits into from
Jan 30, 2024
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
3 changes: 2 additions & 1 deletion tests/cli/test_cli_download.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import sys
import tempfile
import warnings

import pytest
import torchvision
Expand Down Expand Up @@ -114,7 +115,7 @@ def test_download_from_tag_with_integer_name(self):
f"lightly-download token='123' dataset_id='{_DATASET_ID}' tag_name=1000"
)
self.parse_cli_string(cli_string)
with pytest.warns(None) as record:
with warnings.catch_warnings(record=True) as record:
lightly.cli.download_cli(self.cfg)
# check if the warning "Tag with name 1000 does not exist" is raised
# if so, the cli string was not parsed correctly
Expand Down
Loading