Reputation: 756
I cannot install the module moto
in my Python 3.10.13
environment, even though, it says it's installed. I followed the instructions according to [Github][1]
, which is to install moto[ec2,s3,all]
, but to no avail.
(venv) user cloudwatch-IPaddress-lambda % python --version
pip --version
Python 3.10.13
pip 23.2.1 from /Users/ari/Documents/cloudwatch-IPaddress-lambda/venv/lib/python3.10/site-packages/pip (python 3.10)
(venv) user cloudwatch-IPaddress-lambda % pip list | grep moto
moto 4.2.12
[notice] A new release of pip is available: 23.2.1 -> 23.3.2
[notice] To update, run: pip install --upgrade pip
(venv) user cloudwatch-IPaddress-lambda % pytest tests/test_add_ip_to_dynamodb.py
================= test session starts ==================
platform darwin -- Python 3.10.13, pytest-7.4.2, pluggy-1.3.0
rootdir: /Users/ari/Documents/cloudwatch-IPaddress-lambda
plugins: django-4.5.2, anyio-3.6.2
collected 0 items / 1 error
======================== ERRORS ========================
__ ERROR collecting tests/test_add_ip_to_dynamodb.py ___
ImportError while importing test module '/Users/user/Documents/cloudwatch-IPaddress-lambda/tests/test_add_ip_to_dynamodb.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/opt/homebrew/Cellar/[email protected]/3.10.13/Frameworks/Python.framework/Versions/3.10/lib/python3.10/importlib/__init__.py:126: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
tests/test_add_ip_to_dynamodb.py:5: in <module>
from moto import mock_dynamodb2
E ModuleNotFoundError: No module named 'moto'
Anyone else have the same issue ?
Upvotes: -1
Views: 2012
Reputation: 756
Turns out the error logged in inaccurate.
There's a module moto
, as per my console.
However, there's no mock_dynamodb2
. Admittedly, I used ChatGPT
to generate this test, and it used a deprecated handler. It should be mock_dynamodb
Upvotes: 0