Skip to content

Commit

Permalink
Fix warning handling with pytest 8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
guarin committed Jan 30, 2024
1 parent 6bd7553 commit 40b8eb2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tests/cli/test_cli_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import pytest
import torchvision
from hydra.experimental import compose, initialize
import warnings

import lightly
from tests.api_workflow.mocked_api_workflow_client import (
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

0 comments on commit 40b8eb2

Please sign in to comment.