diff options
| author | blasty <peter@haxx.in> | 2026-08-21 12:12:53 +0200 |
|---|---|---|
| committer | blasty <peter@haxx.in> | 2026-08-21 12:12:53 +0200 |
| commit | ea22067c52ec335ea4d3a616cb2107d5fdbdf7b6 (patch) | |
| tree | df7afae5ed521d61ee75e49270c144325d9bf5fe /tests/test_scenarios.py | |
| parent | Merge PR #1 from mrexodia: Windows support and auto-refresh on events (diff) | |
| download | ida-tui-ea22067c52ec335ea4d3a616cb2107d5fdbdf7b6.tar.gz ida-tui-ea22067c52ec335ea4d3a616cb2107d5fdbdf7b6.tar.xz ida-tui-ea22067c52ec335ea4d3a616cb2107d5fdbdf7b6.zip | |
tests: repair the two seams the ida-nexus port left behind
Two scenario monkeypatch sites still hooked client.invoke -- the rename to
call() updated the call sites but not the patches, so reprime_is_free and
split_view crashed instead of counting. call() takes the remote_ops
declaration itself now, so both count by its __name__.
remote_ops imported RemoteModule inside _bindings(), which made
test_nexus_client (NEEDS_IDA = False) unrunnable under a stdlib-only
python3 -- the house rule tests/run.py --fast depends on. The import moves
to the same eagerly-if-present, bound-to-None-so-patchable contract
nexus_client uses, and the test injects FakeRemoteModule/FakeRemoteError
exactly like its other fakes: real names when the library is installed,
strict fakes when it is not.
Diffstat (limited to 'tests/test_scenarios.py')
| -rw-r--r-- | tests/test_scenarios.py | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/tests/test_scenarios.py b/tests/test_scenarios.py index 190777c..30d6087 100644 --- a/tests/test_scenarios.py +++ b/tests/test_scenarios.py @@ -585,14 +585,15 @@ async def s_reprime_is_free(c: Ctx): await c.wait(lambda: lv.model.complete, 30) client = app.program.client - original = type(client).invoke + original = type(client).call seen: list[str] = [] def counting(self, operation, *a, **kw): - seen.append(operation) + # call() takes the remote_ops declaration itself; count by its name. + seen.append(getattr(operation, "__name__", str(operation))) return original(self, operation, *a, **kw) - type(client).invoke = counting + type(client).call = counting try: for _ in range(3): # decomp and back, three times await c.press("tab") @@ -600,7 +601,7 @@ async def s_reprime_is_free(c: Ctx): await c.press("tab") await c.pause(0.05) finally: - type(client).invoke = original + type(client).call = original rebuilds = seen.count("segment_index") c.check( @@ -1321,18 +1322,19 @@ async def s_split_view(c: Ctx): # to count. The bound is loose because the bug was three orders of magnitude # out, not a near miss. _lookups = {"n": 0} - _orig_call = c.prog.client.invoke + _orig_call = c.prog.client.call - def _counting(name, *a, **kw): - if name == "lookup_funcs": + def _counting(operation, *a, **kw): + # call() takes the remote_ops declaration itself; match by its name. + if getattr(operation, "__name__", "") == "lookup_funcs": _lookups["n"] += 1 - return _orig_call(name, *a, **kw) + return _orig_call(operation, *a, **kw) - c.prog.client.invoke = _counting + c.prog.client.call = _counting try: await _split_view_body(c, app, lst, dec) finally: - c.prog.client.invoke = _orig_call + c.prog.client.call = _orig_call c.check( "split view doesn't storm the worker with function lookups", _lookups["n"] < 500, |
