Skip to content

solved test issues with k3d in test_field.py, test_mesh.py, test_region#543

Closed
AdamsMP92 wants to merge 2 commits into
masterfrom
clarify-test-failure
Closed

solved test issues with k3d in test_field.py, test_mesh.py, test_region#543
AdamsMP92 wants to merge 2 commits into
masterfrom
clarify-test-failure

Conversation

@AdamsMP92

Copy link
Copy Markdown
## Summary

This PR updates the `k3d`-related tests to avoid calling `k3d.Plot.display()` during pytest runs.

Instead of relying on the plotting methods to create and display a `k3d` plot internally, the tests now create an explicit `k3d.plot()` object and pass it via the `plot` argument.

## Motivation

With `k3d==2.17.0`, calling

```python
k3d.plot().display()

fails in a non-IPython pytest session with

NameError: name 'display' is not defined

because k3d.plot.plot_display calls display(...) without importing it from IPython.display.

The purpose of these tests is to exercise the discretisedfield k3d plotting code paths, not to test whether the interactive Jupyter display machinery is available in a terminal pytest environment.

Changes

  • Pass explicit k3d.plot() objects to k3d plotting calls in tests.
  • Avoid direct calls to plot.display() in tests.
  • Keep the existing k3d plotting paths covered for Field, Mesh, and subregion plotting.

Test result

The local test suite now passes:

3636 passed, 2 skipped, 5 xfailed in 40.11s

@AdamsMP92
AdamsMP92 requested review from lang-m and samjrholt June 5, 2026 15:20
@AdamsMP92 AdamsMP92 self-assigned this Jun 5, 2026
@github-actions

github-actions Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Failed to generate code suggestions for PR

@lang-m

lang-m commented Jun 8, 2026

Copy link
Copy Markdown
Member

The reason for the failure is a bug in k3d 2.17. #544 excludes that problematic version.

@lang-m lang-m closed this Jun 8, 2026
@lang-m
lang-m deleted the clarify-test-failure branch June 8, 2026 11:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants