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

Fix tests with nbconvert 6 #5086

Closed
takluyver opened this issue Nov 27, 2019 · 0 comments · Fixed by #5111
Closed

Fix tests with nbconvert 6 #5086

takluyver opened this issue Nov 27, 2019 · 0 comments · Fixed by #5111

Comments

@takluyver
Copy link
Member

With nbconvert 6, notebook's tests fail, as in the traceback below. #5085 pinned nbconvert <6 so it's not holding up other work, but unpinning in a PR should reproduce it (unless changes in nbconvert fix it).

I believe that this is caused by notebook's tests monkeypatching various paths to make the tests independent of the user's real environment:

cls.path_patch = patch.multiple(
jupyter_core.paths,
SYSTEM_JUPYTER_PATH=[tmp('share', 'jupyter')],
ENV_JUPYTER_PATH=[tmp('env', 'share', 'jupyter')],
SYSTEM_CONFIG_PATH=[tmp('etc', 'jupyter')],
ENV_CONFIG_PATH=[tmp('env', 'etc', 'jupyter')],
)

Nbconvert 6 uses jupyter path() to find its templates, so these patches mean they can no longer be found. We either need to special case them, or relax the isolation a bit.


NotebookApp: ERROR: nbconvert failed: No template sub-directory with name 'classic' found in the following paths:
	/tmp/tmp6wqtbpho/data
	/tmp/tmp6wqtbpho/env/share/jupyter
	/tmp/tmp6wqtbpho/share/jupyter
Traceback (most recent call last):
  File "/home/travis/build/jupyter/notebook/notebook/nbconvert/handlers.py", line 132, in get
    resources=resource_dict
  File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/nbconvert/exporters/html.py", line 99, in from_notebook_node
    self.register_filter('highlight_code', highlight_code)
  File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/nbconvert/exporters/templateexporter.py", line 418, in register_filter
    return self._register_filter(self.environment, name, jinja_filter)
  File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/nbconvert/exporters/templateexporter.py", line 154, in environment
    self._environment_cached = self._create_environment()
  File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/nbconvert/exporters/templateexporter.py", line 436, in _create_environment
    paths = self.get_template_paths()
  File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/nbconvert/exporters/templateexporter.py", line 465, in get_template_paths
    template_names = self.get_template_names()
  File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/nbconvert/exporters/templateexporter.py", line 512, in get_template_names
    raise ValueError('No template sub-directory with name %r found in the following paths:\n\t%s' % (template_name, paths))
ValueError: No template sub-directory with name 'classic' found in the following paths:
	/tmp/tmp6wqtbpho/data
	/tmp/tmp6wqtbpho/env/share/jupyter
	/tmp/tmp6wqtbpho/share/jupyter
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
1 participant