Skip to content

shell.py creates a module-level ChronoTerm singleton which crashes on import in tests #9

@AkshajSinghal

Description

@AkshajSinghal

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions