"Unable to import module 'app': No module named 'rpt_folder'"

18 views Asked by At
events/
   |--testget.json
rpt_folder/
   |--app.py
   |--service.py
   |--exception.py
   |--__init__.py
   |--tests/unit
          |--test_service.py

when I have the statement "import service" in app.py, I'm able to run the event tests by the following command. But the unittest throws No module named rpt_folder.

sam local invoke RptFolderFunction --event events/testget.json

when I have the statement "from rpt_folder import service" in app.py, I'm able to run the unittest by the following command. But the event test throws No module named rpt_folder.

pytest -svv tests/unit/test_service.py

What should I do in order to make both eventtest and unittest to work without changing the import module statement?

0

There are 0 answers