Skip to content

Commit 97cd13b

Browse files
committed
Avoid side-effects in test
1 parent f7c74ea commit 97cd13b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

pandas/tests/copy_view/test_copy_deprecation.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,5 +94,7 @@ def test_copy_deprecation_merge_concat():
9494
@pytest.mark.parametrize("value", [False, True, "warn"])
9595
def test_copy_on_write_deprecation_option(value):
9696
msg = "Copy-on-Write can no longer be disabled"
97-
with tm.assert_produces_warning(Pandas4Warning, match=msg):
98-
pd.set_option("mode.copy_on_write", value)
97+
# stacklevel points to contextlib due to use of context manager.
98+
with tm.assert_produces_warning(Pandas4Warning, match=msg, check_stacklevel=False):
99+
with pd.option_context("mode.copy_on_write", value):
100+
pass

0 commit comments

Comments
 (0)