Here is my folder structure:
src/
src/package1
src/package1/package1
src/package1/package1/__init__.py
src/package1/package1/class_package1.py
src/package1/package1/test_package1.py
src/package2
src/package2/package2
src/package1/package2/__init__.py
src/package2/package2/class_package1.py
src/package2/package2/test_package1.py
This is a ROS2 packages structure, I can't modify it.
- Running
python -m unittestfromsrc/package1/package1runs allpackage1tests - Running
python -m unittestfromsrc/package2/package2runs allpackage2tests - Running
python -m unittest discover package1/package1fromsrcruns allpackage1tests - Running
python -m unittest discover package2/package2fromsrcruns allpackage2tests
However, is there a way to run all package1 AND package2 tests from src folder?
I suppose moving all tests to a new test package could make this work easily but I'd like to avoid that. I like tests to remain close to code itself.
python -m unittest discover(without package specification) work?runner_test.py(as explained in the post) in the foldersrcand executepython runner_test.pyby command line. I don't know if it is possible avoid writing code to solve your problem.