Managing directories properly

In lpthw I learned to structure my directories like this:

But in practice, and especially when using pytest, I get problems with the programs I am running, because they are trying to find and import files, but are not able to.

example:

For exercise 18 in lmpthw, I am trying to do the performance tests, and I have to swap around directories and files to some weird places to get everything running (see below). This is bound to get out of hand when there are more directories involved

Schermafbeelding 2021-06-14 165348

*the directory of the program has to be in the test directory for it to run. Because if type this command:

python -m cProfile -s cumtime sorting_test.py | Select-String sorting.py

While I am in the project file, it does not work. So then I put everything in the test file, and run it from there. Which is horrably inefficient.

I would like to start organising the directories in such a way that I will spend less time on swapping around files between directories.

Any advice would be greatly appreciated

A free service run by Zed A. Shaw for learncodethehardway.org.