I have performed a ‘git pull’ today 27-08-2018 and for the fun off it I thought I would run ‘pytest tests’. However this fails with an import error for module ‘cv2’. I know on mac OS X 10.11.06 there is an issue with ‘opencsv’ see http://forums.fast.ai/t/issues-with-import-of-cv2-on-mac-os-x-10-11-6/12920/2
My version of ‘opencsv’ is 3.3.1 which imports without error from python at a terminal. However when I run ‘pytest tests’ I get this error.
ImportError while importing test module ‘/Users/mac/FASTAI/fastai/tests/test_core.py’.
Hint: make sure your test modules/packages have valid Python names.
E ModuleNotFoundError: No module named ‘cv2’
Note there should be 2 underscores either side of the init in tests/init.py but get lost in the posting of this message.
repeated for other test modules
However the code in init.py seems to be a fix for ubuntu 16.04. Also ‘cv2’ is only used in 2 modules
- test_lsuv_initializer.py:import cv2 :: which imports it again
- test_transform.py :: which relies on the ‘__ init __.py’ import from 'test_core.py
I have raised an issue on github and then noted issue about testfixtures which I added to my cpu environment which did not remove the error.
Also I think it is an issue not just for cv2 but for other modules as well. It may be in my use of pytest. However I am following instructions on the github page.
I have solved this issue by:
- running command
pytest testsfrom a terminal in the
- delete / rename
PYTHONPATH=../fastaito allow the tests to find
- added the equivalent of
- 69 tests passed a one was skipped
- I was able to reinstate the
__init__.pyfile and the tests passed, one skipped