I’ve been finding the issues that others are reporting with
pytest and running Jupyter Notebook.
I thought I’d put together the solution for the issues in a single place, to make other’s lives easier.
In all cases it’s assumed that you’ve installed python, some kind of virtual environment, and the requisites using
pip install -r requirements.txt. The instructions are valid as of 2019-01-19; later versions of the tools might sort this out.
Symptoms: When trying to run
pytest even in a simple case (such as
pytest -m connection) there are lots of errors that don’t seem related to the “test” at hand.
From this thread:
SOLUTION: is uninstalling pytest, and installing pytest 3.3.2:
pip uninstall pytest pip install pytest==3.3.2
Also, note that in the
pytest uses the connection data in the [TEST] section, so it’s perfectly possible that the “real” app test are passing via /status, and pytest is failing.
And, if you add comments to the file, they should be on its own line - a line like this Will fail (guess how I know! )
[TEST] MFLIX_DB_URI = mongodb+srv://m220student:m220password@<URL>/test ##This is a comment
Errors with junyper notebook
Symptoms: When trying to launch
jupyter notebook, the webpage opens, but the notebook won’t “run” – and in the command prompt you get a lot of messages about “Kernel Restaring”, ending in:
ModuleNotFoundError: No module named 'prompt_toolkit.formatted_text
The reason: The issue is that the module
prompt-toolkit version 1.0.15 is installed as a dependency of
jupyter-console (v 5.2.0, which is the latest), and requires
prompt-toolkit < 2.0.0. But
ipython (and also
ipykernel which depends on it) which is used by jupyter has a dependency of
ipython (whatever version got installed, in my case 7.2.0) and reinstall
ipython == 6.5.0:
pip uninstall ipython pip install ipython == 6.5.0
So far, everything appears to be working and no other errors have cropped out.
As mentioned above, it’s possible (likely?) that later version of these tools will sort this dependency issues and will remove this errors (or cause new ones!)