Reputation: 115
Let's say that I have a package qaz
:
qaz/
__init__.py
qaz.py
tests/
test_qaz.py
setup.py
Now, I want to test some internal qaz.py
functions:
def _abc():
return 3
def def():
return _abc() + 2
but when I run pytest
with tests like this:
from qaz.qaz import *
def test_abc():
assert _abc() == 3
def test_def():
assert def() == 5
My question is how to test _abc()
?
Now I'm getting:
E NameError: name '_abc' is not defined
Upvotes: 1
Views: 506
Reputation: 115
Oh, figured it out. You need to be specific, when it comes to the internal functions:
from qaz.qaz import _abc
Upvotes: 1