Skip to content

Commit 7bd9279

Browse files
authored
fix compatibility for pytest 8 (#20575)
Co-authored-by: Haifeng Jin <haifeng-jin@users.noreply.github.com>
1 parent b313cd9 commit 7bd9279

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tests/tests_fabric/utilities/test_seed.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import os
22
import random
3+
import warnings
34
from unittest import mock
45
from unittest.mock import Mock
56

@@ -30,9 +31,9 @@ def test_seed_stays_same_with_multiple_seed_everything_calls():
3031
seed_everything()
3132
initial_seed = os.environ.get("PL_GLOBAL_SEED")
3233

33-
with pytest.warns(None) as record:
34+
with warnings.catch_warnings():
35+
warnings.simplefilter("error")
3436
seed_everything()
35-
assert not record # does not warn
3637
seed = os.environ.get("PL_GLOBAL_SEED")
3738

3839
assert initial_seed == seed

0 commit comments

Comments
 (0)