At the bottom of shell.py, after the class definition, there is chrono = ChronoTerm(). This runs at import time: it calls StateStore().load(), creates a Stopwatch, creates an AlarmManager, and immediately calls start_scheduler() which spawns a background daemon thread. This means just importing the module in a test spins up a real background thread and reads from disk. Any test that imports from shell.py (including indirectly through cli.py) will do this. If the state file is corrupted or the directory isn't writable, the entire import fails. This also makes it impossible to mock the ChronoTerm initializer in tests.
At the bottom of shell.py, after the class definition, there is chrono = ChronoTerm(). This runs at import time: it calls StateStore().load(), creates a Stopwatch, creates an AlarmManager, and immediately calls start_scheduler() which spawns a background daemon thread. This means just importing the module in a test spins up a real background thread and reads from disk. Any test that imports from shell.py (including indirectly through cli.py) will do this. If the state file is corrupted or the directory isn't writable, the entire import fails. This also makes it impossible to mock the ChronoTerm initializer in tests.