PyFixate / Fixate

Framework for hardware test fixtures and automatic test environments
MIT License
22 stars 16 forks source link

Add push/pop methods to JigDriver #183

Open clint-lawrence opened 3 months ago

clint-lawrence commented 3 months ago

The idea here is to setup a the jig into a particular state, then be able to save that at the start of a test. Maybe save/restore would be a better name? Should the state be keep in jig driver or stored locally.

def test():
    jig_state = jig.save()
    jig.mux.switch(...)
    ...
    jig.mux.switch(...)
    ...
    jig.restore(jig_state)

vs

def test():
    jig.push()
    jig.mux.switch(...)
    ...
    jig.mux.switch(...)
    ...
    jig.pop()

Or even a context manager

def test():
    with jig:
        jig.mux.switch(...)
        ...
        jig.mux.switch(...)
        ...

    # state is automatically restored when exiting the `with` block.