Skip to content

Commit c84d110

Browse files
test: xfail source inspecting test for cache_across_reloads
1 parent 0cef772 commit c84d110

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

tests/py/test_hmr.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,3 +294,23 @@ def test_cache_across_reloads_with_class():
294294
Path("main.py").write_text("from reactivity.hmr import cache_across_reloads\n\n@cache_across_reloads\ndef f():\n class _:\n print(a)\n\nf()\n")
295295
load(ReactiveModule(Path("main.py"), {"a": 1}, "main"))
296296
assert stdout.delta == "1\n"
297+
298+
299+
@pytest.mark.xfail(strict=True)
300+
def test_cache_across_reloads_source():
301+
with environment():
302+
Path("main.py").write_text(
303+
dedent(
304+
"""
305+
306+
from inspect import getsource
307+
from reactivity.hmr.utils import cache_across_reloads
308+
309+
def f(): pass
310+
311+
assert getsource(f) == getsource(cache_across_reloads(f))
312+
313+
"""
314+
)
315+
)
316+
load(ReactiveModule(Path("main.py"), {}, "main"))

0 commit comments

Comments
 (0)