-
Notifications
You must be signed in to change notification settings - Fork 317
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
New Feature: Auto-generation of test code #1817
Conversation
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.
Thanks @trevorcampbell for updating this PR.
In a general case, can it (and should it) be combined with HIDDEN TESTS
, to prevent students from knowing the test cases ?
I made some comments/suggestions below.
nbgrader/apps/quickstartapp.py
Outdated
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.
Would it be possible to use the autotests only if a flag is provided (e.g. nbgrader quickstart --autotests
) ?
Currently the quickstart generate ps1/Problem3.ipynb, which is a copy of the ps1/Problem1.ipynb with autotests. It can be confusing. We could generate only one of these example, depending on the flag above.
Same for the tests.yml
file.
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.
Currently the quickstart generate ps1/Problem3.ipynb, which is a copy of the ps1/Problem1.ipynb with autotests. It can be confusing.
I agree. But the point of this example was to show something identical to problem1.ipynb
except implemented using Autotests (so instructors can compare the manual one to the automatic one). But having it named problem3.ipynb
is indeed confusing.
Maybe I can create ps1_autotests/
as a new assignment entirely, and make it clear in the documentation that it's a duplicated assignment except implemented using automatic tests?
Would it be possible to use the autotests only if a flag is provided (e.g. nbgrader quickstart --autotests) ?
I suspect if we make it clearer that it's meant to duplicate ps1
but show off autotest functionality, we don't need a separate flag for it.
Thoughts?
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.
I like the idea of the quickstart
generating an assignment as little as possible.
My opinion is that autotests is an advanced feature, and bringing a new configuration file (autotest.yml) in the quickstart can be confusing for people who just try to understand the basics of nbgrader
.
cc. @jhamrick @BertR @perllaghu if you have an opinion on it
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.
@brichet I'm happy to do as you suggest -- you're right, the quickstart should produce a very simple example to start from, and the flags can be used for advanced users.
Thanks for the comments @brichet ! Re: hidden tests -- yes, autotest works as expected with hidden tests. In So far I have done the following, per your request:
Two remaining things:
Let me know what you think about these two, and I'll get that sorted as quickly as possible. |
I agree about keeping the |
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.
Thanks for your quick update @trevorcampbell.
I added a few comments about syntax.
I didn't find documentation about the YAML file ?
Can you add some (if missing), maybe in advanced topic, with a link to it in “Autograder tests” cells with automatically generated test code.
Yesterday I merged a few changes concerning the documentation into #1819, I don't know if this improves the duration but the following test took less than 12 minutes. |
98c2927
to
2ceab61
Compare
Co-authored-by: Nicolas Brichet <[email protected]>
Co-authored-by: Nicolas Brichet <[email protected]>
… -> ps1; add quickstart test for autotest
OK @brichet :
I think that was everything from your suggestions. Let me know what you think! |
Set kernel working directory properly
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.
Thanks again @trevorcampbell for being so responsive.
The documentation looks great, and I like the --autotest
option in the quickstart.
Let me know if you think it's ready to merge, it looks good to me.
Thanks @brichet -- FYI: I added two more tests (just to catch the kernel working directory behaviour and release notebook consistency). I think it's ready to merge now. |
…pyter#1817) * initial conversion of autotest code from 0.7.x to 0.9.x * added docs html files for new problems to .gitignore * minor bugfix: shortened --source_with_tests flag in tests * output for source_with_tests set to the right directory * simplified kernel execution code * store kernel name in resources * minor ed * remove problem3.ipynb from the ui-tests * removed commented out timestamp code from earlier snippet execution * tests.yml -> autotests.yml * logging string interpolation * optional success code (and fix execute success code bug) * reraise filenotfound error when find autotest directive but no autotests.yml file * hash optional; raise error if not set * minor comment rephrasing * better if statement formatting Co-authored-by: Nicolas Brichet <[email protected]> * remove unnecessary spaces in start new kernel arg Co-authored-by: Nicolas Brichet <[email protected]> * clear outputs from test notebook * added jinja to pyproject * initial commit of advanced topics docs, minor polish on creating assignments docs * done advanced docs section on autotest * moved problem3 to it's own problem set ps1_autotest * moved problem3 to its own ps1_autotest assignment * remove problem3 from ps1 * ignore autotest assignment files; make quickstart rename ps1_autotest -> ps1; add quickstart test for autotest * remove ps2 R assignment; check for autotest directive in quickstart tests * minor code tags syntax fix in docs * set kernel working dir to notebook resources path * Convert to deterministic salt computed using cell source/index * minor ed * remove extra jinja from pyproject Co-authored-by: Nicolas Brichet <[email protected]> * add tests for kernel working dir and release nb consistency * minor bugfix in workingdir tests --------- Co-authored-by: Nicolas Brichet <[email protected]>
…pyter#1817) * initial conversion of autotest code from 0.7.x to 0.9.x * added docs html files for new problems to .gitignore * minor bugfix: shortened --source_with_tests flag in tests * output for source_with_tests set to the right directory * simplified kernel execution code * store kernel name in resources * minor ed * remove problem3.ipynb from the ui-tests * removed commented out timestamp code from earlier snippet execution * tests.yml -> autotests.yml * logging string interpolation * optional success code (and fix execute success code bug) * reraise filenotfound error when find autotest directive but no autotests.yml file * hash optional; raise error if not set * minor comment rephrasing * better if statement formatting Co-authored-by: Nicolas Brichet <[email protected]> * remove unnecessary spaces in start new kernel arg Co-authored-by: Nicolas Brichet <[email protected]> * clear outputs from test notebook * added jinja to pyproject * initial commit of advanced topics docs, minor polish on creating assignments docs * done advanced docs section on autotest * moved problem3 to it's own problem set ps1_autotest * moved problem3 to its own ps1_autotest assignment * remove problem3 from ps1 * ignore autotest assignment files; make quickstart rename ps1_autotest -> ps1; add quickstart test for autotest * remove ps2 R assignment; check for autotest directive in quickstart tests * minor code tags syntax fix in docs * set kernel working dir to notebook resources path * Convert to deterministic salt computed using cell source/index * minor ed * remove extra jinja from pyproject Co-authored-by: Nicolas Brichet <[email protected]> * add tests for kernel working dir and release nb consistency * minor bugfix in workingdir tests --------- Co-authored-by: Nicolas Brichet <[email protected]>
This PR supercedes #1650 and is compatible with the upcoming 0.9.x release. We can close that one in favour of this new PR, but see the old discussion there and at #1633.
Some notes:
ui-tests
I decided to just remove the newproblem3.ipynb
notebook from theuser_guide/source/ps1/
directory duringui-tests
to avoid triggering AutoTest.