def test_start():
    w = _worker.PeriodicWorkerThread()
    w.start()
    assert w.is_alive()
    w.stop()
    w.join()
    assert not w.is_alive()
def test_restart():
    w = _worker.PeriodicWorkerThread()
    w.start()
    assert w.is_alive()
    w.stop()
    w.join()
    assert not w.is_alive()

    with pytest.raises(RuntimeError):
        w.start()
def test_atexit_not_started():
    w = _worker.PeriodicWorkerThread(exit_timeout=1)
    assert not w.started
    w._atexit()