diff --git a/nbgrader/tests/apps/test_nbgrader_quickstart.py b/nbgrader/tests/apps/test_nbgrader_quickstart.py index 57c67934b..6ab100310 100644 --- a/nbgrader/tests/apps/test_nbgrader_quickstart.py +++ b/nbgrader/tests/apps/test_nbgrader_quickstart.py @@ -117,3 +117,28 @@ def test_quickstart_f(self): # nbgrader generate_assignment should work run_nbgrader(["generate_assignment", "ps1"]) + + def test_quickstart_autotest(self): + """Is the quickstart example with autotests properly generated?""" + + run_nbgrader(["quickstart", "example", "--autotest"]) + + # it should fail if it already exists + run_nbgrader(["quickstart", "example", "--autotest"], retcode=1) + + # it should succeed if --force is given + os.remove(os.path.join("example", "nbgrader_config.py")) + run_nbgrader(["quickstart", "example", "--force", "--autotest"]) + assert os.path.exists(os.path.join("example", "nbgrader_config.py")) + assert os.path.exists(os.path.join("example", "autotests.yml")) + + # nbgrader validate should work + os.chdir("example") + for nb in os.listdir(os.path.join("source", "ps1")): + if not nb.endswith(".ipynb"): + continue + output = run_nbgrader(["validate", os.path.join("source", "ps1", nb)], stdout=True) + assert output.strip() == "Success! Your notebook passes all the tests." + + # nbgrader generate_assignment should work + run_nbgrader(["generate_assignment", "ps1"])