Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add image test using nbval and nbdime #32

Merged
merged 5 commits into from
Jun 5, 2024

Conversation

ianthomas23
Copy link
Contributor

This PR adds tests to the project to confirm that the inline backend is used even if not specified using the %matplotlib magic and that images are correctly produced. It uses a single notebook for this, and nbval and nbdime to do the actual testing so the additions here are minimal. Essentially nbval runs the notebook and checks that the output cells are the same as those contained within the test notebook but ignores images. nbdime adds image comparison. Text is excluded from the plots, as usually occurs in Matplotlib tests, as text rendering can vary slightly on different platforms.

The original test to confirm the import works are now in a new file test_import.py.

I have also changed the installation of dependencies to just use PyPI rather than mamba as this should be simpler and faster, but I can switch this back if preferred.

@ianthomas23 ianthomas23 force-pushed the add_test branch 3 times, most recently from 3b5cb7d to 73422c2 Compare March 11, 2024 10:22
@martinRenou
Copy link
Collaborator

I rebased your PR and fixed conflicts. It seems the tests have been running for 25 minutes so far, they are probably stuck.

@ianthomas23
Copy link
Contributor Author

The problem here was jupyter/nbdime#749 caused by the change in jupyter_server to enable authentication by default which isn't currently supported in nbdime. The workaround here is to pin, in the tests only, to jupyter_server < 2.12.6.

Overall I think it is a good idea to have at least one image comparison test to confirm that images are produced, but I am not sure if this is the best approach or if it would be better to use the galata testing framework in line with the rest of the Jupyter projects. Maybe this is good enough for now and we see how stable this is and reconsider this versus galata in a few months time.

Copy link
Collaborator

@martinRenou martinRenou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@martinRenou martinRenou merged commit 90034cf into ipython:main Jun 5, 2024
4 checks passed
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