gauge-sh / tach

A Python tool to enforce dependencies, using modular architecture 🌎 Open source 🐍 Installable via pip πŸ”§ Able to be adopted incrementally - ⚑ Implemented with no runtime impact ♾️ Interoperable with your existing systems πŸ¦€ Written in rust
https://gauge.sh
MIT License
953 stars 33 forks source link

'tach test' should return exit code zero when no tests run #171

Closed emdoyle closed 1 month ago

emdoyle commented 1 month ago

Right now, if tach test determines that all tests can be skipped, the exit code from pytest is 5. This might mean that we should adjust the way the plugin operates (there may be a more native way to indicate tests should be skipped), adjust pytest's configuration, or maybe we need to diverge from pytest's behavior here and manually return zero in this case.

Example:

.venv/bin/tach test
============ Cached results found!  ============
==================================================== test session starts =====================================================
platform linux -- Python 3.12.3, pytest-8.2.2, pluggy-1.5.0
rootdir: /home/evan/Programming/tach
configfile: pyproject.toml
plugins: mock-3.14.0
collected 85 items                                                                                                           
[Tach] Skipped 10 test files (85 tests) since they were unaffected by current changes.
[Tach] > Skipped '/home/evan/Programming/tach/python/tests/test_affected_modules.py'
[Tach] > Skipped '/home/evan/Programming/tach/python/tests/test_parsing.py'
[Tach] > Skipped '/home/evan/Programming/tach/python/tests/test_check.py'
[Tach] > Skipped '/home/evan/Programming/tach/python/tests/test_file_tree.py'
[Tach] > Skipped '/home/evan/Programming/tach/python/tests/test_module_tree.py'
[Tach] > Skipped '/home/evan/Programming/tach/python/tests/test_cli.py'
[Tach] > Skipped '/home/evan/Programming/tach/python/tests/test_changed_files.py'
[Tach] > Skipped '/home/evan/Programming/tach/python/tests/test_report.py'
[Tach] > Skipped '/home/evan/Programming/tach/python/tests/test_imports.py'
[Tach] > Skipped '/home/evan/Programming/tach/python/tests/test_cache.py'

=================================================== no tests ran in 0.28s ====================================================
============ END Cached results  ============
make: *** [Makefile:41: test] Error 5
tiluckdave commented 1 month ago

Can you assign me this

emdoyle commented 1 month ago

@tiluckdave I think one at a time is best, given you are already working on #169. I think I will tackle this one since it's been bugging me in my pre-commit hook.