A strange migration tip;
Have an existing sizeable python repo with embedded /test/folders - hundreds of tests (makes sense, tests are local to the code) - large++ code base
-
some test folders have modules, (helpers, utils) but are missing init.py files
-
goal: locate all directories under test folders, that don't have init.py files, but do have *.py files,
this is not fool-proof but it did locate the > 30 folders I had to investigate ; to remove the "pants can't infer" (output of a test, was mostly written to a output/ subfolder (.gitignore'd) )
❯ find . -type d -wholename '*/test*' -not -name __pycache__ -not -wholename '*/test/*output*' -not -wholename '*/.venv*' -exec find {} -maxdepth 1 -type f -name '*.py' -not -name 'test_*' -quit \; -not -exec test -e "{}/__init__.py" \; -print
It only locates "subfolders" under test any depth, that are missing an init.py
Example:
find . -type d -wholename '*/test*' -not -name __pycache__ -not -wholename '*/test/*output*' -not -wholename '*/.venv*' -exec find {} -maxdepth 1 -type f -name '*.py' -not -name 'test_*' -quit \; -not -exec test -e "{}/__init__.py" \; -print ./cooord_under/runners/test
./cooord_under/test
./libmod/super_lib/take_i/test
./libmod/super_lib/artemis/test
./libmod/super_lib/test
./libmod/super_lib/dcx/test
./libmod/test
./maths/test
./strucon/plots/test
./strucon/specify/rf_opt/test
./strucon/specify/rf_opt/set_conductance/test
./strucon/data/test
./strucon/take_i/test
./strucon/collec/test
./strucon/collec/take_i_generators/test
./strucon/test
./strucon/test/configs
./strucon/test/platforms
./strucon/saar/test
./strucon/cannick/gains/test
./strucon/jarn/test
./strucon/backends/test
./logging/test
./makea/test
./baking/intermediate/wood_primitive/test
./baking/bakers/wood_to_artemis/facade/test
./baking/bakers/wood_to_artemis/test
./baking/bakers/test
./test/libmod/super_lib/test
./test/orchestrator
./test/switch_nons
./test/labs
./test/sim
./ordered/test
./ordered/test/common
./ordered/test/common/step
./ordered/test/common/setup
./ordered/test/common/stacked
./ordered/test/common/stacked/configs
./ordered/test/common/a
./ordered/test/common/a/b
./ordered/test/common/a/b/c
./ordered/test/common/a/b/d
./ordered/test/common/a/e
./ordered/test/common/symlinked_step
./ordered/test/bxas
./ordered/test/bxas/stub
./ordered/test/bxas/stub/setup
./ordered/test/bxas/bxa-specific-run
./ordered/test/bxas/bxa-specific-run/setup
./ordered/test/bxas/bxa-specific-config
./ordered/test/bxas/bxa-specific-config/setup
./locator_ation/noise/tests
./locator_ation/gfx/single_electron/test
./locator_ation/gfx/multi_cookie/test
./locator_ation/gfx/switch/test
./locator_ation/gfx/test
./locator_ation/builders/test
./locator_ation/delayed/smell/test
./locator_ation/delayed/test
./locator_ation/delayed/set/test
./see/nodes/test
./see/test
./see/test/configs
./lib_newlib/marketitecture/test
./lib_newlib/consult_do_do/test
./lib_newlib/consult_do_do/segments/test
./lib_newlib/consult_do_do/foo/test
./lib_newlib/consult_do_do/foo/scheduling_backends/test
./lib_newlib/consult_do_do/test
./aaa/artemis/test
./aaa/test
./aaa/feature_7/test