from ophyd.controls.ophydobj import StatusBase


def _setup_st():
    st = StatusBase()
    state = {}

    def cb():
        state['done'] = True

    return st, state, cb


def test_status_post():
    st, state, cb = _setup_st()

    assert 'done' not in state
    st.finished_cb = cb
    assert 'done' not in state
    st._finished()
    assert 'done' in state
    assert state['done']


def test_status_pre():
    st, state, cb = _setup_st()

    st._finished()

    assert 'done' not in state
    st.finished_cb = cb
    assert 'done' in state
    assert state['done']

from ophyd.ophydobj import StatusBase


def _setup_st():
    st = StatusBase()
    state = {}

    def cb():
        state['done'] = True

    return st, state, cb


def test_status_post():
    st, state, cb = _setup_st()

    assert 'done' not in state
    st.finished_cb = cb
    assert 'done' not in state
    st._finished()
    assert 'done' in state
    assert state['done']


def test_status_pre():
    st, state, cb = _setup_st()

    st._finished()

    assert 'done' not in state
    st.finished_cb = cb
    assert 'done' in state
    assert state['done']

Remove new instnace of 'controls' from status test.