Skip to content

Add tests for Error_display, do_execute_meta, get_magic_args, display, and process_metakernel classes#327

Merged
blink1073 merged 2 commits intoCalysto:mainfrom
blink1073:more-coverage
Feb 28, 2026
Merged

Add tests for Error_display, do_execute_meta, get_magic_args, display, and process_metakernel classes#327
blink1073 merged 2 commits intoCalysto:mainfrom
blink1073:more-coverage

Conversation

@blink1073
Copy link
Contributor

Summary

  • test_metakernel.py: direct unit tests for Error_display (string, non-string, mixed args, redirect_to_log), do_execute_meta (both EvalKernel and base MetaKernel), and get_magic_args (no magic, line magic, no-args magic, unknown magic)
  • test_display.py: new module testing display.display() and display.clear_output() with and without an active MetaKernel instance, verifying correct delegation to either kernel.Display/kernel.clear_output or the IPython fallbacks
  • test_process_metakernel_classes.py: new module covering all classes in process_metakernel.pyTextOutput, ProcessMetaKernel (banner, language_version, do_execute_direct all code paths, check_exitcode, makeWrapper, do_shutdown, restart_kernel), BashKernel (banner content and instance-level caching), and DynamicKernel (attribute initialisation and makeWrapper argument forwarding)

Test plan

  • All new tests pass locally (just test)
  • Linting passes (ruff format / ruff check)
  • Pre-commit hooks pass

….py, and process_metakernel classes

- test_metakernel.py: direct unit tests for Error_display (string,
  non-string, mixed, redirect_to_log), do_execute_meta (EvalKernel and
  base MetaKernel), and get_magic_args (no magic, line magic, no-args
  magic, unknown magic)
- test_display.py: tests for display() and clear_output() both with and
  without an active MetaKernel instance
- test_process_metakernel_classes.py: tests for all classes in
  process_metakernel.py — TextOutput, ProcessMetaKernel (banner,
  language_version, do_execute_direct, check_exitcode, makeWrapper,
  do_shutdown, restart_kernel), BashKernel (banner fetching and
  caching), and DynamicKernel (attributes and makeWrapper)
@blink1073 blink1073 enabled auto-merge (squash) February 28, 2026 01:14
@codecov-commenter
Copy link

codecov-commenter commented Feb 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.80%. Comparing base (b148549) to head (31358c8).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #327      +/-   ##
==========================================
+ Coverage   74.94%   77.80%   +2.86%     
==========================================
  Files          51       51              
  Lines        2794     2794              
  Branches      388      388              
==========================================
+ Hits         2094     2174      +80     
+ Misses        560      484      -76     
+ Partials      140      136       -4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

- tests/utils.py: make get_kernel() generic via @overload so callers
  typed with a subclass get the subclass type back, resolving
  attr-defined errors for ProcessMetaKernel-specific attributes
- test_process_metakernel_classes.py: add cast(MagicMock, ...) for
  mock method access on typed REPLWrapper attributes; remove stale
  type: ignore comments; guard wrapper access with assert is not None
- test_metakernel.py: add Any import, parametrize list annotations,
  annotate get_magic_args result as Any to allow tuple unpack
- test_display.py: use type: ignore[method-assign] on mock assignments
  (setattr is disallowed by ruff B010 when the attribute name is a
  constant literal)
@blink1073 blink1073 merged commit 19cc658 into Calysto:main Feb 28, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants