jupyter_server
jupyter_server copied to clipboard
ModuleNotFoundError: No module named 'jupyter_server.services.contents.tests'
I am trying to reuse the jupyter_server ContentsManager tests for a custom ContentsManager I am working on. I am trying to import them according to the documentation here.
I am importing with:
import jupyter_server.services.contents.tests
However when I run this I get:
ModuleNotFoundError: No module named 'jupyter_server.services.contents.tests'
my environment: os: ubuntu 18.04 package_manager: conda channel: conda-forge python: 3.9.1 jupyterlab: 3.0.5 jupyter_server: 1.2.2
I think the documentation was probably just updated switching out notebook for jupyter_server when the ContentsManager class was moved, but the tests were restructured so that they are no longer accessible from that location. I assume either the tests should be added back to the importable package, or the docs just need to be updated to reflect the changes.
Quick feedbacks:
- The tests have moved to the tests folder https://github.com/jupyter-server/jupyter_server/tree/master/tests so the doc is not correct IMHO
- The pypi publication does not contain the test folder https://pypi.org/project/jupyter-server/#files
Yes, these docs are (currently) out of date. The tests module was moved outside the package in #152.
However, it might be worth discussing whether the tests module should be added back into the package. Your use-case is pretty compelling—a custom contents manager where you want to reuse jupyter_server's unit tests?
Thoughts?
I've just copied the tests over to a local file and have just started modifying them to test my custom ContentsManager, so i'm not sure yet how many of them I will be able to use "out of the box". I think they will at least be useful for understanding the scope that my ContentsManager should cover and building my own tests to cover that scope. Whether that warrants making the tests importable again, I'm not sure. It may be enough to just update the docs to point a link to the current tests for people to use as a baseline for writing their own.