[TIP] PyTest test directory structure confusion

Tony Cappellini cappy2112 at gmail.com
Tue Aug 27 21:45:27 PDT 2019


Hi,

I’m new to using PyTest. I’ve got a very simple python file, and a very
simple test file for it.

I’ve been having a problem getting a unittest to be able to access the file
it’s trying to test. I’m sure that I don’t have the correct directory
configuration, but at the same time, I’m not sure what the correct
directory configuration should be though.

Page 25 of “Python Testing with PyTest refers to __init__.py files in the
same directory as the test files themselves.

Under Project Structure, This website
https://automationpanda.com/2017/03/14/python-testing-101-pytest/

states that __init__.py files should NOT be in the same directory as the
test files.

__init__.py files have always been the biggest headache for me, as I’ve
never been able to find a clear reference as to what should  or shouldn’t
be in those files.
Why is it that some are empty, while others have tons of imports?


I would appreciate if someone could provide a reference as to how a PyTest
project should be structured, where __init__ files should and shouldn’t be,
along with their contents (if any).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20190827/85d796ea/attachment-0001.htm>


More information about the testing-in-python mailing list