Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add push/pop methods to JigDriver #183

Open
clint-lawrence opened this issue May 28, 2024 · 0 comments
Open

Add push/pop methods to JigDriver #183

clint-lawrence opened this issue May 28, 2024 · 0 comments

Comments

@clint-lawrence
Copy link
Collaborator

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant