Skip to content

Commit 6d603ae

Browse files
committed
test: preserve incoming graph sentinel state
Signed-off-by: Deepak Jain <[email protected]>
1 parent f176df0 commit 6d603ae

1 file changed

Lines changed: 7 additions & 10 deletions

File tree

‎tests/unit/test_graph_proxy.py‎

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,12 @@ def test_graph_import_state_restores_preexisting_invoke_attribute(
8383
) -> None:
8484
"""rng1995 #436: isolation must not delete a pre-existing ``invoke`` attribute."""
8585
sentinel = object()
86-
lazy_graph.__dict__["invoke"] = sentinel
86+
monkeypatch.setitem(lazy_graph.__dict__, "invoke", sentinel)
87+
fixture_gen = _graph_import_state.__wrapped__(monkeypatch)
88+
next(fixture_gen)
8789
try:
88-
fixture_gen = _graph_import_state.__wrapped__(monkeypatch)
89-
next(fixture_gen)
90-
try:
91-
assert "invoke" not in lazy_graph.__dict__
92-
finally:
93-
with pytest.raises(StopIteration):
94-
next(fixture_gen)
95-
assert lazy_graph.__dict__["invoke"] is sentinel
90+
assert "invoke" not in lazy_graph.__dict__
9691
finally:
97-
lazy_graph.__dict__.pop("invoke", None)
92+
with pytest.raises(StopIteration):
93+
next(fixture_gen)
94+
assert lazy_graph.__dict__["invoke"] is sentinel

0 commit comments

Comments
 (0)