I currently have some tests that are structured like this:
tests/
category_a/
sub_category_1/
test_file_a11.py
test_file_a12.py
sub_category_2/
test_file_a21.py
test_file_a22.py
sub_category_3/
test_file_a31.py
test_file_a32.py
category_b/
sub_category_4/
test_file_b41.py
test_file_b42.py
sub_category_5/
test_file_b51.py
test_file_b52.py
sub_category_6/
test_file_b61.py
test_file_b62.py
Which works really well for what we need. In reality this breakdown makes more sense, and there are many more categories/files. This can also apply just to our non-test structure.
The problem is that I want to have multiple levels of shared code. Some code that should be shared between ALL tests, some just between tests in category_a, and some specific to sub categories. I can just add a common.py at each level, but then I end up with test_file_a32 using 3 different common files. It works, but I find it pretty confusing to read.
Is there a better way to do this?