Skip to content
This repository has been archived by the owner on Nov 1, 2024. It is now read-only.

Folder structure #1

Open
bhardin opened this issue Dec 21, 2017 · 4 comments
Open

Folder structure #1

bhardin opened this issue Dec 21, 2017 · 4 comments

Comments

@bhardin
Copy link
Contributor

bhardin commented Dec 21, 2017

Discussion on best practice of Folder structure.

@wagnerluis1982
Copy link

I wonder why the subfolder unit. Would be because it should have integration, fixtures, and so on?

@bhardin
Copy link
Contributor Author

bhardin commented Dec 28, 2017

Excellent question. I'm a huge fan of having a single test structure that mimics the root folder. But, we ran into two problems with supporting it.

  1. We wrote our guide to support a legacy code base where tests had no folder structure. The code mixed both styles suggested by pytest. In addition, the /tests folder had a mixture of folder names selected by previous developers. There was no clean and clear way to divide the folder. It became problematic to support a single test directory which mimics the root.

  2. The folders already inside the tests folder had utility. There were factories, fixtures, integration, and browser tests. Developers not used to writing unit tests don't understand what defines a unit test and thus write integration tests when they want to write unit tests. Having a nested structure under the /tests folder allowed us to keep the code that served utility and have "non-unit" writing developers continue contributing to the code base.

@jxodwyer
Copy link
Contributor

jxodwyer commented Jan 11, 2018

What are everyones thoughts on colocating unit tests with our app structure?

For ex:

app/foo/__tests__/test_model.py
app/foo/model.py

This way tests are more in our face and we don't have to go through process of recreating our entire app dir structure under a high level dir of tests.

@bhardin
Copy link
Contributor Author

bhardin commented Jan 11, 2018

We had this structure before, but it created issues:

  1. There was a mixture of tests in the tests/ directory and in the app directory which made things challenging due to no standard.

  2. When apps become tightly coupled (not great, but it is what it is) you begin requiring things in other apps which creates more coupling of tests to folder structure.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants