jupyter_server icon indicating copy to clipboard operation
jupyter_server copied to clipboard

ModuleNotFoundError: No module named 'jupyter_server.services.contents.tests'

Open andrewfulton9 opened this issue 4 years ago • 4 comments
trafficstars

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.

andrewfulton9 avatar Jan 22 '21 19:01 andrewfulton9

Quick feedbacks:

  1. 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
  2. The pypi publication does not contain the test folder https://pypi.org/project/jupyter-server/#files

echarles avatar Jan 23 '21 07:01 echarles

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?

Zsailer avatar Jan 25 '21 18:01 Zsailer

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.

andrewfulton9 avatar Jan 25 '21 19:01 andrewfulton9