here is my code
mod.py
from undefined_package import display
def main():
display()
test_mod.py
from unittest.mock import patch
import unittest
patcher = patch('mod.main')
with patch('mod.main') as MockClass:
from mod import main
main()
if __name__ == '__main__':
unittest.main()
then running test, encountering import error.
thing = __import__(import_path)
File “/home/user/mod.py”, line 1, in
from undefined_package import display
ModuleNotFoundError: No module named ‘undefined_package’
unittest stops when there is a strange package.
I don’t agree with this.