Skip to content

Commit

Permalink
test: test more component situations for memory leaks (none found)
Browse files Browse the repository at this point in the history
  • Loading branch information
maartenbreddels committed Feb 15, 2024
1 parent 5ce06af commit d214dfa
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions reacton/core_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3122,10 +3122,18 @@ def remove():
rc.close()


def test_memory_leak(ButtonComponent):
@reacton.component
def UseMemoComponent():
rc = core.get_render_context()
reacton.use_memo(lambda: [rc], [])
return w.Button()


@pytest.mark.parametrize("component", [w.Button, ButtonComponentFunction, UseMemoComponent])
def test_memory_leak(component):
# we make sure that there is not reference to the context
# after we close it
box, rc = react.render(ButtonComponent(), handle_error=False)
box, rc = react.render(component(), handle_error=False)
rc.close()
# useful for debugging
# import objgraph
Expand Down

0 comments on commit d214dfa

Please sign in to comment.