import issues
James Hartley <[email protected]> Tue, 9 Jan 2024 12:06:22 -0600
| Newsgroups | gmane.comp.python.tutor |
|---|---|
| Message-ID | <CAKeNXXvJzGgr4zqg-NW09zjExdPU+ESFwyLsnfDd0NJMjznq0Q@mail.gmail.com> |
I admit that I have not internalized how Python's import system works yet.
Given the following directory structure:
+-project
|
+-src
| |
| +-__init__.py
| +-foo.py
|
+-tests
|
+-test_foo.py
Currently, __init__.py is empty. What needs to be placed in __init__.py
and test_foo.py in order for pytest to execute all tests in test_foo.py?
pytest is being executed while in the project directory. With:
from foo import Foo
--or--
from src.foo import Foo
defined in test_foo.py, pytest reports "ModuleNotFoundError: No module
named 'src'".
Any and all comments would be appreciated. Any links to online sources
would also be appreciated. Thanks!
j
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor