-
Notifications
You must be signed in to change notification settings - Fork 240
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
Protect options()
from modifications by student or checking code
#542
Conversation
Are there any other things besides options that need to be protected in this way? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Just a few comments to simplify the code and improve readability of the tests
I've found that the same issue with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more little update (see #542 (comment)) and then we'll be good to go. Can you also please add a NEWS item for this PR? Thank you!
…nd `render_exercise()`
@rossellhayes I added two tests that also check that the checking code doesn't end up modifying the options or env vars. Do you think we've covered all of our bases in the tests? |
Good thinking! That all seems good to me, I can't think of anything that's missing |
options()
from modifications by studentsoptions()
from modifications by student or checking code
This modifies
evaluate_exercise()
to capture the state ofoptions()
when the tutorial is first loaded. This snapshot is restored each time an exercise is run. This allows tutorial authors to still set options in thesetup
chunk. Students can modify options within a chunk, but these options are not carried over to later chunks or subsequent runs of the same chunk.