0

I tried this,

pip install memoize
Requirement already satisfied: memoize

But every time i run pytest, I get the above error ModuleNotFoundError: No module named 'memoize' and it fails to load the conftest.py file even though it is in my tests folder and it also contains an __init__.py file.

any suggestions what else could be wrong/missing?

aL_eX
  • 1,397
  • 1
  • 13
  • 26
julian joseph
  • 151
  • 2
  • 15

1 Answers1

2

The python path could be the issue

python -m pytest projectroot/

To fix this you could also set the path using

import sys, os
myPath = os.path.dirname(os.path.abspath(__file__)) 
sys.path.insert(0, myPath + '/../')

By @Not_a_golfer

Naresh Kumar
  • 1,361
  • 9
  • 22
  • The above command helped pytest work. but linter raises this `Unable to import 'memoize' (import-error)` any idea how to avoid this. I tried uninstalling the global version, and installing `memoize` again. didn't help – julian joseph Dec 29 '17 at 04:45
  • Could you provide your project tree structure? You can also check the following doc [PYTHONPATH](https://docs.python.org/3/using/cmdline.html#envvar-PYTHONPATH) . To check your current path [Finding-current-path-used](https://stackoverflow.com/questions/1489599/how-do-i-find-out-my-python-path-using-python) – Naresh Kumar Dec 29 '17 at 07:03