I was trying to implement something that I saw in a tutorial on Real Python. In the tutorial there a testing module (or do you call that a test file?) is in a directory test/
and the code is in a directory rptodo/
, and the test file imports the object to be tested with from rptodo import __app_name__, __version__, cli
. This does not run by itself; an error ModuleNotFoundError: No module named 'rptodo'
occurs. But this does allow pytest to run the code. I then tried redoing this with my own example code and I get the same error even in pytest. What did I do wrong in creating the module?
My folder structure:
Anywhere
-here
--test_this.py
-there
--__init__.py
--yonder.py
yonder.py
class That:
thing = 'something'
test_this.py
from there.yonder import That
def test_this():
this = That()
print(this.thing)
test_this()